Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
Initial commit
valzorc7ddaab02cf0
diff --git a/.github/workflows/publish-scheduled.yml b/.github/workflows/publish-scheduled.ymlnew file mode 100644index 0000000..bf530a9--- /dev/null+++ b/.github/workflows/publish-scheduled.yml@@ -0,0 +1,65 @@+name: Instagram Scheduled Publisher++# Automatically publishes scheduled Instagram posts via GitHub Actions.+# Runs every 15 minutes — posts publish within ~15 min of their scheduled time.+#+# FREE TIER USAGE:+# Public repos → unlimited minutes (recommended)+# Private repos → 2,000 min/month; change cron to '*/30 * * * *' to stay within limit+#+# REQUIRED SECRETS (set in GitHub repo → Settings → Secrets → Actions):+# ACCOUNTS_JSON — Base64-encoded contents of backend/data/accounts.json+# Generate with: cat backend/data/accounts.json | base64+# (PowerShell: [Convert]::ToBase64String([IO.File]::ReadAllBytes("backend\data\accounts.json")))++on:+ schedule:+ - cron: '*/60 * * * *'+ workflow_dispatch: # Manual trigger from GitHub UI++permissions:+ contents: write++jobs:+ publish:+ runs-on: ubuntu-latest+ steps:+ - name: Checkout repository+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: 20++ - name: Check for due posts+ id: check+ run: |+ if [ ! -f "backend/data/scheduled_posts.json" ]; then+ echo "No scheduled_posts.json found"+ echo "has_due=false" >> $GITHUB_OUTPUT+ exit 0+ fi+ DUE=$(node -e "+ const posts = JSON.parse(require('fs').readFileSync('backend/data/scheduled_posts.json', 'utf8'));+ const now = new Date();+ const due = posts.filter(p => p.status === 'pending' && new Date(p.scheduledAt) <= now);+ console.log(due.length > 0 ? 'true' : 'false');+ ")+ echo "has_due=$DUE" >> $GITHUB_OUTPUT+ echo "Due posts found: $DUE"++ - name: Publish scheduled posts+ if: steps.check.outputs.has_due == 'true'+ run: node scripts/publish-scheduled.js+ env:+ ACCOUNTS_JSON: ${{ secrets.ACCOUNTS_JSON }}++ - name: Commit updated schedule+ if: steps.check.outputs.has_due == 'true'+ run: |+ git config user.name "GitHub Actions Bot"+ git config user.email "[email protected]"+ git add backend/data/scheduled_posts.json+ git diff --staged --quiet || git commit -m "📅 Auto-publish: $(date -u '+%Y-%m-%d %H:%M UTC') [skip ci]"+ git pushdiff --git a/.gitignore b/.gitignorenew file mode 100644index 0000000..25f667a--- /dev/null+++ b/.gitignore@@ -0,0 +1,33 @@+# Dependencies+node_modules/++# Sensitive data — NEVER commit these+backend/data/accounts.json+backend/data/api_keys.json++# Cache files+backend/data/videos_cache.json+backend/data/ig_cache.json+backend/data/history.json++# Frontend build+frontend/dist/++# OS files+.DS_Store+Thumbs.db++# Editor+.vscode/*+!.vscode/extensions.json+.idea/+*.sw?+*.suo+*.ntvs*+*.njsproj+*.sln++# Logs+*.log+npm-debug.log*+yarn-debug.log*diff --git a/backend/data/scheduled_posts.json b/backend/data/scheduled_posts.jsonnew file mode 100644index 0000000..70b059c--- /dev/null+++ b/backend/data/scheduled_posts.json@@ -0,0 +1,23 @@+[+ {+ "id": "mmb0hhnyqy0ydv",+ "accountId": "1772561063178",+ "platform": "instagram",+ "mediaType": "REELS",+ "mediaUrl": "https://res.cloudinary.com/dbilmziyw/video/upload/v1772566766/rrftzb2sialut2adzaew.mp4",+ "caption": "🎬 Anime Details...\n\n* Anime Name: Hunter x Hunter\n* Anime Episodes: 148 (2011 version)\n* Anime Seasons: 6 (categorized arcs)\n* Anime MAL Rating: 9.0+ ⭐\n* Anime Short Description: Gon Freecss sets out to become a Hunter and find his father, facing deadly exams, powerful enemies, and intense Nen battles.\n* Is it ongoing? (Yes/No): No (anime paused)\n* Future updates or interesting news: No continuation announced; manga activity influences any potential return.\n\n📚 Manga Details\n\n* Manga Name: Hunter x Hunter\n* Volumes: 37+\n* Rating: 8.7+ ⭐\n* Future updates: Manga resumed intermittently; author Yoshihiro Togashi continues releasing chapters irregularly due to health breaks.\n\n#HunterXHunter #HxH #GonFreecss #AnimeFans #MangaUpdates",+ "coverUrl": null,+ "shareToFeed": true,+ "collaborators": [],+ "audioName": "",+ "thumbOffset": null,+ "locationId": "",+ "userTags": [],+ "altText": "",+ "scheduledAt": "2026-03-05T02:30:00.000Z",+ "status": "pending",+ "createdAt": "2026-03-03T19:39:25.486Z",+ "publishedMediaId": null,+ "error": null+ }+]\ No newline at end of filediff --git a/backend/package-lock.json b/backend/package-lock.jsonnew file mode 100644index 0000000..0b0ac0c--- /dev/null+++ b/backend/package-lock.json@@ -0,0 +1,1274 @@+{+ "name": "youtube-analytics-backend",+ "version": "2.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "youtube-analytics-backend",+ "version": "2.0.0",+ "dependencies": {+ "cors": "^2.8.5",+ "express": "^4.18.2",+ "node-fetch": "^2.7.0"+ },+ "devDependencies": {+ "nodemon": "^3.0.2"+ }+ },+ "node_modules/accepts": {+ "version": "1.3.8",+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",+ "license": "MIT",+ "dependencies": {+ "mime-types": "~2.1.34",+ "negotiator": "0.6.3"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/anymatch": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "normalize-path": "^3.0.0",+ "picomatch": "^2.0.4"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/array-flatten": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",+ "license": "MIT"+ },+ "node_modules/balanced-match": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "18 || 20 || >=22"+ }+ },+ "node_modules/binary-extensions": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/body-parser": {+ "version": "1.20.4",+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",+ "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "content-type": "~1.0.5",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "~1.2.0",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "on-finished": "~2.4.1",+ "qs": "~6.14.0",+ "raw-body": "~2.5.3",+ "type-is": "~1.6.18",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/brace-expansion": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz",+ "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^4.0.2"+ },+ "engines": {+ "node": "18 || 20 || >=22"+ }+ },+ "node_modules/braces": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fill-range": "^7.1.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/bytes": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/call-bind-apply-helpers": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/call-bound": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "get-intrinsic": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/chokidar": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "anymatch": "~3.1.2",+ "braces": "~3.0.2",+ "glob-parent": "~5.1.2",+ "is-binary-path": "~2.1.0",+ "is-glob": "~4.0.1",+ "normalize-path": "~3.0.0",+ "readdirp": "~3.6.0"+ },+ "engines": {+ "node": ">= 8.10.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/content-disposition": {+ "version": "0.5.4",+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "5.2.1"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/content-type": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie-signature": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "license": "MIT"+ },+ "node_modules/cors": {+ "version": "2.8.6",+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",+ "license": "MIT",+ "dependencies": {+ "object-assign": "^4",+ "vary": "^1"+ },+ "engines": {+ "node": ">= 0.10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/debug": {+ "version": "2.6.9",+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "license": "MIT",+ "dependencies": {+ "ms": "2.0.0"+ }+ },+ "node_modules/depd": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/destroy": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/dunder-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.1",+ "es-errors": "^1.3.0",+ "gopd": "^1.2.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/ee-first": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",+ "license": "MIT"+ },+ "node_modules/encodeurl": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/escape-html": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",+ "license": "MIT"+ },+ "node_modules/etag": {+ "version": "1.8.1",+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/express": {+ "version": "4.22.1",+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",+ "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",+ "license": "MIT",+ "dependencies": {+ "accepts": "~1.3.8",+ "array-flatten": "1.1.1",+ "body-parser": "~1.20.3",+ "content-disposition": "~0.5.4",+ "content-type": "~1.0.4",+ "cookie": "~0.7.1",+ "cookie-signature": "~1.0.6",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "finalhandler": "~1.3.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.0",+ "merge-descriptors": "1.0.3",+ "methods": "~1.1.2",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "path-to-regexp": "~0.1.12",+ "proxy-addr": "~2.0.7",+ "qs": "~6.14.0",+ "range-parser": "~1.2.1",+ "safe-buffer": "5.2.1",+ "send": "~0.19.0",+ "serve-static": "~1.16.2",+ "setprototypeof": "1.2.0",+ "statuses": "~2.0.1",+ "type-is": "~1.6.18",+ "utils-merge": "1.0.1",+ "vary": "~1.1.2"+ },+ "engines": {+ "node": ">= 0.10.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/fill-range": {+ "version": "7.1.1",+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "to-regex-range": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/finalhandler": {+ "version": "1.3.2",+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "statuses": "~2.0.2",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/forwarded": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fresh": {+ "version": "0.5.2",+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-intrinsic": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "es-define-property": "^1.0.1",+ "es-errors": "^1.3.0",+ "es-object-atoms": "^1.1.1",+ "function-bind": "^1.1.2",+ "get-proto": "^1.0.1",+ "gopd": "^1.2.0",+ "has-symbols": "^1.1.0",+ "hasown": "^2.0.2",+ "math-intrinsics": "^1.1.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",+ "license": "MIT",+ "dependencies": {+ "dunder-proto": "^1.0.1",+ "es-object-atoms": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-flag": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/has-symbols": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/http-errors": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",+ "license": "MIT",+ "dependencies": {+ "depd": "~2.0.0",+ "inherits": "~2.0.4",+ "setprototypeof": "~1.2.0",+ "statuses": "~2.0.2",+ "toidentifier": "~1.0.1"+ },+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.4.24",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/ignore-by-default": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",+ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "license": "ISC"+ },+ "node_modules/ipaddr.js": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/is-binary-path": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "binary-extensions": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-glob": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-extglob": "^2.1.1"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-number": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.12.0"+ }+ },+ "node_modules/math-intrinsics": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/media-typer": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/merge-descriptors": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/methods": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",+ "license": "MIT",+ "bin": {+ "mime": "cli.js"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/mime-db": {+ "version": "1.52.0",+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime-types": {+ "version": "2.1.35",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",+ "license": "MIT",+ "dependencies": {+ "mime-db": "1.52.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/minimatch": {+ "version": "10.2.4",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz",+ "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==",+ "dev": true,+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "brace-expansion": "^5.0.2"+ },+ "engines": {+ "node": "18 || 20 || >=22"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/ms": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "license": "MIT"+ },+ "node_modules/negotiator": {+ "version": "0.6.3",+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },+ "node_modules/nodemon": {+ "version": "3.1.14",+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz",+ "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chokidar": "^3.5.2",+ "debug": "^4",+ "ignore-by-default": "^1.0.1",+ "minimatch": "^10.2.1",+ "pstree.remy": "^1.1.8",+ "semver": "^7.5.3",+ "simple-update-notifier": "^2.0.0",+ "supports-color": "^5.5.0",+ "touch": "^3.1.0",+ "undefsafe": "^2.0.5"+ },+ "bin": {+ "nodemon": "bin/nodemon.js"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/nodemon"+ }+ },+ "node_modules/nodemon/node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/nodemon/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/normalize-path": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-inspect": {+ "version": "1.13.4",+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/on-finished": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",+ "license": "MIT",+ "dependencies": {+ "ee-first": "1.1.1"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/parseurl": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/path-to-regexp": {+ "version": "0.1.12",+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",+ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",+ "license": "MIT"+ },+ "node_modules/picomatch": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/proxy-addr": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",+ "license": "MIT",+ "dependencies": {+ "forwarded": "0.2.0",+ "ipaddr.js": "1.9.1"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/pstree.remy": {+ "version": "1.1.8",+ "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",+ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/qs": {+ "version": "6.14.2",+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",+ "integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "side-channel": "^1.1.0"+ },+ "engines": {+ "node": ">=0.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/range-parser": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/raw-body": {+ "version": "2.5.3",+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/readdirp": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "picomatch": "^2.2.1"+ },+ "engines": {+ "node": ">=8.10.0"+ }+ },+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.7.4",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",+ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/send": {+ "version": "0.19.2",+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "1.2.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.1",+ "mime": "1.6.0",+ "ms": "2.1.3",+ "on-finished": "~2.4.1",+ "range-parser": "~1.2.1",+ "statuses": "~2.0.2"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/send/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/serve-static": {+ "version": "1.16.3",+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",+ "license": "MIT",+ "dependencies": {+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "parseurl": "~1.3.3",+ "send": "~0.19.1"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/setprototypeof": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",+ "license": "ISC"+ },+ "node_modules/side-channel": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3",+ "side-channel-list": "^1.0.0",+ "side-channel-map": "^1.0.1",+ "side-channel-weakmap": "^1.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-list": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-map": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-weakmap": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3",+ "side-channel-map": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/simple-update-notifier": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",+ "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "semver": "^7.5.3"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/statuses": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/supports-color": {+ "version": "5.5.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^3.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/to-regex-range": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-number": "^7.0.0"+ },+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/toidentifier": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.6"+ }+ },+ "node_modules/touch": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",+ "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "nodetouch": "bin/nodetouch.js"+ }+ },+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "license": "MIT"+ },+ "node_modules/type-is": {+ "version": "1.6.18",+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",+ "license": "MIT",+ "dependencies": {+ "media-typer": "0.3.0",+ "mime-types": "~2.1.24"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/undefsafe": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",+ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/unpipe": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/utils-merge": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4.0"+ }+ },+ "node_modules/vary": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "license": "BSD-2-Clause"+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ }+ }+}diff --git a/backend/package.json b/backend/package.jsonnew file mode 100644index 0000000..10b4e35--- /dev/null+++ b/backend/package.json@@ -0,0 +1,18 @@+{+ "name": "youtube-analytics-backend",+ "version": "2.0.0",+ "description": "YouTube Analytics Dashboard - Backend API Server",+ "main": "server.js",+ "scripts": {+ "start": "node server.js",+ "dev": "nodemon server.js"+ },+ "dependencies": {+ "cors": "^2.8.5",+ "express": "^4.18.2",+ "node-fetch": "^2.7.0"+ },+ "devDependencies": {+ "nodemon": "^3.0.2"+ }+}\ No newline at end of filediff --git a/backend/server.js b/backend/server.jsnew file mode 100644index 0000000..d2aea3b--- /dev/null+++ b/backend/server.js@@ -0,0 +1,1979 @@+const express = require('express');+const cors = require('cors');+const fs = require('fs').promises;+const path = require('path');+const fetch = require('node-fetch');++const app = express();+const PORT = 3001;++app.use(cors());+app.use(express.json());++const DATA_DIR = path.join(__dirname, 'data');+const ACCOUNTS_FILE = path.join(DATA_DIR, 'accounts.json');+const API_KEYS_FILE = path.join(DATA_DIR, 'api_keys.json');+const VIDEOS_CACHE_FILE = path.join(DATA_DIR, 'videos_cache.json');+const IG_CACHE_FILE = path.join(DATA_DIR, 'ig_cache.json');+const SCHEDULED_POSTS_FILE = path.join(DATA_DIR, 'scheduled_posts.json');++// ─── Data Helpers ────────────────────────────────────────────────────────────++async function initializeData() {+ try {+ await fs.mkdir(DATA_DIR, { recursive: true });+ const defaults = [+ [ACCOUNTS_FILE, []],+ [API_KEYS_FILE, { youtube: '', instagram: { appId: '', appSecret: '' }, cloudinary: { cloudName: '', uploadPreset: '' }, github: { token: '', repo: '', branch: 'main' } }],+ [VIDEOS_CACHE_FILE, {}],+ [IG_CACHE_FILE, {}],+ [SCHEDULED_POSTS_FILE, []],+ ];+ for (const [file, defaultData] of defaults) {+ try {+ await fs.access(file);+ } catch {+ await fs.writeFile(file, JSON.stringify(defaultData, null, 2));+ }+ }+ console.log('Data files initialized');+ } catch (err) {+ console.error('Init error:', err);+ }+}++async function readJSON(filePath) {+ try {+ return JSON.parse(await fs.readFile(filePath, 'utf8'));+ } catch {+ return null;+ }+}++async function writeJSON(filePath, data) {+ try {+ await fs.writeFile(filePath, JSON.stringify(data, null, 2));+ return true;+ } catch {+ return false;+ }+}++// ─── GitHub Sync (for GitHub Actions scheduling) ─────────────────────────────++async function syncScheduledPostsToGitHub() {+ try {+ const keys = await readJSON(API_KEYS_FILE) || {};+ const gh = keys.github;+ if (!gh?.token || !gh?.repo) return; // Not configured++ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const content = Buffer.from(JSON.stringify(posts, null, 2)).toString('base64');+ const filePath = 'backend/data/scheduled_posts.json';+ const branch = gh.branch || 'main';++ // Get current file SHA (needed for updates)+ let sha;+ try {+ const res = await fetch(`https://api.github.com/repos/${gh.repo}/contents/${filePath}?ref=${branch}`, {+ headers: { Authorization: `token ${gh.token}`, 'User-Agent': 'SocialMediaDashboard' }+ });+ if (res.ok) {+ const data = await res.json();+ sha = data.sha;+ }+ } catch { }++ // Create or update file+ const body = { message: '📅 Sync scheduled posts', content, branch };+ if (sha) body.sha = sha;++ const res = await fetch(`https://api.github.com/repos/${gh.repo}/contents/${filePath}`, {+ method: 'PUT',+ headers: {+ Authorization: `token ${gh.token}`,+ 'Content-Type': 'application/json',+ 'User-Agent': 'SocialMediaDashboard'+ },+ body: JSON.stringify(body),+ });++ if (res.ok) {+ console.log(' ☁️ Synced scheduled posts to GitHub');+ } else {+ const err = await res.json();+ console.error(' ☁️ GitHub sync error:', err.message);+ }+ } catch (err) {+ console.error(' ☁️ GitHub sync error:', err.message);+ }+}++async function pullScheduledPostsFromGitHub() {+ try {+ const keys = await readJSON(API_KEYS_FILE) || {};+ const gh = keys.github;+ if (!gh?.token || !gh?.repo) return;++ const filePath = 'backend/data/scheduled_posts.json';+ const branch = gh.branch || 'main';++ const res = await fetch(`https://api.github.com/repos/${gh.repo}/contents/${filePath}?ref=${branch}`, {+ headers: { Authorization: `token ${gh.token}`, 'User-Agent': 'SocialMediaDashboard' }+ });+ if (!res.ok) return;++ const data = await res.json();+ const remotePosts = JSON.parse(Buffer.from(data.content, 'base64').toString('utf8'));+ const localPosts = await readJSON(SCHEDULED_POSTS_FILE) || [];++ // Merge: remote published/failed status wins; local-only posts are kept+ const remoteMap = new Map(remotePosts.map(p => [p.id, p]));+ const localMap = new Map(localPosts.map(p => [p.id, p]));+ const merged = [];++ for (const rp of remotePosts) {+ const lp = localMap.get(rp.id);+ if (!lp || rp.status === 'published' || rp.status === 'failed') {+ merged.push(rp); // Remote version takes precedence for terminal states+ } else {+ merged.push(lp); // Local is more current otherwise+ }+ }+ // Add local-only posts (created while server was off & GH Actions hasn't synced)+ for (const lp of localPosts) {+ if (!remoteMap.has(lp.id)) merged.push(lp);+ }++ await writeJSON(SCHEDULED_POSTS_FILE, merged);+ console.log(` ☁️ Pulled ${remotePosts.length} post(s) from GitHub, merged to ${merged.length}`);+ } catch (err) {+ console.error(' ☁️ GitHub pull error:', err.message);+ }+}++async function getAPIKey() {+ const keys = await readJSON(API_KEYS_FILE);+ return keys?.youtube || '';+}++async function getIGAppCredentials() {+ const keys = await readJSON(API_KEYS_FILE);+ return keys?.instagram || { appId: '', appSecret: '' };+}++// ─── Instagram Graph API Helpers (Instagram API with Instagram Login) ────────+// Docs: https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login+// Uses graph.instagram.com (NOT graph.facebook.com)+// Instagram App ID & App Secret come from App Dashboard > Instagram > API setup++const IG_GRAPH_URL = 'https://graph.instagram.com';+const IG_API_VERSION = 'v25.0';++async function igFetch(endpoint, params = {}) {+ // Endpoints that start with /oauth, /access_token, /refresh_access_token are unversioned+ const needsVersion = !endpoint.startsWith('/oauth') &&+ !endpoint.startsWith('/access_token') &&+ !endpoint.startsWith('/refresh_access_token');+ const base = needsVersion ? `${IG_GRAPH_URL}/${IG_API_VERSION}` : IG_GRAPH_URL;+ const url = new URL(`${base}${endpoint}`);+ Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));+ const res = await fetch(url.toString());+ const data = await res.json();+ if (data.error) throw new Error(data.error.message || data.error.error_message || JSON.stringify(data.error));+ if (data.error_message) throw new Error(data.error_message);+ return data;+}++// Exchange a short-lived Instagram token for a long-lived one (~60 days)+// Endpoint: GET https://graph.instagram.com/access_token+async function exchangeForLongLivedToken(shortToken, appSecret) {+ const data = await igFetch('/access_token', {+ grant_type: 'ig_exchange_token',+ client_secret: appSecret,+ access_token: shortToken,+ });+ if (!data.access_token) throw new Error('Failed to exchange token — check Instagram App Secret');+ return {+ accessToken: data.access_token,+ tokenType: data.token_type || 'bearer',+ expiresIn: data.expires_in || 5184000, // ~60 days+ };+}++// Refresh a long-lived token for another 60 days+// Endpoint: GET https://graph.instagram.com/refresh_access_token+async function refreshLongLivedToken(longToken) {+ const data = await igFetch('/refresh_access_token', {+ grant_type: 'ig_refresh_token',+ access_token: longToken,+ });+ if (!data.access_token) throw new Error('Failed to refresh token');+ return {+ accessToken: data.access_token,+ tokenType: data.token_type || 'bearer',+ expiresIn: data.expires_in || 5184000,+ };+}++// Get the Instagram user ID & profile using /me (no Facebook Pages needed)+async function fetchInstagramProfile(igUserId, accessToken) {+ // If no igUserId provided, use /me to discover it+ const endpoint = igUserId ? `/${igUserId}` : '/me';+ const data = await igFetch(endpoint, {+ access_token: accessToken,+ fields: 'user_id,username,name,profile_picture_url,followers_count,follows_count,media_count,biography,website',+ });+ return {+ igUserId: data.user_id || data.id || igUserId,+ name: data.name || '',+ username: data.username || '',+ profilePictureUrl: data.profile_picture_url || '',+ followersCount: data.followers_count || 0,+ followsCount: data.follows_count || 0,+ mediaCount: data.media_count || 0,+ biography: data.biography || '',+ website: data.website || '',+ };+}++async function fetchInstagramMedia(igUserId, accessToken, limit = 500) {+ let allMedia = [];+ // Use the versioned IG Graph API for media — fetch up to 100 per page, paginate up to 10 pages+ let url = `${IG_GRAPH_URL}/${IG_API_VERSION}/${igUserId}/media?access_token=${accessToken}&fields=id,caption,media_type,media_url,thumbnail_url,permalink,timestamp,like_count,comments_count&limit=${Math.min(limit, 100)}`;++ let pages = 0;+ while (url && pages < 10 && allMedia.length < limit) {+ const res = await fetch(url);+ const data = await res.json();+ if (data.error) throw new Error(data.error.message || data.error.error_message);+ if (data.data) allMedia = allMedia.concat(data.data);+ url = data.paging?.next || null;+ pages++;+ }++ return allMedia.slice(0, limit).map(m => ({+ id: m.id,+ caption: m.caption || '',+ mediaType: m.media_type || 'IMAGE',+ mediaUrl: m.media_url || '',+ thumbnailUrl: m.thumbnail_url || m.media_url || '',+ permalink: m.permalink || '',+ timestamp: m.timestamp || '',+ likeCount: m.like_count || 0,+ commentsCount: m.comments_count || 0,+ }));+}++function computeInstagramAnalytics(profile, media) {+ const emptyAnalytics = {+ totalPosts: profile.mediaCount || 0, fetchedPosts: 0,+ totalLikes: 0, totalComments: 0, totalEngagement: 0,+ avgLikes: 0, avgComments: 0, avgEngagement: 0,+ medianLikes: 0, medianComments: 0,+ engagementRate: 0, likesPerFollower: 0, commentsPerFollower: 0,+ bestByLikes: null, bestByComments: null, worstByLikes: null,+ recentMedia: [], mediaTypeDistribution: {},+ postFrequency: { perWeek: 0, perMonth: 0 },+ topPosts: [], performanceByType: {},+ hashtagAnalysis: [], captionLengthCorrelation: [],+ postsByDayOfWeek: [], postsByHour: [],+ engagementTimeline: [], monthlyBreakdown: [],+ postsLast7Days: 0, postsLast30Days: 0, postsLast90Days: 0,+ viralityScore: 0, consistencyScore: 0,+ bestPostingDay: '', bestPostingHour: '',+ likesToCommentsRatio: 0,+ };+ if (!media || media.length === 0) return emptyAnalytics;++ const totalLikes = media.reduce((s, m) => s + m.likeCount, 0);+ const totalComments = media.reduce((s, m) => s + m.commentsCount, 0);+ const totalEngagement = totalLikes + totalComments;+ const avgLikes = Math.round(totalLikes / media.length);+ const avgComments = Math.round(totalComments / media.length);+ const avgEngagement = Math.round(totalEngagement / media.length);+ const engagementRate = profile.followersCount > 0+ ? parseFloat(((totalLikes + totalComments) / media.length / profile.followersCount * 100).toFixed(2))+ : 0;+ const likesPerFollower = profile.followersCount > 0+ ? parseFloat((totalLikes / media.length / profile.followersCount * 100).toFixed(2)) : 0;+ const commentsPerFollower = profile.followersCount > 0+ ? parseFloat((totalComments / media.length / profile.followersCount * 100).toFixed(2)) : 0;++ // Median+ const sortedLikes = [...media].map(m => m.likeCount).sort((a, b) => a - b);+ const sortedComments = [...media].map(m => m.commentsCount).sort((a, b) => a - b);+ const mid = Math.floor(sortedLikes.length / 2);+ const medianLikes = sortedLikes.length % 2 ? sortedLikes[mid] : Math.round((sortedLikes[mid - 1] + sortedLikes[mid]) / 2);+ const medianComments = sortedComments.length % 2 ? sortedComments[mid] : Math.round((sortedComments[mid - 1] + sortedComments[mid]) / 2);++ const byLikes = [...media].sort((a, b) => b.likeCount - a.likeCount);+ const byComments = [...media].sort((a, b) => b.commentsCount - a.commentsCount);+ const likesToCommentsRatio = totalComments > 0 ? parseFloat((totalLikes / totalComments).toFixed(1)) : 0;++ // Media type distribution + performance by type+ const mediaTypes = {};+ const typeStats = {};+ media.forEach(m => {+ const t = m.mediaType;+ mediaTypes[t] = (mediaTypes[t] || 0) + 1;+ if (!typeStats[t]) typeStats[t] = { likes: 0, comments: 0, count: 0 };+ typeStats[t].likes += m.likeCount;+ typeStats[t].comments += m.commentsCount;+ typeStats[t].count++;+ });+ const performanceByType = {};+ Object.entries(typeStats).forEach(([type, s]) => {+ performanceByType[type] = {+ count: s.count,+ avgLikes: Math.round(s.likes / s.count),+ avgComments: Math.round(s.comments / s.count),+ avgEngagement: Math.round((s.likes + s.comments) / s.count),+ totalLikes: s.likes,+ totalComments: s.comments,+ };+ });++ // Post frequency+ const dates = media.map(m => new Date(m.timestamp)).filter(d => !isNaN(d));+ let perWeek = 0, perMonth = 0;+ if (dates.length >= 2) {+ const newest = Math.max(...dates);+ const oldest = Math.min(...dates);+ const spanDays = Math.max(1, (newest - oldest) / 86400000);+ perWeek = parseFloat((media.length / spanDays * 7).toFixed(1));+ perMonth = parseFloat((media.length / spanDays * 30).toFixed(1));+ }++ // Posts by day of week+ const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];+ const dayBuckets = Array(7).fill(null).map(() => ({ count: 0, likes: 0, comments: 0 }));+ dates.forEach((d, i) => {+ const day = d.getDay();+ dayBuckets[day].count++;+ dayBuckets[day].likes += media[i]?.likeCount || 0;+ dayBuckets[day].comments += media[i]?.commentsCount || 0;+ });+ const postsByDayOfWeek = dayBuckets.map((b, i) => ({+ day: dayNames[i], shortDay: dayNames[i].slice(0, 3),+ posts: b.count,+ avgLikes: b.count > 0 ? Math.round(b.likes / b.count) : 0,+ avgComments: b.count > 0 ? Math.round(b.comments / b.count) : 0,+ avgEngagement: b.count > 0 ? Math.round((b.likes + b.comments) / b.count) : 0,+ }));+ const bestDayObj = postsByDayOfWeek.reduce((best, d) => d.avgEngagement > best.avgEngagement ? d : best, postsByDayOfWeek[0]);+ const bestPostingDay = bestDayObj?.day || '';++ // Posts by hour+ const hourBuckets = Array(24).fill(null).map(() => ({ count: 0, likes: 0, comments: 0 }));+ dates.forEach((d, i) => {+ const h = d.getHours();+ hourBuckets[h].count++;+ hourBuckets[h].likes += media[i]?.likeCount || 0;+ hourBuckets[h].comments += media[i]?.commentsCount || 0;+ });+ const postsByHour = hourBuckets.map((b, i) => ({+ hour: i, label: `${i}:00`,+ posts: b.count,+ avgEngagement: b.count > 0 ? Math.round((b.likes + b.comments) / b.count) : 0,+ }));+ const bestHourObj = postsByHour.reduce((best, h) => h.avgEngagement > best.avgEngagement ? h : best, postsByHour[0]);+ const bestPostingHour = bestHourObj?.posts > 0 ? bestHourObj.label : '';++ // Monthly breakdown / engagement timeline+ const monthMap = {};+ media.forEach(m => {+ const d = new Date(m.timestamp);+ if (isNaN(d)) return;+ const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;+ if (!monthMap[key]) monthMap[key] = { posts: 0, likes: 0, comments: 0 };+ monthMap[key].posts++;+ monthMap[key].likes += m.likeCount;+ monthMap[key].comments += m.commentsCount;+ });+ const monthlyBreakdown = Object.entries(monthMap)+ .sort(([a], [b]) => a.localeCompare(b))+ .map(([month, s]) => ({+ month,+ posts: s.posts,+ likes: s.likes, comments: s.comments,+ avgLikes: Math.round(s.likes / s.posts),+ avgComments: Math.round(s.comments / s.posts),+ engagement: s.likes + s.comments,+ }));+ const engagementTimeline = monthlyBreakdown; // alias++ // Recent activity+ const now = Date.now();+ const postsLast7Days = dates.filter(d => (now - d.getTime()) <= 7 * 86400000).length;+ const postsLast30Days = dates.filter(d => (now - d.getTime()) <= 30 * 86400000).length;+ const postsLast90Days = dates.filter(d => (now - d.getTime()) <= 90 * 86400000).length;++ // Hashtag analysis+ const hashtagMap = {};+ media.forEach(m => {+ const tags = (m.caption || '').match(/#[\w\u00C0-\u024F]+/g) || [];+ tags.forEach(tag => {+ const t = tag.toLowerCase();+ if (!hashtagMap[t]) hashtagMap[t] = { tag: t, count: 0, likes: 0, comments: 0 };+ hashtagMap[t].count++;+ hashtagMap[t].likes += m.likeCount;+ hashtagMap[t].comments += m.commentsCount;+ });+ });+ const hashtagAnalysis = Object.values(hashtagMap)+ .map(h => ({ ...h, avgEngagement: Math.round((h.likes + h.comments) / h.count) }))+ .sort((a, b) => b.count - a.count)+ .slice(0, 20);++ // Caption length correlation+ const captionBuckets = [+ { label: 'No caption', min: 0, max: 0 },+ { label: 'Short (1-50)', min: 1, max: 50 },+ { label: 'Medium (51-150)', min: 51, max: 150 },+ { label: 'Long (151-300)', min: 151, max: 300 },+ { label: 'Very Long (300+)', min: 301, max: Infinity },+ ];+ const captionLengthCorrelation = captionBuckets.map(bucket => {+ const posts = media.filter(m => {+ const len = (m.caption || '').length;+ return len >= bucket.min && len <= bucket.max;+ });+ return {+ label: bucket.label, count: posts.length,+ avgLikes: posts.length > 0 ? Math.round(posts.reduce((s, m) => s + m.likeCount, 0) / posts.length) : 0,+ avgComments: posts.length > 0 ? Math.round(posts.reduce((s, m) => s + m.commentsCount, 0) / posts.length) : 0,+ avgEngagement: posts.length > 0 ? Math.round(posts.reduce((s, m) => s + m.likeCount + m.commentsCount, 0) / posts.length) : 0,+ };+ }).filter(b => b.count > 0);++ // Top + worst posts+ const topPosts = [...media]+ .map(m => ({ ...m, engagement: m.likeCount + m.commentsCount }))+ .sort((a, b) => b.engagement - a.engagement)+ .slice(0, 10);+ const worstByLikes = byLikes.length > 0 ? byLikes[byLikes.length - 1] : null;++ // Virality score (best / avg)+ const bestEngagement = topPosts[0] ? topPosts[0].engagement : 0;+ const viralityScore = avgEngagement > 0 ? parseFloat((bestEngagement / avgEngagement).toFixed(1)) : 0;++ // Consistency score (0-100) based on std deviation of engagement+ let consistencyScore = 0;+ if (media.length >= 3) {+ const engagements = media.map(m => m.likeCount + m.commentsCount);+ const mean = engagements.reduce((s, v) => s + v, 0) / engagements.length;+ const variance = engagements.reduce((s, v) => s + Math.pow(v - mean, 2), 0) / engagements.length;+ const stdDev = Math.sqrt(variance);+ const cv = mean > 0 ? stdDev / mean : 1; // coefficient of variation+ consistencyScore = Math.max(0, Math.min(100, Math.round((1 - Math.min(cv, 1)) * 100)));+ }++ return {+ totalPosts: profile.mediaCount || media.length,+ fetchedPosts: media.length,+ totalLikes, totalComments, totalEngagement,+ avgLikes, avgComments, avgEngagement,+ medianLikes, medianComments,+ engagementRate, likesPerFollower, commentsPerFollower,+ likesToCommentsRatio,+ bestByLikes: byLikes[0] || null,+ bestByComments: byComments[0] || null,+ worstByLikes,+ recentMedia: media.slice(0, 20),+ mediaTypeDistribution: mediaTypes,+ performanceByType,+ postFrequency: { perWeek, perMonth },+ topPosts,+ postsByDayOfWeek, bestPostingDay,+ postsByHour, bestPostingHour,+ engagementTimeline, monthlyBreakdown,+ postsLast7Days, postsLast30Days, postsLast90Days,+ hashtagAnalysis,+ captionLengthCorrelation,+ viralityScore, consistencyScore,+ };+}++// ─── YouTube API Helpers ─────────────────────────────────────────────────────++async function ytFetch(endpoint, params, apiKey) {+ const url = new URL(`https://www.googleapis.com/youtube/v3/${endpoint}`);+ params.key = apiKey;+ Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));+ const res = await fetch(url.toString());+ const data = await res.json();+ if (data.error) throw new Error(data.error.message);+ return data;+}++function extractChannelId(input) {+ if (!input) return null;+ input = input.trim();+ // Direct channel ID+ if (/^UC[\w-]{22}$/.test(input)) return input;+ // URL patterns+ const patterns = [+ /youtube\.com\/channel\/(UC[\w-]{22})/,+ /youtube\.com\/@([\w.-]+)/,+ /youtube\.com\/c\/([\w.-]+)/,+ /youtube\.com\/user\/([\w.-]+)/,+ /youtube\.com\/([\w.-]+)/,+ ];+ for (const p of patterns) {+ const m = input.match(p);+ if (m) return m[1];+ }+ return input;+}++async function resolveChannelId(input, apiKey) {+ const extracted = extractChannelId(input);+ if (!extracted) throw new Error('Invalid input');++ // If it's already a channel ID+ if (/^UC[\w-]{22}$/.test(extracted)) return extracted;++ // Try as custom URL / username / handle+ // Search for channel by handle+ try {+ const data = await ytFetch('channels', { part: 'id', forHandle: extracted }, apiKey);+ if (data.items && data.items.length > 0) return data.items[0].id;+ } catch { }++ try {+ const data = await ytFetch('channels', { part: 'id', forUsername: extracted }, apiKey);+ if (data.items && data.items.length > 0) return data.items[0].id;+ } catch { }++ // Search as last resort+ try {+ const data = await ytFetch('search', { part: 'snippet', q: extracted, type: 'channel', maxResults: '1' }, apiKey);+ if (data.items && data.items.length > 0) return data.items[0].snippet.channelId;+ } catch { }++ throw new Error('Could not resolve channel. Please provide a valid Channel ID (starts with UC).');+}++async function fetchChannelData(channelId, apiKey) {+ const data = await ytFetch('channels', {+ part: 'snippet,statistics,contentDetails,brandingSettings,status,topicDetails',+ id: channelId,+ }, apiKey);++ if (!data.items || data.items.length === 0) throw new Error('Channel not found');+ const ch = data.items[0];++ return {+ channelId: ch.id,+ title: ch.snippet.title,+ description: ch.snippet.description,+ customUrl: ch.snippet.customUrl || '',+ publishedAt: ch.snippet.publishedAt,+ country: ch.snippet.country || 'Unknown',+ thumbnails: {+ default: ch.snippet.thumbnails?.default?.url || '',+ medium: ch.snippet.thumbnails?.medium?.url || '',+ high: ch.snippet.thumbnails?.high?.url || '',+ },+ subscriberCount: parseInt(ch.statistics.subscriberCount) || 0,+ viewCount: parseInt(ch.statistics.viewCount) || 0,+ videoCount: parseInt(ch.statistics.videoCount) || 0,+ hiddenSubscriberCount: ch.statistics.hiddenSubscriberCount || false,+ uploadsPlaylistId: ch.contentDetails?.relatedPlaylists?.uploads || '',+ keywords: ch.brandingSettings?.channel?.keywords || '',+ bannerUrl: ch.brandingSettings?.image?.bannerExternalUrl || '',+ madeForKids: ch.status?.madeForKids || false,+ topicCategories: ch.topicDetails?.topicCategories || [],+ isLinked: ch.status?.isLinked || false,+ };+}++async function fetchAllVideos(playlistId, apiKey, maxPages = 10) {+ let allVideos = [];+ let pageToken = '';+ let page = 0;++ while (page < maxPages) {+ const params = {+ part: 'snippet,contentDetails',+ playlistId,+ maxResults: '50',+ };+ if (pageToken) params.pageToken = pageToken;++ const data = await ytFetch('playlistItems', params, apiKey);+ if (!data.items || data.items.length === 0) break;++ const videoIds = data.items.map(i => i.snippet.resourceId.videoId).join(',');++ // Fetch detailed video stats+ const statsData = await ytFetch('videos', {+ part: 'statistics,contentDetails,snippet,status',+ id: videoIds,+ }, apiKey);++ if (statsData.items) {+ allVideos = allVideos.concat(statsData.items.map(v => ({+ videoId: v.id,+ title: v.snippet.title,+ description: v.snippet.description?.substring(0, 200) || '',+ publishedAt: v.snippet.publishedAt,+ channelTitle: v.snippet.channelTitle,+ thumbnails: {+ default: v.snippet.thumbnails?.default?.url || '',+ medium: v.snippet.thumbnails?.medium?.url || '',+ high: v.snippet.thumbnails?.high?.url || '',+ },+ tags: v.snippet.tags || [],+ categoryId: v.snippet.categoryId || '',+ liveBroadcastContent: v.snippet.liveBroadcastContent || 'none',+ defaultAudioLanguage: v.snippet.defaultAudioLanguage || '',+ duration: v.contentDetails.duration,+ dimension: v.contentDetails.dimension || '2d',+ definition: v.contentDetails.definition || 'hd',+ caption: v.contentDetails.caption === 'true',+ licensedContent: v.contentDetails.licensedContent || false,+ projection: v.contentDetails.projection || 'rectangular',+ viewCount: parseInt(v.statistics.viewCount) || 0,+ likeCount: parseInt(v.statistics.likeCount) || 0,+ commentCount: parseInt(v.statistics.commentCount) || 0,+ privacyStatus: v.status?.privacyStatus || 'public',+ embeddable: v.status?.embeddable || false,+ madeForKids: v.status?.madeForKids || false,+ })));+ }++ pageToken = data.nextPageToken || '';+ if (!pageToken) break;+ page++;+ }++ return allVideos;+}++function parseDuration(iso) {+ const m = iso.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);+ if (!m) return 0;+ return (parseInt(m[1] || 0) * 3600) + (parseInt(m[2] || 0) * 60) + parseInt(m[3] || 0);+}++function computeVideoAnalytics(videos) {+ if (!videos || videos.length === 0) {+ return {+ totalVideos: 0, totalViews: 0, totalLikes: 0, totalComments: 0,+ avgViews: 0, avgLikes: 0, avgComments: 0, medianViews: 0,+ totalEngagement: 0, overallEngagementRate: 0,+ avgDurationSeconds: 0, avgDurationFormatted: '0:00',+ totalDurationSeconds: 0, totalDurationFormatted: '0:00',+ bestByViews: null, bestByLikes: null, bestByComments: null,+ bestByEngagement: null, worstByViews: null,+ mostRecent: null, oldest: null,+ top10ByViews: [], top10ByLikes: [], top10ByComments: [], top10ByEngagement: [],+ shortsCount: 0, regularCount: 0,+ avgShortViews: 0, avgRegularViews: 0,+ hdCount: 0, sdCount: 0, hdPercentage: 0,+ captionCount: 0, captionPercentage: 0,+ licensedCount: 0, licensedPercentage: 0,+ madeForKidsCount: 0, embeddableCount: 0,+ publishDayDistribution: {}, publishHourDistribution: {},+ peakPublishDay: '', peakPublishHour: 0,+ durationDistribution: { short: 0, medium: 0, long: 0, veryLong: 0 },+ categoryDistribution: {},+ tagFrequency: [],+ videosLast7Days: 0, videosLast30Days: 0, videosLast90Days: 0, videosLast365Days: 0,+ uploadFrequencyPerWeek: 0, uploadFrequencyPerMonth: 0,+ consistencyScore: 0,+ viralityScore: 0,+ viewsDistribution: { ranges: [], counts: [] },+ engagementTrend: [],+ viewsTrend: [],+ likeRateTrend: [],+ };+ }++ const now = new Date();+ const durations = videos.map(v => parseDuration(v.duration));+ const totalDuration = durations.reduce((a, b) => a + b, 0);+ // Engagement rates — compute FIRST so all sorted arrays have the fields+ const withEngagement = videos.map(v => ({+ ...v,+ engagementRate: v.viewCount > 0 ? ((v.likeCount + v.commentCount) / v.viewCount) * 100 : 0,+ likeRate: v.viewCount > 0 ? (v.likeCount / v.viewCount) * 100 : 0,+ commentRate: v.viewCount > 0 ? (v.commentCount / v.viewCount) * 100 : 0,+ durationSeconds: parseDuration(v.duration),+ daysSinceUpload: Math.max(1, Math.floor((now - new Date(v.publishedAt)) / 86400000)),+ }));+ const viewsSorted = [...withEngagement].sort((a, b) => b.viewCount - a.viewCount);+ const likesSorted = [...withEngagement].sort((a, b) => b.likeCount - a.likeCount);+ const commentsSorted = [...withEngagement].sort((a, b) => b.commentCount - a.commentCount);+ const dateSorted = [...withEngagement].sort((a, b) => new Date(b.publishedAt) - new Date(a.publishedAt));+ const engagementSorted = [...withEngagement].sort((a, b) => b.engagementRate - a.engagementRate);++ const totalViews = videos.reduce((s, v) => s + v.viewCount, 0);+ const totalLikes = videos.reduce((s, v) => s + v.likeCount, 0);+ const totalComments = videos.reduce((s, v) => s + v.commentCount, 0);+ const avgViews = Math.round(totalViews / videos.length);+ const avgLikes = Math.round(totalLikes / videos.length);+ const avgComments = Math.round(totalComments / videos.length);++ // Median+ const sortedViews = [...videos].map(v => v.viewCount).sort((a, b) => a - b);+ const mid = Math.floor(sortedViews.length / 2);+ const medianViews = sortedViews.length % 2 ? sortedViews[mid] : Math.round((sortedViews[mid - 1] + sortedViews[mid]) / 2);++ // Shorts vs Regular+ const shorts = withEngagement.filter(v => v.durationSeconds <= 60);+ const regular = withEngagement.filter(v => v.durationSeconds > 60);++ // Duration distribution+ const durationDist = { short: 0, medium: 0, long: 0, veryLong: 0 };+ withEngagement.forEach(v => {+ if (v.durationSeconds <= 60) durationDist.short++;+ else if (v.durationSeconds <= 600) durationDist.medium++;+ else if (v.durationSeconds <= 3600) durationDist.long++;+ else durationDist.veryLong++;+ });++ // HD/SD, captions, licensed, etc.+ const hdCount = videos.filter(v => v.definition === 'hd').length;+ const captionCount = videos.filter(v => v.caption).length;+ const licensedCount = videos.filter(v => v.licensedContent).length;+ const madeForKidsCount = videos.filter(v => v.madeForKids).length;+ const embeddableCount = videos.filter(v => v.embeddable).length;++ // Publish day/hour distribution+ const dayDist = {};+ const hourDist = {};+ const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];+ videos.forEach(v => {+ const d = new Date(v.publishedAt);+ const day = dayNames[d.getUTCDay()];+ const hour = d.getUTCHours();+ dayDist[day] = (dayDist[day] || 0) + 1;+ hourDist[hour] = (hourDist[hour] || 0) + 1;+ });++ const peakDay = Object.entries(dayDist).sort((a, b) => b[1] - a[1])[0];+ const peakHour = Object.entries(hourDist).sort((a, b) => b[1] - a[1])[0];++ // Category distribution+ const catDist = {};+ videos.forEach(v => {+ const cat = v.categoryId || 'Unknown';+ catDist[cat] = (catDist[cat] || 0) + 1;+ });++ // Tag frequency+ const tagMap = {};+ videos.forEach(v => {+ (v.tags || []).forEach(t => {+ const lower = t.toLowerCase();+ tagMap[lower] = (tagMap[lower] || 0) + 1;+ });+ });+ const tagFrequency = Object.entries(tagMap)+ .sort((a, b) => b[1] - a[1])+ .slice(0, 30)+ .map(([tag, count]) => ({ tag, count }));++ // Recent videos count+ const msDay = 86400000;+ const videosLast7 = videos.filter(v => (now - new Date(v.publishedAt)) < 7 * msDay).length;+ const videosLast30 = videos.filter(v => (now - new Date(v.publishedAt)) < 30 * msDay).length;+ const videosLast90 = videos.filter(v => (now - new Date(v.publishedAt)) < 90 * msDay).length;+ const videosLast365 = videos.filter(v => (now - new Date(v.publishedAt)) < 365 * msDay).length;++ // Upload frequency+ const oldestDate = new Date(dateSorted[dateSorted.length - 1]?.publishedAt || now);+ const totalWeeks = Math.max(1, (now - oldestDate) / (7 * msDay));+ const totalMonths = Math.max(1, totalWeeks / 4.33);++ // Consistency score (0-100) based on how regular uploads are+ const weeklyUploads = videos.reduce((acc, v) => {+ const weekNum = Math.floor((now - new Date(v.publishedAt)) / (7 * msDay));+ acc[weekNum] = (acc[weekNum] || 0) + 1;+ return acc;+ }, {});+ const weekValues = Object.values(weeklyUploads);+ const avgWeekly = weekValues.reduce((a, b) => a + b, 0) / Math.max(1, weekValues.length);+ const variance = weekValues.reduce((s, v) => s + Math.pow(v - avgWeekly, 2), 0) / Math.max(1, weekValues.length);+ const stdDev = Math.sqrt(variance);+ const consistencyScore = Math.max(0, Math.min(100, Math.round(100 - (stdDev / Math.max(0.01, avgWeekly)) * 25)));++ // Virality score+ const viralityScore = avgViews > 0 ? Math.round((viewsSorted[0]?.viewCount || 0) / avgViews * 10) / 10 : 0;++ // Views distribution for histogram+ const maxViews = viewsSorted[0]?.viewCount || 0;+ const step = Math.max(1, Math.ceil(maxViews / 10));+ const viewsRanges = [];+ const viewsCounts = [];+ for (let i = 0; i < 10; i++) {+ const low = i * step;+ const high = (i + 1) * step;+ viewsRanges.push(`${formatCompact(low)}-${formatCompact(high)}`);+ viewsCounts.push(videos.filter(v => v.viewCount >= low && v.viewCount < high).length);+ }++ // Trends (monthly aggregation for last 12 months)+ const monthlyData = {};+ withEngagement.forEach(v => {+ const d = new Date(v.publishedAt);+ const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;+ if (!monthlyData[key]) monthlyData[key] = { views: 0, likes: 0, comments: 0, count: 0 };+ monthlyData[key].views += v.viewCount;+ monthlyData[key].likes += v.likeCount;+ monthlyData[key].comments += v.commentCount;+ monthlyData[key].count++;+ });+ const sortedMonths = Object.keys(monthlyData).sort();+ const viewsTrend = sortedMonths.map(m => ({ month: m, value: monthlyData[m].views, count: monthlyData[m].count }));+ const engagementTrend = sortedMonths.map(m => ({+ month: m,+ value: monthlyData[m].views > 0+ ? ((monthlyData[m].likes + monthlyData[m].comments) / monthlyData[m].views * 100).toFixed(2)+ : 0,+ }));+ const likeRateTrend = sortedMonths.map(m => ({+ month: m,+ value: monthlyData[m].views > 0 ? ((monthlyData[m].likes / monthlyData[m].views) * 100).toFixed(2) : 0,+ }));++ const formatVid = (v) => v ? {+ videoId: v.videoId, title: v.title, viewCount: v.viewCount,+ likeCount: v.likeCount, commentCount: v.commentCount,+ publishedAt: v.publishedAt,+ thumbnail: v.thumbnails?.medium || v.thumbnails?.default || '',+ engagementRate: v.engagementRate?.toFixed(2) || 0,+ durationSeconds: v.durationSeconds || parseDuration(v.duration),+ } : null;++ const formatDuration = (s) => {+ const h = Math.floor(s / 3600);+ const m = Math.floor((s % 3600) / 60);+ const sec = s % 60;+ return h > 0 ? `${h}h ${m}m` : `${m}m ${sec}s`;+ };++ return {+ totalVideos: videos.length,+ totalViews, totalLikes, totalComments,+ avgViews, avgLikes, avgComments, medianViews,+ totalEngagement: totalLikes + totalComments,+ overallEngagementRate: totalViews > 0 ? ((totalLikes + totalComments) / totalViews * 100).toFixed(2) : 0,+ avgDurationSeconds: Math.round(totalDuration / videos.length),+ avgDurationFormatted: formatDuration(Math.round(totalDuration / videos.length)),+ totalDurationSeconds: totalDuration,+ totalDurationFormatted: formatDuration(totalDuration),+ estimatedTotalWatchTimeHours: Math.round((totalDuration * totalViews) / 3600),+ bestByViews: formatVid(viewsSorted[0]),+ bestByLikes: formatVid(likesSorted[0]),+ bestByComments: formatVid(commentsSorted[0]),+ bestByEngagement: formatVid(engagementSorted[0]),+ worstByViews: formatVid(viewsSorted[viewsSorted.length - 1]),+ mostRecent: formatVid(dateSorted[0]),+ oldest: formatVid(dateSorted[dateSorted.length - 1]),+ top10ByViews: viewsSorted.slice(0, 10).map(formatVid),+ top10ByLikes: likesSorted.slice(0, 10).map(formatVid),+ top10ByComments: commentsSorted.slice(0, 10).map(formatVid),+ top10ByEngagement: engagementSorted.slice(0, 10).map(formatVid),+ shortsCount: shorts.length,+ regularCount: regular.length,+ avgShortViews: shorts.length > 0 ? Math.round(shorts.reduce((s, v) => s + v.viewCount, 0) / shorts.length) : 0,+ avgRegularViews: regular.length > 0 ? Math.round(regular.reduce((s, v) => s + v.viewCount, 0) / regular.length) : 0,+ avgShortLikes: shorts.length > 0 ? Math.round(shorts.reduce((s, v) => s + v.likeCount, 0) / shorts.length) : 0,+ avgRegularLikes: regular.length > 0 ? Math.round(regular.reduce((s, v) => s + v.likeCount, 0) / regular.length) : 0,+ hdCount, sdCount: videos.length - hdCount,+ hdPercentage: ((hdCount / videos.length) * 100).toFixed(1),+ captionCount, captionPercentage: ((captionCount / videos.length) * 100).toFixed(1),+ licensedCount, licensedPercentage: ((licensedCount / videos.length) * 100).toFixed(1),+ madeForKidsCount, embeddableCount,+ embeddablePercentage: ((embeddableCount / videos.length) * 100).toFixed(1),+ publishDayDistribution: dayDist,+ publishHourDistribution: hourDist,+ peakPublishDay: peakDay ? peakDay[0] : '',+ peakPublishHour: peakHour ? parseInt(peakHour[0]) : 0,+ durationDistribution: durationDist,+ categoryDistribution: catDist,+ tagFrequency,+ videosLast7Days: videosLast7,+ videosLast30Days: videosLast30,+ videosLast90Days: videosLast90,+ videosLast365Days: videosLast365,+ uploadFrequencyPerWeek: (videos.length / totalWeeks).toFixed(1),+ uploadFrequencyPerMonth: (videos.length / totalMonths).toFixed(1),+ consistencyScore,+ viralityScore,+ viewsDistribution: { ranges: viewsRanges, counts: viewsCounts },+ viewsTrend,+ engagementTrend,+ likeRateTrend,+ };+}++function formatCompact(n) {+ if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M';+ if (n >= 1e3) return (n / 1e3).toFixed(1) + 'K';+ return n.toString();+}++// ─── API ROUTES ──────────────────────────────────────────────────────────────++// API Keys+app.get('/api/keys', async (req, res) => {+ const keys = await readJSON(API_KEYS_FILE);+ res.json({+ youtube: keys?.youtube || '',+ configured: !!keys?.youtube,+ instagram: {+ appId: keys?.instagram?.appId || '',+ appSecret: keys?.instagram?.appSecret || '',+ configured: !!(keys?.instagram?.appId && keys?.instagram?.appSecret),+ },+ cloudinary: {+ cloudName: keys?.cloudinary?.cloudName || '',+ uploadPreset: keys?.cloudinary?.uploadPreset || '',+ configured: !!(keys?.cloudinary?.cloudName && keys?.cloudinary?.uploadPreset),+ },+ github: {+ token: keys?.github?.token || '',+ repo: keys?.github?.repo || '',+ branch: keys?.github?.branch || 'main',+ configured: !!(keys?.github?.token && keys?.github?.repo),+ },+ });+});++app.post('/api/keys', async (req, res) => {+ const { youtube, instagram, cloudinary } = req.body;+ const keys = await readJSON(API_KEYS_FILE) || {};+ if (youtube !== undefined) keys.youtube = youtube;+ if (instagram !== undefined) {+ if (!keys.instagram) keys.instagram = {};+ if (instagram.appId !== undefined) keys.instagram.appId = instagram.appId;+ if (instagram.appSecret !== undefined) keys.instagram.appSecret = instagram.appSecret;+ }+ if (cloudinary !== undefined) {+ if (!keys.cloudinary) keys.cloudinary = {};+ if (cloudinary.cloudName !== undefined) keys.cloudinary.cloudName = cloudinary.cloudName;+ if (cloudinary.uploadPreset !== undefined) keys.cloudinary.uploadPreset = cloudinary.uploadPreset;+ }+ const { github } = req.body;+ if (github !== undefined) {+ if (!keys.github) keys.github = { branch: 'main' };+ if (github.token !== undefined) keys.github.token = github.token;+ if (github.repo !== undefined) keys.github.repo = github.repo;+ if (github.branch !== undefined) keys.github.branch = github.branch || 'main';+ }+ const ok = await writeJSON(API_KEYS_FILE, keys);+ res.json({ success: ok, message: ok ? 'API keys saved' : 'Failed to save' });+});++// Accounts+app.get('/api/accounts', async (req, res) => {+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ // Mask access tokens in response+ const safe = accounts.map(a => {+ const copy = { ...a };+ if (copy.accessToken) delete copy.accessToken;+ return copy;+ });+ res.json(safe);+});++// Resolve channel from URL or ID+app.post('/api/resolve-channel', async (req, res) => {+ try {+ const { input } = req.body;+ const apiKey = await getAPIKey();+ if (!apiKey) return res.status(400).json({ success: false, message: 'YouTube API key not configured' });++ const channelId = await resolveChannelId(input, apiKey);+ const channelData = await fetchChannelData(channelId, apiKey);+ res.json({ success: true, data: channelData });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Add account+app.post('/api/accounts', async (req, res) => {+ try {+ const { input } = req.body;+ const apiKey = await getAPIKey();+ if (!apiKey) return res.status(400).json({ success: false, message: 'YouTube API key not configured' });++ const channelId = await resolveChannelId(input, apiKey);+ const channelData = await fetchChannelData(channelId, apiKey);+ const accounts = await readJSON(ACCOUNTS_FILE);++ // Prevent duplicates+ if (accounts.find(a => a.channelId === channelId)) {+ return res.status(400).json({ success: false, message: 'This channel is already added' });+ }++ const newAccount = {+ id: Date.now().toString(),+ channelId: channelData.channelId,+ title: channelData.title,+ description: channelData.description,+ customUrl: channelData.customUrl,+ publishedAt: channelData.publishedAt,+ country: channelData.country,+ thumbnails: channelData.thumbnails,+ subscriberCount: channelData.subscriberCount,+ viewCount: channelData.viewCount,+ videoCount: channelData.videoCount,+ hiddenSubscriberCount: channelData.hiddenSubscriberCount,+ uploadsPlaylistId: channelData.uploadsPlaylistId,+ keywords: channelData.keywords,+ topicCategories: channelData.topicCategories,+ madeForKids: channelData.madeForKids,+ addedAt: new Date().toISOString(),+ lastUpdated: new Date().toISOString(),+ };++ accounts.push(newAccount);+ await writeJSON(ACCOUNTS_FILE, accounts);++ res.json({ success: true, account: newAccount });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Add Instagram account via access token+// Uses Instagram API with Instagram Login — token from App Dashboard or Business Login flow+app.post('/api/accounts/instagram', async (req, res) => {+ try {+ const { accessToken } = req.body;+ if (!accessToken) return res.status(400).json({ success: false, message: 'Access token is required' });++ const { appSecret } = await getIGAppCredentials();++ // Step 1: Try to exchange for long-lived token (if app secret is configured)+ // Tokens from App Dashboard are already long-lived (60 days)+ // Tokens from Business Login flow are short-lived (1 hour) and need exchange+ let finalToken = accessToken;+ let expiresIn = 0;+ if (appSecret) {+ try {+ const longToken = await exchangeForLongLivedToken(accessToken, appSecret);+ finalToken = longToken.accessToken;+ expiresIn = longToken.expiresIn;+ console.log('Token exchanged for long-lived token successfully');+ } catch (err) {+ // Token might already be long-lived (from App Dashboard) — use as-is+ console.log('Token exchange skipped (token may already be long-lived):', err.message);+ }+ } else {+ console.log('No Instagram App Secret configured — using token as-is (configure App Secret in Settings for long-lived tokens)');+ }++ // Step 2: Fetch profile using /me — no Facebook Pages discovery needed+ const profile = await fetchInstagramProfile(null, finalToken);++ if (!profile.igUserId) {+ throw new Error('Could not get Instagram User ID. Make sure the token has instagram_business_basic permission and is from a Business/Creator account.');+ }++ const accounts = await readJSON(ACCOUNTS_FILE);++ // Prevent duplicates+ if (accounts.find(a => a.platform === 'instagram' && a.igUserId === profile.igUserId)) {+ return res.status(400).json({ success: false, message: 'This Instagram account is already added' });+ }++ const newAccount = {+ id: Date.now().toString(),+ platform: 'instagram',+ igUserId: profile.igUserId,+ username: profile.username,+ title: profile.name || profile.username,+ biography: profile.biography,+ website: profile.website,+ profilePictureUrl: profile.profilePictureUrl,+ followersCount: profile.followersCount,+ followsCount: profile.followsCount,+ mediaCount: profile.mediaCount,+ accessToken: finalToken,+ tokenExpiresAt: expiresIn > 0+ ? new Date(Date.now() + expiresIn * 1000).toISOString()+ : null,+ addedAt: new Date().toISOString(),+ lastUpdated: new Date().toISOString(),+ };++ accounts.push(newAccount);+ await writeJSON(ACCOUNTS_FILE, accounts);++ // Mask token in response+ const safeAccount = { ...newAccount };+ delete safeAccount.accessToken;+ res.json({ success: true, account: safeAccount });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Refresh Instagram token (extend long-lived token for another 60 days)+// Uses: GET graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token+app.post('/api/accounts/:id/refresh-ig-token', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id && a.platform === 'instagram');+ if (!account) return res.status(404).json({ success: false, message: 'Instagram account not found' });+ if (!account.accessToken) return res.status(400).json({ success: false, message: 'No access token stored' });++ // Refresh long-lived token — must be at least 24 hours old and not expired+ const refreshed = await refreshLongLivedToken(account.accessToken);++ account.accessToken = refreshed.accessToken;+ account.tokenExpiresAt = new Date(Date.now() + (refreshed.expiresIn || 5184000) * 1000).toISOString();+ await writeJSON(ACCOUNTS_FILE, accounts);+ res.json({ success: true, message: 'Token refreshed for another 60 days', expiresAt: account.tokenExpiresAt });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Delete account+app.delete('/api/accounts/:id', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id);+ if (!account) return res.status(404).json({ success: false, message: 'Not found' });+ const filtered = accounts.filter(a => a.id !== req.params.id);+ await writeJSON(ACCOUNTS_FILE, filtered);++ // Clean caches+ const cache = await readJSON(VIDEOS_CACHE_FILE);+ delete cache[req.params.id];+ await writeJSON(VIDEOS_CACHE_FILE, cache);++ const igCache = await readJSON(IG_CACHE_FILE) || {};+ delete igCache[req.params.id];+ await writeJSON(IG_CACHE_FILE, igCache);++ res.json({ success: true });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Update single account+app.post('/api/accounts/:id/refresh', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id);+ if (!account) return res.status(404).json({ success: false, message: 'Not found' });++ if (account.platform === 'instagram') {+ // Refresh Instagram account+ if (!account.accessToken) return res.status(400).json({ success: false, message: 'No access token' });+ const profile = await fetchInstagramProfile(account.igUserId, account.accessToken);+ account.followersCount = profile.followersCount;+ account.followsCount = profile.followsCount;+ account.mediaCount = profile.mediaCount;+ account.title = profile.name || profile.username;+ account.username = profile.username;+ account.profilePictureUrl = profile.profilePictureUrl;+ account.biography = profile.biography;+ account.website = profile.website;+ account.lastUpdated = new Date().toISOString();+ } else {+ // Refresh YouTube account+ const apiKey = await getAPIKey();+ if (!apiKey) return res.status(400).json({ success: false, message: 'No API key' });+ const channelData = await fetchChannelData(account.channelId, apiKey);+ account.subscriberCount = channelData.subscriberCount;+ account.viewCount = channelData.viewCount;+ account.videoCount = channelData.videoCount;+ account.title = channelData.title;+ account.description = channelData.description;+ account.thumbnails = channelData.thumbnails;+ account.customUrl = channelData.customUrl;+ account.country = channelData.country;+ account.keywords = channelData.keywords;+ account.topicCategories = channelData.topicCategories;+ }+ account.lastUpdated = new Date().toISOString();+ await writeJSON(ACCOUNTS_FILE, accounts);++ // Mask IG token in response+ const safeAccount = { ...account };+ if (safeAccount.accessToken) delete safeAccount.accessToken;+ res.json({ success: true, account: safeAccount });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Refresh all+app.post('/api/accounts/refresh-all', async (req, res) => {+ try {+ const apiKey = await getAPIKey();+ const accounts = await readJSON(ACCOUNTS_FILE);+ const results = [];++ for (const account of accounts) {+ try {+ if (account.platform === 'instagram') {+ if (!account.accessToken) throw new Error('No access token');+ const profile = await fetchInstagramProfile(account.igUserId, account.accessToken);+ account.followersCount = profile.followersCount;+ account.followsCount = profile.followsCount;+ account.mediaCount = profile.mediaCount;+ account.title = profile.name || profile.username;+ account.username = profile.username;+ account.profilePictureUrl = profile.profilePictureUrl;+ } else {+ if (!apiKey) throw new Error('No YouTube API key');+ const channelData = await fetchChannelData(account.channelId, apiKey);+ account.subscriberCount = channelData.subscriberCount;+ account.viewCount = channelData.viewCount;+ account.videoCount = channelData.videoCount;+ account.title = channelData.title;+ account.thumbnails = channelData.thumbnails;+ }+ account.lastUpdated = new Date().toISOString();+ results.push({ id: account.id, success: true });+ } catch (err) {+ results.push({ id: account.id, success: false, error: err.message });+ }+ }++ await writeJSON(ACCOUNTS_FILE, accounts);+ // Mask IG tokens in response+ const safeAccounts = accounts.map(a => {+ const safe = { ...a };+ if (safe.accessToken) delete safe.accessToken;+ return safe;+ });+ res.json({ success: true, accounts: safeAccounts, results, updatedAt: new Date().toISOString() });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Get full analytics for an account+app.get('/api/accounts/:id/analytics', async (req, res) => {+ try {+ const apiKey = await getAPIKey();+ if (!apiKey) return res.status(400).json({ success: false, message: 'No API key' });++ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id);+ if (!account) return res.status(404).json({ success: false, message: 'Not found' });++ // Fetch all videos (up to 500)+ const videos = await fetchAllVideos(account.uploadsPlaylistId, apiKey, 10);++ // Cache videos+ const cache = await readJSON(VIDEOS_CACHE_FILE) || {};+ cache[req.params.id] = { videos, fetchedAt: new Date().toISOString() };+ await writeJSON(VIDEOS_CACHE_FILE, cache);++ // Compute analytics+ const analytics = computeVideoAnalytics(videos);++ // If publishedAt is missing, fetch it+ if (!account.publishedAt) {+ try {+ const channelData = await fetchChannelData(account.channelId, apiKey);+ account.publishedAt = channelData.publishedAt;+ account.subscriberCount = channelData.subscriberCount;+ account.viewCount = channelData.viewCount;+ account.videoCount = channelData.videoCount;+ account.title = channelData.title;+ account.thumbnails = channelData.thumbnails;+ account.customUrl = channelData.customUrl;+ account.country = channelData.country;+ account.lastUpdated = new Date().toISOString();+ await writeJSON(ACCOUNTS_FILE, accounts);+ } catch (e) {+ console.error('Failed to backfill channel data:', e.message);+ }+ }++ // Channel-level computed metrics+ const channelAge = account.publishedAt+ ? Math.floor((Date.now() - new Date(account.publishedAt).getTime()) / 86400000)+ : 365;+ const viewsPerSub = account.subscriberCount > 0 ? (account.viewCount / account.subscriberCount).toFixed(1) : 0;+ const subsPerView = account.viewCount > 0 ? (account.subscriberCount / account.viewCount * 100).toFixed(4) : 0;+ const avgViewsPerVideo = account.videoCount > 0 ? Math.round(account.viewCount / account.videoCount) : 0;+ const avgSubGainPerDay = channelAge > 0 ? Math.round(account.subscriberCount / channelAge) : 0;+ const avgViewsPerDay = channelAge > 0 ? Math.round(account.viewCount / channelAge) : 0;++ res.json({+ success: true,+ channel: {+ ...account,+ channelAge,+ channelAgeYears: (channelAge / 365).toFixed(1),+ viewsPerSubscriber: parseFloat(viewsPerSub),+ subscriberToViewRatio: parseFloat(subsPerView),+ avgViewsPerVideo,+ avgSubGainPerDay,+ avgViewsPerDay,+ estimatedMonthlyViews: avgViewsPerDay * 30,+ estimatedMonthlySubGain: avgSubGainPerDay * 30,+ estimatedYearlyViews: avgViewsPerDay * 365,+ estimatedYearlySubGain: avgSubGainPerDay * 365,+ },+ analytics,+ videoCount: videos.length,+ });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Get cached videos+app.get('/api/accounts/:id/videos', async (req, res) => {+ try {+ const cache = await readJSON(VIDEOS_CACHE_FILE) || {};+ const accountCache = cache[req.params.id];++ if (accountCache && accountCache.videos) {+ return res.json({ success: true, videos: accountCache.videos, fetchedAt: accountCache.fetchedAt });+ }++ // Fetch fresh if no cache+ const apiKey = await getAPIKey();+ if (!apiKey) return res.status(400).json({ success: false, message: 'No API key' });++ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id);+ if (!account) return res.status(404).json({ success: false, message: 'Not found' });++ const videos = await fetchAllVideos(account.uploadsPlaylistId, apiKey, 10);+ cache[req.params.id] = { videos, fetchedAt: new Date().toISOString() };+ await writeJSON(VIDEOS_CACHE_FILE, cache);++ res.json({ success: true, videos, fetchedAt: cache[req.params.id].fetchedAt });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Cross-account comparison+app.get('/api/comparison', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE);+ if (accounts.length === 0) return res.json({ success: true, comparison: null });++ const sorted = {+ bySubscribers: [...accounts].sort((a, b) => b.subscriberCount - a.subscriberCount),+ byViews: [...accounts].sort((a, b) => b.viewCount - a.viewCount),+ byVideos: [...accounts].sort((a, b) => b.videoCount - a.videoCount),+ };++ const totals = accounts.reduce((acc, a) => ({+ subscribers: acc.subscribers + a.subscriberCount,+ views: acc.views + a.viewCount,+ videos: acc.videos + a.videoCount,+ }), { subscribers: 0, views: 0, videos: 0 });++ res.json({+ success: true,+ comparison: {+ rankings: sorted,+ totals,+ accountCount: accounts.length,+ bestBySubscribers: sorted.bySubscribers[0] || null,+ bestByViews: sorted.byViews[0] || null,+ bestByVideos: sorted.byVideos[0] || null,+ },+ });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Instagram analytics+app.get('/api/accounts/:id/ig-analytics', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id && a.platform === 'instagram');+ if (!account) return res.status(404).json({ success: false, message: 'Instagram account not found' });+ if (!account.accessToken) return res.status(400).json({ success: false, message: 'No access token stored' });++ // Fetch fresh profile+ const profile = await fetchInstagramProfile(account.igUserId, account.accessToken);++ // Fetch media (up to 500 for thorough analytics)+ const media = await fetchInstagramMedia(account.igUserId, account.accessToken, 500);++ // Cache media+ const igCache = await readJSON(IG_CACHE_FILE) || {};+ igCache[req.params.id] = { media, fetchedAt: new Date().toISOString() };+ await writeJSON(IG_CACHE_FILE, igCache);++ // Compute analytics+ const analytics = computeInstagramAnalytics(profile, media);++ // Update account with latest stats+ account.followersCount = profile.followersCount;+ account.followsCount = profile.followsCount;+ account.mediaCount = profile.mediaCount;+ account.profilePictureUrl = profile.profilePictureUrl;+ account.lastUpdated = new Date().toISOString();+ await writeJSON(ACCOUNTS_FILE, accounts);++ const safeAccount = { ...account };+ delete safeAccount.accessToken;++ res.json({+ success: true,+ profile: { ...profile },+ account: safeAccount,+ analytics,+ mediaCount: media.length,+ });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Instagram media list+app.get('/api/accounts/:id/ig-media', async (req, res) => {+ try {+ // Check cache first+ const igCache = await readJSON(IG_CACHE_FILE) || {};+ const cached = igCache[req.params.id];+ if (cached && cached.media) {+ return res.json({ success: true, media: cached.media, fetchedAt: cached.fetchedAt });+ }++ const accounts = await readJSON(ACCOUNTS_FILE);+ const account = accounts.find(a => a.id === req.params.id && a.platform === 'instagram');+ if (!account) return res.status(404).json({ success: false, message: 'Not found' });+ if (!account.accessToken) return res.status(400).json({ success: false, message: 'No access token' });++ const media = await fetchInstagramMedia(account.igUserId, account.accessToken, 500);+ igCache[req.params.id] = { media, fetchedAt: new Date().toISOString() };+ await writeJSON(IG_CACHE_FILE, igCache);++ res.json({ success: true, media, fetchedAt: igCache[req.params.id].fetchedAt });+ } catch (err) {+ res.status(400).json({ success: false, message: err.message });+ }+});++// Health check+app.get('/api/health', (req, res) => {+ res.json({ status: 'ok', timestamp: new Date().toISOString() });+});++// Get ALL videos across all channels (or filter by channel)+app.get('/api/videos/all', async (req, res) => {+ try {+ const { channelId, sort, order, search, minViews, maxViews } = req.query;+ const cache = await readJSON(VIDEOS_CACHE_FILE) || {};+ const accounts = await readJSON(ACCOUNTS_FILE) || [];++ let allVideos = [];+ for (const acct of accounts) {+ if (channelId && acct.id !== channelId) continue;+ const cached = cache[acct.id];+ if (cached && cached.videos) {+ allVideos.push(...cached.videos.map(v => ({+ ...v,+ channelTitle: acct.title || acct.name || acct.channelTitle,+ channelId: acct.id,+ channelThumbnail: acct.thumbnails?.default || acct.thumbnailUrl || '',+ })));+ }+ }++ // Search filter+ if (search) {+ const q = search.toLowerCase();+ allVideos = allVideos.filter(v =>+ v.title?.toLowerCase().includes(q) ||+ (v.tags || []).some(t => t.toLowerCase().includes(q))+ );+ }++ // Views range filter+ if (minViews) allVideos = allVideos.filter(v => (v.viewCount || 0) >= parseInt(minViews));+ if (maxViews) allVideos = allVideos.filter(v => (v.viewCount || 0) <= parseInt(maxViews));++ // Sort+ const sortField = sort || 'viewCount';+ const sortOrder = order === 'asc' ? 1 : -1;+ allVideos.sort((a, b) => {+ const aVal = a[sortField] ?? 0;+ const bVal = b[sortField] ?? 0;+ if (typeof aVal === 'string') return sortOrder * aVal.localeCompare(bVal);+ return sortOrder * (bVal - aVal);+ });++ res.json({+ success: true,+ videos: allVideos,+ total: allVideos.length,+ channels: accounts.map(a => ({ id: a.id, title: a.title || a.name })),+ });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// ─── Start ───────────────────────────────────────────────────────────────────++// ─── Instagram Content Publishing ────────────────────────────────────────────++// Get Cloudinary config (for frontend)+app.get('/api/cloudinary-config', async (req, res) => {+ const keys = await readJSON(API_KEYS_FILE);+ const cloud = keys?.cloudinary || {};+ if (!cloud.cloudName || !cloud.uploadPreset) {+ return res.json({ success: false, message: 'Cloudinary not configured' });+ }+ res.json({ success: true, cloudName: cloud.cloudName, uploadPreset: cloud.uploadPreset });+});++// Check publishing rate limit+app.get('/api/accounts/:id/ig-publishing-limit', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ const acct = accounts.find(a => a.id === req.params.id);+ if (!acct || acct.platform !== 'instagram') {+ return res.status(404).json({ success: false, message: 'Instagram account not found' });+ }+ const r = await fetch(+ `https://graph.instagram.com/v25.0/${acct.igUserId}/content_publishing_limit?fields=quota_usage,config&access_token=${acct.accessToken}`+ );+ const data = await r.json();+ if (data.error) throw new Error(data.error.message);+ res.json({ success: true, ...data });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Step 1: Create a media container on Instagram+app.post('/api/accounts/:id/ig-publish', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ const acct = accounts.find(a => a.id === req.params.id);+ if (!acct || acct.platform !== 'instagram') {+ return res.status(404).json({ success: false, message: 'Instagram account not found' });+ }++ const {+ mediaType, // 'IMAGE', 'REELS', 'STORIES', 'CAROUSEL'+ mediaUrl, // public URL of image or video (from Cloudinary)+ caption,+ coverUrl, // cover image URL for reels+ shareToFeed, // boolean for reels/stories+ collaborators,// array of usernames+ audioName, // custom audio name for reels+ thumbOffset, // thumbnail offset ms for reels+ locationId, // location page ID+ userTags, // array of {username, x, y}+ altText, // image alt text+ children, // array of container IDs for carousel+ } = req.body;++ const igId = acct.igUserId;+ const token = acct.accessToken;+ const params = { access_token: token };++ if (mediaType === 'CAROUSEL') {+ // Carousel container+ params.media_type = 'CAROUSEL';+ if (caption) params.caption = caption;+ if (children && children.length) params.children = children.join(',');+ if (collaborators && collaborators.length) params.collaborators = JSON.stringify(collaborators);+ if (locationId) params.location_id = locationId;+ } else if (mediaType === 'CAROUSEL_ITEM_IMAGE') {+ // Individual carousel item (image)+ params.image_url = mediaUrl;+ params.is_carousel_item = true;+ } else if (mediaType === 'CAROUSEL_ITEM_VIDEO') {+ // Individual carousel item (video)+ params.media_type = 'VIDEO';+ params.video_url = mediaUrl;+ params.is_carousel_item = true;+ } else if (mediaType === 'REELS') {+ params.media_type = 'REELS';+ params.video_url = mediaUrl;+ if (caption) params.caption = caption;+ if (shareToFeed !== undefined) params.share_to_feed = shareToFeed;+ if (coverUrl) params.cover_url = coverUrl;+ if (collaborators && collaborators.length) params.collaborators = JSON.stringify(collaborators);+ if (audioName) params.audio_name = audioName;+ if (thumbOffset != null) params.thumb_offset = thumbOffset;+ if (locationId) params.location_id = locationId;+ if (userTags && userTags.length) params.user_tags = JSON.stringify(userTags);+ } else if (mediaType === 'STORIES') {+ params.media_type = 'STORIES';+ // Determine if image or video stories+ if (mediaUrl && (mediaUrl.match(/\.(mp4|mov|avi|webm)/i))) {+ params.video_url = mediaUrl;+ } else {+ params.image_url = mediaUrl;+ }+ if (userTags && userTags.length) params.user_tags = JSON.stringify(userTags);+ } else {+ // Default: Image post+ params.image_url = mediaUrl;+ if (caption) params.caption = caption;+ if (locationId) params.location_id = locationId;+ if (userTags && userTags.length) params.user_tags = JSON.stringify(userTags);+ if (altText) params.alt_text = altText;+ }++ // Create container+ const qs = new URLSearchParams(params).toString();+ const r = await fetch(`https://graph.instagram.com/v25.0/${igId}/media?${qs}`, { method: 'POST' });+ const data = await r.json();++ if (data.error) throw new Error(data.error.message);++ res.json({ success: true, containerId: data.id });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Step 2: Check container status+app.get('/api/ig-container/:containerId/status', async (req, res) => {+ try {+ const { containerId } = req.params;+ const { accountId } = req.query;+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ const acct = accounts.find(a => a.id === accountId);+ if (!acct) return res.status(404).json({ success: false, message: 'Account not found' });++ const r = await fetch(+ `https://graph.instagram.com/v25.0/${containerId}?fields=status_code,status&access_token=${acct.accessToken}`+ );+ const data = await r.json();+ if (data.error) throw new Error(data.error.message);++ res.json({ success: true, statusCode: data.status_code, status: data.status });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Step 3: Publish the container+app.post('/api/accounts/:id/ig-media-publish', async (req, res) => {+ try {+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ const acct = accounts.find(a => a.id === req.params.id);+ if (!acct || acct.platform !== 'instagram') {+ return res.status(404).json({ success: false, message: 'Instagram account not found' });+ }++ const { containerId } = req.body;+ const r = await fetch(+ `https://graph.instagram.com/v25.0/${acct.igUserId}/media_publish?creation_id=${containerId}&access_token=${acct.accessToken}`,+ { method: 'POST' }+ );+ const data = await r.json();+ if (data.error) throw new Error(data.error.message);++ res.json({ success: true, mediaId: data.id });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// ─── Scheduled Posts ─────────────────────────────────────────────────────────++// Generate a simple unique ID+function generateId() {+ return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);+}++// Get all scheduled posts+app.get('/api/scheduled-posts', async (req, res) => {+ try {+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ res.json({ success: true, posts });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Create a scheduled post (saves Cloudinary URL + metadata for local scheduler to process)+app.post('/api/scheduled-posts', async (req, res) => {+ try {+ const {+ accountId, platform, mediaType, mediaUrl,+ caption, coverUrl, shareToFeed, collaborators,+ audioName, thumbOffset, locationId, userTags,+ altText, scheduledAt,+ } = req.body;++ if (!accountId || !mediaUrl || !scheduledAt) {+ return res.status(400).json({ success: false, message: 'accountId, mediaUrl, and scheduledAt are required' });+ }++ const scheduledDate = new Date(scheduledAt);+ if (isNaN(scheduledDate.getTime()) || scheduledDate <= new Date()) {+ return res.status(400).json({ success: false, message: 'scheduledAt must be a valid future date' });+ }++ const post = {+ id: generateId(),+ accountId,+ platform: platform || 'instagram',+ mediaType: mediaType || 'IMAGE',+ mediaUrl,+ caption: caption || '',+ coverUrl: coverUrl || null,+ shareToFeed: shareToFeed !== undefined ? shareToFeed : true,+ collaborators: collaborators || [],+ audioName: audioName || '',+ thumbOffset: thumbOffset || null,+ locationId: locationId || '',+ userTags: userTags || [],+ altText: altText || '',+ scheduledAt: scheduledDate.toISOString(),+ status: 'pending', // pending | publishing | published | failed+ createdAt: new Date().toISOString(),+ publishedMediaId: null,+ error: null,+ };++ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ posts.push(post);+ await writeJSON(SCHEDULED_POSTS_FILE, posts);++ // Sync to GitHub (async, don't block response)+ syncScheduledPostsToGitHub().catch(() => { });++ res.json({ success: true, post });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Update a scheduled post+app.put('/api/scheduled-posts/:id', async (req, res) => {+ try {+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const idx = posts.findIndex(p => p.id === req.params.id);+ if (idx === -1) return res.status(404).json({ success: false, message: 'Scheduled post not found' });+ if (posts[idx].status !== 'pending' && posts[idx].status !== 'scheduled') {+ return res.status(400).json({ success: false, message: 'Can only edit pending posts' });+ }++ const allowed = ['caption', 'scheduledAt', 'shareToFeed', 'collaborators', 'audioName',+ 'thumbOffset', 'locationId', 'userTags', 'altText', 'coverUrl'];+ for (const key of allowed) {+ if (req.body[key] !== undefined) posts[idx][key] = req.body[key];+ }+ if (req.body.scheduledAt) posts[idx].scheduledAt = new Date(req.body.scheduledAt).toISOString();++ await writeJSON(SCHEDULED_POSTS_FILE, posts);+ syncScheduledPostsToGitHub().catch(() => { });+ res.json({ success: true, post: posts[idx] });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// Delete a scheduled post+app.delete('/api/scheduled-posts/:id', async (req, res) => {+ try {+ let posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const post = posts.find(p => p.id === req.params.id);+ if (!post) return res.status(404).json({ success: false, message: 'Scheduled post not found' });+ if (post.status === 'publishing') {+ return res.status(400).json({ success: false, message: 'Cannot delete a post that is currently publishing' });+ }+ posts = posts.filter(p => p.id !== req.params.id);+ await writeJSON(SCHEDULED_POSTS_FILE, posts);+ syncScheduledPostsToGitHub().catch(() => { });+ res.json({ success: true, message: 'Scheduled post deleted' });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++// ─── Scheduled Post Processor ────────────────────────────────────────────────+// Runs locally via setInterval. Checks every 60 seconds for due posts.+// On server startup, immediately processes any overdue posts.++let isProcessing = false;++async function processScheduledPosts() {+ if (isProcessing) return { processed: 0, message: 'Already processing' };+ isProcessing = true;+ let processed = 0;+ let errors = [];++ try {+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const accounts = await readJSON(ACCOUNTS_FILE) || [];+ const now = new Date();++ for (const post of posts) {+ if (post.status !== 'pending') continue;+ const scheduledDate = new Date(post.scheduledAt);+ if (scheduledDate > now) continue;++ // This post is due — publish it+ post.status = 'publishing';+ await writeJSON(SCHEDULED_POSTS_FILE, posts);++ try {+ const acct = accounts.find(a => a.id === post.accountId);+ if (!acct) throw new Error('Account not found: ' + post.accountId);++ // Step 1: Create container+ const igId = acct.igUserId;+ const token = acct.accessToken;+ const params = { access_token: token };++ if (post.mediaType === 'REELS') {+ params.media_type = 'REELS';+ params.video_url = post.mediaUrl;+ if (post.caption) params.caption = post.caption;+ if (post.shareToFeed !== undefined) params.share_to_feed = post.shareToFeed;+ if (post.coverUrl) params.cover_url = post.coverUrl;+ if (post.collaborators?.length) params.collaborators = JSON.stringify(post.collaborators);+ if (post.audioName) params.audio_name = post.audioName;+ if (post.thumbOffset != null) params.thumb_offset = post.thumbOffset;+ if (post.locationId) params.location_id = post.locationId;+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ } else if (post.mediaType === 'STORIES') {+ params.media_type = 'STORIES';+ if (post.mediaUrl.match(/\.(mp4|mov|avi|webm)/i)) {+ params.video_url = post.mediaUrl;+ } else {+ params.image_url = post.mediaUrl;+ }+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ } else {+ // IMAGE+ params.image_url = post.mediaUrl;+ if (post.caption) params.caption = post.caption;+ if (post.locationId) params.location_id = post.locationId;+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ if (post.altText) params.alt_text = post.altText;+ }++ const qs = new URLSearchParams(params).toString();+ const createRes = await fetch(`https://graph.instagram.com/v25.0/${igId}/media?${qs}`, { method: 'POST' });+ const createData = await createRes.json();+ if (createData.error) throw new Error(createData.error.message);++ const containerId = createData.id;++ // Step 2: Wait for processing (poll up to 60 attempts, 3s apart = 3 min max)+ if (post.mediaType === 'REELS' || post.mediaType === 'STORIES') {+ for (let i = 0; i < 60; i++) {+ await new Promise(r => setTimeout(r, 3000));+ const statusRes = await fetch(+ `https://graph.instagram.com/v25.0/${containerId}?fields=status_code,status&access_token=${token}`+ );+ const statusData = await statusRes.json();+ if (statusData.status_code === 'FINISHED' || statusData.status_code === 'PUBLISHED') break;+ if (statusData.status_code === 'ERROR') throw new Error('Processing failed: ' + (statusData.status || ''));+ if (statusData.status_code === 'EXPIRED') throw new Error('Container expired');+ }+ } else {+ await new Promise(r => setTimeout(r, 2000));+ }++ // Step 3: Publish+ const pubRes = await fetch(+ `https://graph.instagram.com/v25.0/${igId}/media_publish?creation_id=${containerId}&access_token=${token}`,+ { method: 'POST' }+ );+ const pubData = await pubRes.json();+ if (pubData.error) throw new Error(pubData.error.message);++ post.status = 'published';+ post.publishedMediaId = pubData.id;+ post.publishedAt = new Date().toISOString();+ processed++;+ console.log(` ✓ Published scheduled post ${post.id} → media ${pubData.id}`);++ } catch (err) {+ post.status = 'failed';+ post.error = err.message;+ errors.push({ id: post.id, error: err.message });+ console.error(` ✗ Failed to publish scheduled post ${post.id}: ${err.message}`);+ }++ await writeJSON(SCHEDULED_POSTS_FILE, posts);+ }+ } catch (err) {+ console.error('Scheduler error:', err);+ } finally {+ isProcessing = false;+ }++ return { processed, errors };+}++// Manual trigger endpoint+app.get('/api/process-scheduled', async (req, res) => {+ const result = await processScheduledPosts();+ res.json({ success: true, ...result, timestamp: new Date().toISOString() });+});+app.post('/api/process-scheduled', async (req, res) => {+ const result = await processScheduledPosts();+ res.json({ success: true, ...result, timestamp: new Date().toISOString() });+});++// GitHub sync test endpoint+app.post('/api/github-sync', async (req, res) => {+ try {+ await syncScheduledPostsToGitHub();+ res.json({ success: true, message: 'Synced to GitHub' });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++app.post('/api/github-pull', async (req, res) => {+ try {+ await pullScheduledPostsFromGitHub();+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ res.json({ success: true, posts, message: 'Pulled from GitHub' });+ } catch (err) {+ res.status(500).json({ success: false, message: err.message });+ }+});++initializeData().then(async () => {+ // Pull latest from GitHub on startup (picks up posts published by GH Actions while server was off)+ await pullScheduledPostsFromGitHub();++ // Process any overdue posts on startup+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const overdue = posts.filter(p => p.status === 'pending' && new Date(p.scheduledAt) <= new Date());+ if (overdue.length > 0) {+ console.log(` ⏰ ${overdue.length} overdue scheduled post(s) found, publishing now...`);+ await processScheduledPosts();+ }++ // Check every 60 seconds for due posts+ setInterval(async () => {+ const posts = await readJSON(SCHEDULED_POSTS_FILE) || [];+ const due = posts.filter(p => p.status === 'pending' && new Date(p.scheduledAt) <= new Date());+ if (due.length > 0) {+ console.log(`\n ⏰ ${due.length} scheduled post(s) due, processing...`);+ await processScheduledPosts();+ }+ }, 60000);++ app.listen(PORT, () => {+ console.log(`\n Social Media Analytics API Server`);+ console.log(` Running on http://localhost:${PORT}`);+ console.log(` YouTube + Instagram analytics ready`);+ console.log(` 📅 Scheduler active (checks every 60s)\n`);+ });+});diff --git a/frontend/.gitignore b/frontend/.gitignorenew file mode 100644index 0000000..a547bf3--- /dev/null+++ b/frontend/.gitignore@@ -0,0 +1,24 @@+# Logs+logs+*.log+npm-debug.log*+yarn-debug.log*+yarn-error.log*+pnpm-debug.log*+lerna-debug.log*++node_modules+dist+dist-ssr+*.local++# Editor directories and files+.vscode/*+!.vscode/extensions.json+.idea+.DS_Store+*.suo+*.ntvs*+*.njsproj+*.sln+*.sw?diff --git a/frontend/README.md b/frontend/README.mdnew file mode 100644index 0000000..18bc70e--- /dev/null+++ b/frontend/README.md@@ -0,0 +1,16 @@+# React + Vite++This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.++Currently, two official plugins are available:++- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh+- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh++## React Compiler++The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).++## Expanding the ESLint configuration++If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.diff --git a/frontend/eslint.config.js b/frontend/eslint.config.jsnew file mode 100644index 0000000..4fa125d--- /dev/null+++ b/frontend/eslint.config.js@@ -0,0 +1,29 @@+import js from '@eslint/js'+import globals from 'globals'+import reactHooks from 'eslint-plugin-react-hooks'+import reactRefresh from 'eslint-plugin-react-refresh'+import { defineConfig, globalIgnores } from 'eslint/config'++export default defineConfig([+ globalIgnores(['dist']),+ {+ files: ['**/*.{js,jsx}'],+ extends: [+ js.configs.recommended,+ reactHooks.configs.flat.recommended,+ reactRefresh.configs.vite,+ ],+ languageOptions: {+ ecmaVersion: 2020,+ globals: globals.browser,+ parserOptions: {+ ecmaVersion: 'latest',+ ecmaFeatures: { jsx: true },+ sourceType: 'module',+ },+ },+ rules: {+ 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],+ },+ },+])diff --git a/frontend/index.html b/frontend/index.htmlnew file mode 100644index 0000000..46528ac--- /dev/null+++ b/frontend/index.html@@ -0,0 +1,16 @@+<!doctype html>+<html lang="en">++<head>+ <meta charset="UTF-8" />+ <link rel="icon" type="image/svg+xml" href="/logo.svg" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>YT Analytics Dashboard Pro</title>+</head>++<body>+ <div id="root"></div>+ <script type="module" src="/src/main.jsx"></script>+</body>++</html>\ No newline at end of filediff --git a/frontend/package-lock.json b/frontend/package-lock.jsonnew file mode 100644index 0000000..29fb2c1--- /dev/null+++ b/frontend/package-lock.json@@ -0,0 +1,4233 @@+{+ "name": "frontend",+ "version": "0.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "frontend",+ "version": "0.0.0",+ "dependencies": {+ "@emotion/react": "^11.14.0",+ "@emotion/styled": "^11.14.1",+ "@mui/icons-material": "^7.3.8",+ "@mui/material": "^7.3.8",+ "@mui/x-charts": "^8.5.0",+ "@mui/x-data-grid": "^8.5.0",+ "react": "^19.2.0",+ "react-dom": "^19.2.0",+ "react-router-dom": "^7.13.1",+ "recharts": "^3.7.0"+ },+ "devDependencies": {+ "@eslint/js": "^9.39.1",+ "@types/react": "^19.2.7",+ "@types/react-dom": "^19.2.3",+ "@vitejs/plugin-react": "^5.1.1",+ "eslint": "^9.39.1",+ "eslint-plugin-react-hooks": "^7.0.1",+ "eslint-plugin-react-refresh": "^0.4.24",+ "globals": "^16.5.0",+ "vite": "^7.3.1"+ }+ },+ "node_modules/@babel/code-frame": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz",+ "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-validator-identifier": "^7.28.5",+ "js-tokens": "^4.0.0",+ "picocolors": "^1.1.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/compat-data": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz",+ "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/core": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",+ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@babel/code-frame": "^7.29.0",+ "@babel/generator": "^7.29.0",+ "@babel/helper-compilation-targets": "^7.28.6",+ "@babel/helper-module-transforms": "^7.28.6",+ "@babel/helpers": "^7.28.6",+ "@babel/parser": "^7.29.0",+ "@babel/template": "^7.28.6",+ "@babel/traverse": "^7.29.0",+ "@babel/types": "^7.29.0",+ "@jridgewell/remapping": "^2.3.5",+ "convert-source-map": "^2.0.0",+ "debug": "^4.1.0",+ "gensync": "^1.0.0-beta.2",+ "json5": "^2.2.3",+ "semver": "^6.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/babel"+ }+ },+ "node_modules/@babel/generator": {+ "version": "7.29.1",+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz",+ "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==",+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.29.0",+ "@babel/types": "^7.29.0",+ "@jridgewell/gen-mapping": "^0.3.12",+ "@jridgewell/trace-mapping": "^0.3.28",+ "jsesc": "^3.0.2"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-compilation-targets": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",+ "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/compat-data": "^7.28.6",+ "@babel/helper-validator-option": "^7.27.1",+ "browserslist": "^4.24.0",+ "lru-cache": "^5.1.1",+ "semver": "^6.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-globals": {+ "version": "7.28.0",+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz",+ "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-module-imports": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz",+ "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==",+ "license": "MIT",+ "dependencies": {+ "@babel/traverse": "^7.28.6",+ "@babel/types": "^7.28.6"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-module-transforms": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz",+ "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/helper-module-imports": "^7.28.6",+ "@babel/helper-validator-identifier": "^7.28.5",+ "@babel/traverse": "^7.28.6"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0"+ }+ },+ "node_modules/@babel/helper-plugin-utils": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz",+ "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-string-parser": {+ "version": "7.27.1",+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-validator-identifier": {+ "version": "7.28.5",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",+ "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-validator-option": {+ "version": "7.27.1",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",+ "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helpers": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz",+ "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/template": "^7.28.6",+ "@babel/types": "^7.28.6"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/parser": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz",+ "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.29.0"+ },+ "bin": {+ "parser": "bin/babel-parser.js"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@babel/plugin-transform-react-jsx-self": {+ "version": "7.27.1",+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz",+ "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/helper-plugin-utils": "^7.27.1"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/plugin-transform-react-jsx-source": {+ "version": "7.27.1",+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz",+ "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/helper-plugin-utils": "^7.27.1"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/runtime": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz",+ "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/template": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",+ "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.28.6",+ "@babel/parser": "^7.28.6",+ "@babel/types": "^7.28.6"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/traverse": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz",+ "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.29.0",+ "@babel/generator": "^7.29.0",+ "@babel/helper-globals": "^7.28.0",+ "@babel/parser": "^7.29.0",+ "@babel/template": "^7.28.6",+ "@babel/types": "^7.29.0",+ "debug": "^4.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/types": {+ "version": "7.29.0",+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",+ "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-string-parser": "^7.27.1",+ "@babel/helper-validator-identifier": "^7.28.5"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@emotion/babel-plugin": {+ "version": "11.13.5",+ "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz",+ "integrity": "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-module-imports": "^7.16.7",+ "@babel/runtime": "^7.18.3",+ "@emotion/hash": "^0.9.2",+ "@emotion/memoize": "^0.9.0",+ "@emotion/serialize": "^1.3.3",+ "babel-plugin-macros": "^3.1.0",+ "convert-source-map": "^1.5.0",+ "escape-string-regexp": "^4.0.0",+ "find-root": "^1.1.0",+ "source-map": "^0.5.7",+ "stylis": "4.2.0"+ }+ },+ "node_modules/@emotion/babel-plugin/node_modules/convert-source-map": {+ "version": "1.9.0",+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",+ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==",+ "license": "MIT"+ },+ "node_modules/@emotion/cache": {+ "version": "11.14.0",+ "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz",+ "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==",+ "license": "MIT",+ "dependencies": {+ "@emotion/memoize": "^0.9.0",+ "@emotion/sheet": "^1.4.0",+ "@emotion/utils": "^1.4.2",+ "@emotion/weak-memoize": "^0.4.0",+ "stylis": "4.2.0"+ }+ },+ "node_modules/@emotion/hash": {+ "version": "0.9.2",+ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz",+ "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==",+ "license": "MIT"+ },+ "node_modules/@emotion/is-prop-valid": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.4.0.tgz",+ "integrity": "sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw==",+ "license": "MIT",+ "dependencies": {+ "@emotion/memoize": "^0.9.0"+ }+ },+ "node_modules/@emotion/memoize": {+ "version": "0.9.0",+ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz",+ "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==",+ "license": "MIT"+ },+ "node_modules/@emotion/react": {+ "version": "11.14.0",+ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz",+ "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@babel/runtime": "^7.18.3",+ "@emotion/babel-plugin": "^11.13.5",+ "@emotion/cache": "^11.14.0",+ "@emotion/serialize": "^1.3.3",+ "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",+ "@emotion/utils": "^1.4.2",+ "@emotion/weak-memoize": "^0.4.0",+ "hoist-non-react-statics": "^3.3.1"+ },+ "peerDependencies": {+ "react": ">=16.8.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@emotion/serialize": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.3.3.tgz",+ "integrity": "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==",+ "license": "MIT",+ "dependencies": {+ "@emotion/hash": "^0.9.2",+ "@emotion/memoize": "^0.9.0",+ "@emotion/unitless": "^0.10.0",+ "@emotion/utils": "^1.4.2",+ "csstype": "^3.0.2"+ }+ },+ "node_modules/@emotion/sheet": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.4.0.tgz",+ "integrity": "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==",+ "license": "MIT"+ },+ "node_modules/@emotion/styled": {+ "version": "11.14.1",+ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.1.tgz",+ "integrity": "sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@babel/runtime": "^7.18.3",+ "@emotion/babel-plugin": "^11.13.5",+ "@emotion/is-prop-valid": "^1.3.0",+ "@emotion/serialize": "^1.3.3",+ "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",+ "@emotion/utils": "^1.4.2"+ },+ "peerDependencies": {+ "@emotion/react": "^11.0.0-rc.0",+ "react": ">=16.8.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@emotion/unitless": {+ "version": "0.10.0",+ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.10.0.tgz",+ "integrity": "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==",+ "license": "MIT"+ },+ "node_modules/@emotion/use-insertion-effect-with-fallbacks": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.2.0.tgz",+ "integrity": "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==",+ "license": "MIT",+ "peerDependencies": {+ "react": ">=16.8.0"+ }+ },+ "node_modules/@emotion/utils": {+ "version": "1.4.2",+ "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.4.2.tgz",+ "integrity": "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==",+ "license": "MIT"+ },+ "node_modules/@emotion/weak-memoize": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz",+ "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==",+ "license": "MIT"+ },+ "node_modules/@esbuild/aix-ppc64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz",+ "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz",+ "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz",+ "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz",+ "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz",+ "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz",+ "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz",+ "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz",+ "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz",+ "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz",+ "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ia32": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz",+ "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-loong64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz",+ "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-mips64el": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz",+ "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==",+ "cpu": [+ "mips64el"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ppc64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz",+ "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-riscv64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz",+ "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-s390x": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz",+ "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz",+ "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz",+ "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz",+ "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz",+ "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz",+ "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openharmony-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz",+ "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/sunos-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz",+ "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-arm64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz",+ "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-ia32": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz",+ "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-x64": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz",+ "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@eslint-community/eslint-utils": {+ "version": "4.9.1",+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",+ "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "eslint-visitor-keys": "^3.4.3"+ },+ "engines": {+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ },+ "peerDependencies": {+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"+ }+ },+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {+ "version": "3.4.3",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/@eslint-community/regexpp": {+ "version": "4.12.2",+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",+ "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"+ }+ },+ "node_modules/@eslint/config-array": {+ "version": "0.21.1",+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz",+ "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/object-schema": "^2.1.7",+ "debug": "^4.3.1",+ "minimatch": "^3.1.2"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/config-helpers": {+ "version": "0.4.2",+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/core": "^0.17.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/core": {+ "version": "0.17.0",+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@types/json-schema": "^7.0.15"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/eslintrc": {+ "version": "3.3.4",+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.4.tgz",+ "integrity": "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ajv": "^6.14.0",+ "debug": "^4.3.2",+ "espree": "^10.0.1",+ "globals": "^14.0.0",+ "ignore": "^5.2.0",+ "import-fresh": "^3.2.1",+ "js-yaml": "^4.1.1",+ "minimatch": "^3.1.3",+ "strip-json-comments": "^3.1.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/@eslint/eslintrc/node_modules/globals": {+ "version": "14.0.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/@eslint/js": {+ "version": "9.39.3",+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.3.tgz",+ "integrity": "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://eslint.org/donate"+ }+ },+ "node_modules/@eslint/object-schema": {+ "version": "2.1.7",+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/plugin-kit": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/core": "^0.17.0",+ "levn": "^0.4.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@humanfs/core": {+ "version": "0.19.1",+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",+ "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=18.18.0"+ }+ },+ "node_modules/@humanfs/node": {+ "version": "0.16.7",+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz",+ "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@humanfs/core": "^0.19.1",+ "@humanwhocodes/retry": "^0.4.0"+ },+ "engines": {+ "node": ">=18.18.0"+ }+ },+ "node_modules/@humanwhocodes/module-importer": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.22"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/nzakas"+ }+ },+ "node_modules/@humanwhocodes/retry": {+ "version": "0.4.3",+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=18.18"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/nzakas"+ }+ },+ "node_modules/@jridgewell/gen-mapping": {+ "version": "0.3.13",+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.0",+ "@jridgewell/trace-mapping": "^0.3.24"+ }+ },+ "node_modules/@jridgewell/remapping": {+ "version": "2.3.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/gen-mapping": "^0.3.5",+ "@jridgewell/trace-mapping": "^0.3.24"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.31",+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.1.0",+ "@jridgewell/sourcemap-codec": "^1.4.14"+ }+ },+ "node_modules/@mui/core-downloads-tracker": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-7.3.8.tgz",+ "integrity": "sha512-s9UHZo7QJVly7gNArEZkbbsimHqJZhElgBpXIJdehZ4OWXt+CCr0SBDgUCDJnQrqpd1dWK2dLq5rmO4mCBmI3w==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ }+ },+ "node_modules/@mui/icons-material": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-7.3.8.tgz",+ "integrity": "sha512-88sWg/UJc1X82OMO+ISR4E3P58I3BjFVg0qkmDu7OWlN8VijneZD3ylFA+ImxuPjMHW3SHosfSJYy1fztoz0fw==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@mui/material": "^7.3.8",+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/material": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/material/-/material-7.3.8.tgz",+ "integrity": "sha512-QKd1RhDXE1hf2sQDNayA9ic9jGkEgvZOf0tTkJxlBPG8ns8aS4rS8WwYURw2x5y3739p0HauUXX9WbH7UufFLw==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@babel/runtime": "^7.28.6",+ "@mui/core-downloads-tracker": "^7.3.8",+ "@mui/system": "^7.3.8",+ "@mui/types": "^7.4.11",+ "@mui/utils": "^7.3.8",+ "@popperjs/core": "^2.11.8",+ "@types/react-transition-group": "^4.4.12",+ "clsx": "^2.1.1",+ "csstype": "^3.2.3",+ "prop-types": "^15.8.1",+ "react-is": "^19.2.3",+ "react-transition-group": "^4.4.5"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@emotion/react": "^11.5.0",+ "@emotion/styled": "^11.3.0",+ "@mui/material-pigment-css": "^7.3.8",+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/react": {+ "optional": true+ },+ "@emotion/styled": {+ "optional": true+ },+ "@mui/material-pigment-css": {+ "optional": true+ },+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/private-theming": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-7.3.8.tgz",+ "integrity": "sha512-du5dlPZ9XL3xW2apHoGDXBI+QLtyVJGrXNCfcNYfP/ojkz1RQ0rRV6VG9Rkm1DqEFRG8mjjTL7zmE1Bvn1eR4A==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6",+ "@mui/utils": "^7.3.8",+ "prop-types": "^15.8.1"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/styled-engine": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-7.3.8.tgz",+ "integrity": "sha512-JHAeXQzS0tJ+Fq3C6J4TVDsW+yKhO4uuxuiLaopNStJeQYBIUCXpKYyUCcgXym4AmhbznQnv9RlHywSH6b0FOg==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6",+ "@emotion/cache": "^11.14.0",+ "@emotion/serialize": "^1.3.3",+ "@emotion/sheet": "^1.4.0",+ "csstype": "^3.2.3",+ "prop-types": "^15.8.1"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@emotion/react": "^11.4.1",+ "@emotion/styled": "^11.3.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/react": {+ "optional": true+ },+ "@emotion/styled": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/system": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/system/-/system-7.3.8.tgz",+ "integrity": "sha512-hoFRj4Zw2Km8DPWZp/nKG+ao5Jw5LSk2m/e4EGc6M3RRwXKEkMSG4TgtfVJg7dS2homRwtdXSMW+iRO0ZJ4+IA==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@babel/runtime": "^7.28.6",+ "@mui/private-theming": "^7.3.8",+ "@mui/styled-engine": "^7.3.8",+ "@mui/types": "^7.4.11",+ "@mui/utils": "^7.3.8",+ "clsx": "^2.1.1",+ "csstype": "^3.2.3",+ "prop-types": "^15.8.1"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@emotion/react": "^11.5.0",+ "@emotion/styled": "^11.3.0",+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/react": {+ "optional": true+ },+ "@emotion/styled": {+ "optional": true+ },+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/types": {+ "version": "7.4.11",+ "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.4.11.tgz",+ "integrity": "sha512-fZ2xO9D08IKOxO2oUBi1nnVKH6oJUD+64cnv4YAaFoC0E5+i1+S5AHbNqqvZlYYsbPEQ6qEVwuBqY3jl5W4G+Q==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6"+ },+ "peerDependencies": {+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/utils": {+ "version": "7.3.8",+ "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-7.3.8.tgz",+ "integrity": "sha512-kZRcE2620CBGr+XI8YMmwPj6WIPwSF7uMJjvSfqd8zXVvlz0MCJbzRRUGNf8NgflCLthdji2DdS643TeyJ3+nA==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6",+ "@mui/types": "^7.4.11",+ "@types/prop-types": "^15.7.15",+ "clsx": "^2.1.1",+ "prop-types": "^15.8.1",+ "react-is": "^19.2.3"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/x-charts": {+ "version": "8.5.0",+ "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-8.5.0.tgz",+ "integrity": "sha512-w96tm+P0LmXDf79aS9NkFL26izOKo3x8T7AFAe6CLUHA9xXG/kw5MV+aYA+o6isTMuRjGWw6QIqajbY9gQJQQw==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.27.1",+ "@mui/utils": "^7.0.2",+ "@mui/x-charts-vendor": "8.4.0",+ "@mui/x-internals": "8.5.0",+ "bezier-easing": "^2.1.0",+ "clsx": "^2.1.1",+ "prop-types": "^15.8.1",+ "reselect": "^5.1.1",+ "use-sync-external-store": "^1.5.0"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "peerDependencies": {+ "@emotion/react": "^11.9.0",+ "@emotion/styled": "^11.8.1",+ "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0",+ "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/react": {+ "optional": true+ },+ "@emotion/styled": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/x-charts-vendor": {+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/@mui/x-charts-vendor/-/x-charts-vendor-8.4.0.tgz",+ "integrity": "sha512-0VvwJSeFezJTnjoKg5YUbbI82a60+VZfH2RyqaosmKH516lKYKSCuAFmkj4vUBP6+ZJPZDW5mWI3VhwD4DN6hg==",+ "license": "MIT AND ISC",+ "dependencies": {+ "@babel/runtime": "^7.27.1",+ "@types/d3-color": "^3.1.3",+ "@types/d3-delaunay": "^6.0.4",+ "@types/d3-interpolate": "^3.0.4",+ "@types/d3-scale": "^4.0.9",+ "@types/d3-shape": "^3.1.7",+ "@types/d3-time": "^3.0.4",+ "@types/d3-timer": "^3.0.2",+ "d3-color": "^3.1.0",+ "d3-delaunay": "^6.0.4",+ "d3-interpolate": "^3.0.1",+ "d3-scale": "^4.0.2",+ "d3-shape": "^3.2.0",+ "d3-time": "^3.1.0",+ "d3-timer": "^3.0.1",+ "delaunator": "^5.0.1",+ "robust-predicates": "^3.0.2"+ }+ },+ "node_modules/@mui/x-data-grid": {+ "version": "8.5.0",+ "resolved": "https://registry.npmjs.org/@mui/x-data-grid/-/x-data-grid-8.5.0.tgz",+ "integrity": "sha512-5rrMm9anFaLk9O5XRIw3J9tAAnaiE1GxFeocyqhDj23RUReMg0YSp3FYnCaFLAehRQVgT9pC4675XO571paxKw==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.27.1",+ "@mui/utils": "^7.0.2",+ "@mui/x-internals": "8.5.0",+ "clsx": "^2.1.1",+ "prop-types": "^15.8.1",+ "reselect": "^5.1.1",+ "use-sync-external-store": "^1.5.0"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@emotion/react": "^11.9.0",+ "@emotion/styled": "^11.8.1",+ "@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0",+ "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/react": {+ "optional": true+ },+ "@emotion/styled": {+ "optional": true+ }+ }+ },+ "node_modules/@mui/x-internals": {+ "version": "8.5.0",+ "resolved": "https://registry.npmjs.org/@mui/x-internals/-/x-internals-8.5.0.tgz",+ "integrity": "sha512-Ef4KJij1pBGk6/xILyVZHf76tcuRpJIX30k4Ghklsd5QJujZ9ENCGAjvd7aWRAFAs5p3ffn0H8UDESoIcroj1Q==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.27.1",+ "@mui/utils": "^7.0.2"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/mui-org"+ },+ "peerDependencies": {+ "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0",+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },+ "node_modules/@popperjs/core": {+ "version": "2.11.8",+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",+ "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/popperjs"+ }+ },+ "node_modules/@reduxjs/toolkit": {+ "version": "2.11.2",+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",+ "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==",+ "license": "MIT",+ "dependencies": {+ "@standard-schema/spec": "^1.0.0",+ "@standard-schema/utils": "^0.3.0",+ "immer": "^11.0.0",+ "redux": "^5.0.1",+ "redux-thunk": "^3.1.0",+ "reselect": "^5.1.0"+ },+ "peerDependencies": {+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"+ },+ "peerDependenciesMeta": {+ "react": {+ "optional": true+ },+ "react-redux": {+ "optional": true+ }+ }+ },+ "node_modules/@reduxjs/toolkit/node_modules/immer": {+ "version": "11.1.4",+ "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.4.tgz",+ "integrity": "sha512-XREFCPo6ksxVzP4E0ekD5aMdf8WMwmdNaz6vuvxgI40UaEiu6q3p8X52aU6GdyvLY3XXX/8R7JOTXStz/nBbRw==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/immer"+ }+ },+ "node_modules/@rolldown/pluginutils": {+ "version": "1.0.0-rc.3",+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz",+ "integrity": "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@rollup/rollup-android-arm-eabi": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz",+ "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-android-arm64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz",+ "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-darwin-arm64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz",+ "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-darwin-x64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz",+ "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-arm64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz",+ "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-x64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz",+ "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz",+ "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz",+ "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz",+ "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-musl": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz",+ "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz",+ "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-musl": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz",+ "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz",+ "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-musl": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz",+ "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz",+ "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-musl": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz",+ "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-s390x-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz",+ "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz",+ "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-musl": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz",+ "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-openbsd-x64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz",+ "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ]+ },+ "node_modules/@rollup/rollup-openharmony-arm64": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz",+ "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ]+ },+ "node_modules/@rollup/rollup-win32-arm64-msvc": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz",+ "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-ia32-msvc": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz",+ "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-gnu": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz",+ "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-msvc": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz",+ "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@standard-schema/spec": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",+ "license": "MIT"+ },+ "node_modules/@standard-schema/utils": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",+ "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",+ "license": "MIT"+ },+ "node_modules/@types/babel__core": {+ "version": "7.20.5",+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.20.7",+ "@babel/types": "^7.20.7",+ "@types/babel__generator": "*",+ "@types/babel__template": "*",+ "@types/babel__traverse": "*"+ }+ },+ "node_modules/@types/babel__generator": {+ "version": "7.27.0",+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.0.0"+ }+ },+ "node_modules/@types/babel__template": {+ "version": "7.4.4",+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.1.0",+ "@babel/types": "^7.0.0"+ }+ },+ "node_modules/@types/babel__traverse": {+ "version": "7.28.0",+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.28.2"+ }+ },+ "node_modules/@types/d3-array": {+ "version": "3.2.2",+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",+ "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",+ "license": "MIT"+ },+ "node_modules/@types/d3-color": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",+ "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",+ "license": "MIT"+ },+ "node_modules/@types/d3-delaunay": {+ "version": "6.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz",+ "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==",+ "license": "MIT"+ },+ "node_modules/@types/d3-ease": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",+ "license": "MIT"+ },+ "node_modules/@types/d3-interpolate": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",+ "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",+ "license": "MIT",+ "dependencies": {+ "@types/d3-color": "*"+ }+ },+ "node_modules/@types/d3-path": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",+ "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",+ "license": "MIT"+ },+ "node_modules/@types/d3-scale": {+ "version": "4.0.9",+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",+ "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",+ "license": "MIT",+ "dependencies": {+ "@types/d3-time": "*"+ }+ },+ "node_modules/@types/d3-shape": {+ "version": "3.1.8",+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz",+ "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==",+ "license": "MIT",+ "dependencies": {+ "@types/d3-path": "*"+ }+ },+ "node_modules/@types/d3-time": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",+ "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",+ "license": "MIT"+ },+ "node_modules/@types/d3-timer": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",+ "license": "MIT"+ },+ "node_modules/@types/estree": {+ "version": "1.0.8",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/json-schema": {+ "version": "7.0.15",+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/parse-json": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz",+ "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==",+ "license": "MIT"+ },+ "node_modules/@types/prop-types": {+ "version": "15.7.15",+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",+ "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",+ "license": "MIT"+ },+ "node_modules/@types/react": {+ "version": "19.2.14",+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",+ "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "csstype": "^3.2.2"+ }+ },+ "node_modules/@types/react-dom": {+ "version": "19.2.3",+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",+ "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "@types/react": "^19.2.0"+ }+ },+ "node_modules/@types/react-transition-group": {+ "version": "4.4.12",+ "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz",+ "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==",+ "license": "MIT",+ "peerDependencies": {+ "@types/react": "*"+ }+ },+ "node_modules/@types/use-sync-external-store": {+ "version": "0.0.6",+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",+ "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",+ "license": "MIT"+ },+ "node_modules/@vitejs/plugin-react": {+ "version": "5.1.4",+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.4.tgz",+ "integrity": "sha512-VIcFLdRi/VYRU8OL/puL7QXMYafHmqOnwTZY50U1JPlCNj30PxCMx65c494b1K9be9hX83KVt0+gTEwTWLqToA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/core": "^7.29.0",+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",+ "@rolldown/pluginutils": "1.0.0-rc.3",+ "@types/babel__core": "^7.20.5",+ "react-refresh": "^0.18.0"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "peerDependencies": {+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"+ }+ },+ "node_modules/acorn": {+ "version": "8.16.0",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",+ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "bin": {+ "acorn": "bin/acorn"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/acorn-jsx": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"+ }+ },+ "node_modules/ajv": {+ "version": "6.14.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",+ "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.1",+ "fast-json-stable-stringify": "^2.0.0",+ "json-schema-traverse": "^0.4.1",+ "uri-js": "^4.2.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "color-convert": "^2.0.1"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/argparse": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",+ "dev": true,+ "license": "Python-2.0"+ },+ "node_modules/babel-plugin-macros": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz",+ "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.12.5",+ "cosmiconfig": "^7.0.0",+ "resolve": "^1.19.0"+ },+ "engines": {+ "node": ">=10",+ "npm": ">=6"+ }+ },+ "node_modules/balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/baseline-browser-mapping": {+ "version": "2.10.0",+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz",+ "integrity": "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "baseline-browser-mapping": "dist/cli.cjs"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/bezier-easing": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/bezier-easing/-/bezier-easing-2.1.0.tgz",+ "integrity": "sha512-gbIqZ/eslnUFC1tjEvtz0sgx+xTK20wDnYMIA27VA04R7w6xxXQPZDbibjA9DTWZRA2CXtwHykkVzlCaAJAZig==",+ "license": "MIT"+ },+ "node_modules/brace-expansion": {+ "version": "1.1.12",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",+ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0",+ "concat-map": "0.0.1"+ }+ },+ "node_modules/browserslist": {+ "version": "4.28.1",+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",+ "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "baseline-browser-mapping": "^2.9.0",+ "caniuse-lite": "^1.0.30001759",+ "electron-to-chromium": "^1.5.263",+ "node-releases": "^2.0.27",+ "update-browserslist-db": "^1.2.0"+ },+ "bin": {+ "browserslist": "cli.js"+ },+ "engines": {+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"+ }+ },+ "node_modules/callsites": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/caniuse-lite": {+ "version": "1.0.30001775",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001775.tgz",+ "integrity": "sha512-s3Qv7Lht9zbVKE9XoTyRG6wVDCKdtOFIjBGg3+Yhn6JaytuNKPIjBMTMIY1AnOH3seL5mvF+x33oGAyK3hVt3A==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "CC-BY-4.0"+ },+ "node_modules/chalk": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.1.0",+ "supports-color": "^7.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/chalk?sponsor=1"+ }+ },+ "node_modules/clsx": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/color-convert": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "color-name": "~1.1.4"+ },+ "engines": {+ "node": ">=7.0.0"+ }+ },+ "node_modules/color-name": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/convert-source-map": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/cookie": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/cosmiconfig": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz",+ "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==",+ "license": "MIT",+ "dependencies": {+ "@types/parse-json": "^4.0.0",+ "import-fresh": "^3.2.1",+ "parse-json": "^5.0.0",+ "path-type": "^4.0.0",+ "yaml": "^1.10.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/cosmiconfig/node_modules/yaml": {+ "version": "1.10.2",+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",+ "license": "ISC",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/cross-spawn": {+ "version": "7.0.6",+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "path-key": "^3.1.0",+ "shebang-command": "^2.0.0",+ "which": "^2.0.1"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/csstype": {+ "version": "3.2.3",+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "license": "MIT"+ },+ "node_modules/d3-array": {+ "version": "3.2.4",+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",+ "license": "ISC",+ "dependencies": {+ "internmap": "1 - 2"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-color": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-delaunay": {+ "version": "6.0.4",+ "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz",+ "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==",+ "license": "ISC",+ "dependencies": {+ "delaunator": "5"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-ease": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",+ "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-format": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",+ "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-interpolate": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",+ "license": "ISC",+ "dependencies": {+ "d3-color": "1 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-path": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-scale": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",+ "license": "ISC",+ "dependencies": {+ "d3-array": "2.10.0 - 3",+ "d3-format": "1 - 3",+ "d3-interpolate": "1.2.0 - 3",+ "d3-time": "2.1.1 - 3",+ "d3-time-format": "2 - 4"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-shape": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",+ "license": "ISC",+ "dependencies": {+ "d3-path": "^3.1.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-time": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",+ "license": "ISC",+ "dependencies": {+ "d3-array": "2 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-time-format": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",+ "license": "ISC",+ "dependencies": {+ "d3-time": "1 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-timer": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",+ "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/decimal.js-light": {+ "version": "2.5.1",+ "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",+ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",+ "license": "MIT"+ },+ "node_modules/deep-is": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/delaunator": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz",+ "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==",+ "license": "ISC",+ "dependencies": {+ "robust-predicates": "^3.0.2"+ }+ },+ "node_modules/dom-helpers": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",+ "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.8.7",+ "csstype": "^3.0.2"+ }+ },+ "node_modules/electron-to-chromium": {+ "version": "1.5.302",+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz",+ "integrity": "sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/error-ex": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz",+ "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==",+ "license": "MIT",+ "dependencies": {+ "is-arrayish": "^0.2.1"+ }+ },+ "node_modules/es-toolkit": {+ "version": "1.45.0",+ "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.45.0.tgz",+ "integrity": "sha512-RArCX+Zea16+R1jg4mH223Z8p/ivbJjIkU3oC6ld2bdUfmDxiCkFYSi9zLOR2anucWJUeH4Djnzgd0im0nD3dw==",+ "license": "MIT",+ "workspaces": [+ "docs",+ "benchmarks"+ ]+ },+ "node_modules/esbuild": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz",+ "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "esbuild": "bin/esbuild"+ },+ "engines": {+ "node": ">=18"+ },+ "optionalDependencies": {+ "@esbuild/aix-ppc64": "0.27.3",+ "@esbuild/android-arm": "0.27.3",+ "@esbuild/android-arm64": "0.27.3",+ "@esbuild/android-x64": "0.27.3",+ "@esbuild/darwin-arm64": "0.27.3",+ "@esbuild/darwin-x64": "0.27.3",+ "@esbuild/freebsd-arm64": "0.27.3",+ "@esbuild/freebsd-x64": "0.27.3",+ "@esbuild/linux-arm": "0.27.3",+ "@esbuild/linux-arm64": "0.27.3",+ "@esbuild/linux-ia32": "0.27.3",+ "@esbuild/linux-loong64": "0.27.3",+ "@esbuild/linux-mips64el": "0.27.3",+ "@esbuild/linux-ppc64": "0.27.3",+ "@esbuild/linux-riscv64": "0.27.3",+ "@esbuild/linux-s390x": "0.27.3",+ "@esbuild/linux-x64": "0.27.3",+ "@esbuild/netbsd-arm64": "0.27.3",+ "@esbuild/netbsd-x64": "0.27.3",+ "@esbuild/openbsd-arm64": "0.27.3",+ "@esbuild/openbsd-x64": "0.27.3",+ "@esbuild/openharmony-arm64": "0.27.3",+ "@esbuild/sunos-x64": "0.27.3",+ "@esbuild/win32-arm64": "0.27.3",+ "@esbuild/win32-ia32": "0.27.3",+ "@esbuild/win32-x64": "0.27.3"+ }+ },+ "node_modules/escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/escape-string-regexp": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/eslint": {+ "version": "9.39.3",+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.3.tgz",+ "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@eslint-community/eslint-utils": "^4.8.0",+ "@eslint-community/regexpp": "^4.12.1",+ "@eslint/config-array": "^0.21.1",+ "@eslint/config-helpers": "^0.4.2",+ "@eslint/core": "^0.17.0",+ "@eslint/eslintrc": "^3.3.1",+ "@eslint/js": "9.39.3",+ "@eslint/plugin-kit": "^0.4.1",+ "@humanfs/node": "^0.16.6",+ "@humanwhocodes/module-importer": "^1.0.1",+ "@humanwhocodes/retry": "^0.4.2",+ "@types/estree": "^1.0.6",+ "ajv": "^6.12.4",+ "chalk": "^4.0.0",+ "cross-spawn": "^7.0.6",+ "debug": "^4.3.2",+ "escape-string-regexp": "^4.0.0",+ "eslint-scope": "^8.4.0",+ "eslint-visitor-keys": "^4.2.1",+ "espree": "^10.4.0",+ "esquery": "^1.5.0",+ "esutils": "^2.0.2",+ "fast-deep-equal": "^3.1.3",+ "file-entry-cache": "^8.0.0",+ "find-up": "^5.0.0",+ "glob-parent": "^6.0.2",+ "ignore": "^5.2.0",+ "imurmurhash": "^0.1.4",+ "is-glob": "^4.0.0",+ "json-stable-stringify-without-jsonify": "^1.0.1",+ "lodash.merge": "^4.6.2",+ "minimatch": "^3.1.2",+ "natural-compare": "^1.4.0",+ "optionator": "^0.9.3"+ },+ "bin": {+ "eslint": "bin/eslint.js"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://eslint.org/donate"+ },+ "peerDependencies": {+ "jiti": "*"+ },+ "peerDependenciesMeta": {+ "jiti": {+ "optional": true+ }+ }+ },+ "node_modules/eslint-plugin-react-hooks": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz",+ "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/core": "^7.24.4",+ "@babel/parser": "^7.24.4",+ "hermes-parser": "^0.25.1",+ "zod": "^3.25.0 || ^4.0.0",+ "zod-validation-error": "^3.5.0 || ^4.0.0"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0"+ }+ },+ "node_modules/eslint-plugin-react-refresh": {+ "version": "0.4.26",+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.26.tgz",+ "integrity": "sha512-1RETEylht2O6FM/MvgnyvT+8K21wLqDNg4qD51Zj3guhjt433XbnnkVttHMyaVyAFD03QSV4LPS5iE3VQmO7XQ==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "eslint": ">=8.40"+ }+ },+ "node_modules/eslint-scope": {+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "esrecurse": "^4.3.0",+ "estraverse": "^5.2.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/eslint-visitor-keys": {+ "version": "4.2.1",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/espree": {+ "version": "10.4.0",+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "acorn": "^8.15.0",+ "acorn-jsx": "^5.3.2",+ "eslint-visitor-keys": "^4.2.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/esquery": {+ "version": "1.7.0",+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",+ "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",+ "dev": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "estraverse": "^5.1.0"+ },+ "engines": {+ "node": ">=0.10"+ }+ },+ "node_modules/esrecurse": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "estraverse": "^5.2.0"+ },+ "engines": {+ "node": ">=4.0"+ }+ },+ "node_modules/estraverse": {+ "version": "5.3.0",+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",+ "dev": true,+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=4.0"+ }+ },+ "node_modules/esutils": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",+ "dev": true,+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },+ "node_modules/fast-deep-equal": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fast-json-stable-stringify": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fast-levenshtein": {+ "version": "2.0.6",+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/file-entry-cache": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "flat-cache": "^4.0.0"+ },+ "engines": {+ "node": ">=16.0.0"+ }+ },+ "node_modules/find-root": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",+ "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",+ "license": "MIT"+ },+ "node_modules/find-up": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "locate-path": "^6.0.0",+ "path-exists": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/flat-cache": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "flatted": "^3.2.9",+ "keyv": "^4.5.4"+ },+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/flatted": {+ "version": "3.3.4",+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.4.tgz",+ "integrity": "sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/gensync": {+ "version": "1.0.0-beta.2",+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/glob-parent": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.3"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/globals": {+ "version": "16.5.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz",+ "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/has-flag": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hermes-estree": {+ "version": "0.25.1",+ "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz",+ "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/hermes-parser": {+ "version": "0.25.1",+ "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz",+ "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "hermes-estree": "0.25.1"+ }+ },+ "node_modules/hoist-non-react-statics": {+ "version": "3.3.2",+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",+ "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "react-is": "^16.7.0"+ }+ },+ "node_modules/hoist-non-react-statics/node_modules/react-is": {+ "version": "16.13.1",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",+ "license": "MIT"+ },+ "node_modules/ignore": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },+ "node_modules/immer": {+ "version": "10.2.0",+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",+ "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/immer"+ }+ },+ "node_modules/import-fresh": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",+ "license": "MIT",+ "dependencies": {+ "parent-module": "^1.0.0",+ "resolve-from": "^4.0.0"+ },+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/imurmurhash": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8.19"+ }+ },+ "node_modules/internmap": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/is-arrayish": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",+ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",+ "license": "MIT"+ },+ "node_modules/is-core-module": {+ "version": "2.16.1",+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",+ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",+ "license": "MIT",+ "dependencies": {+ "hasown": "^2.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-glob": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-extglob": "^2.1.1"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/isexe": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/js-tokens": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",+ "license": "MIT"+ },+ "node_modules/js-yaml": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "argparse": "^2.0.1"+ },+ "bin": {+ "js-yaml": "bin/js-yaml.js"+ }+ },+ "node_modules/jsesc": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",+ "license": "MIT",+ "bin": {+ "jsesc": "bin/jsesc"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/json-buffer": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json-parse-even-better-errors": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",+ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",+ "license": "MIT"+ },+ "node_modules/json-schema-traverse": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json-stable-stringify-without-jsonify": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json5": {+ "version": "2.2.3",+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "json5": "lib/cli.js"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/keyv": {+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "json-buffer": "3.0.1"+ }+ },+ "node_modules/levn": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "prelude-ls": "^1.2.1",+ "type-check": "~0.4.0"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/lines-and-columns": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",+ "license": "MIT"+ },+ "node_modules/locate-path": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-locate": "^5.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/lodash.merge": {+ "version": "4.6.2",+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/loose-envify": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",+ "license": "MIT",+ "dependencies": {+ "js-tokens": "^3.0.0 || ^4.0.0"+ },+ "bin": {+ "loose-envify": "cli.js"+ }+ },+ "node_modules/lru-cache": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "yallist": "^3.0.2"+ }+ },+ "node_modules/minimatch": {+ "version": "3.1.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^1.1.7"+ },+ "engines": {+ "node": "*"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/nanoid": {+ "version": "3.3.11",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/natural-compare": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/node-releases": {+ "version": "2.0.27",+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",+ "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/optionator": {+ "version": "0.9.4",+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "deep-is": "^0.1.3",+ "fast-levenshtein": "^2.0.6",+ "levn": "^0.4.1",+ "prelude-ls": "^1.2.1",+ "type-check": "^0.4.0",+ "word-wrap": "^1.2.5"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/p-limit": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "yocto-queue": "^0.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-locate": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-limit": "^3.0.2"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/parent-module": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",+ "license": "MIT",+ "dependencies": {+ "callsites": "^3.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/parse-json": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",+ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.0.0",+ "error-ex": "^1.3.1",+ "json-parse-even-better-errors": "^2.3.0",+ "lines-and-columns": "^1.1.6"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/path-exists": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-key": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-parse": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",+ "license": "MIT"+ },+ "node_modules/path-type": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "license": "ISC"+ },+ "node_modules/picomatch": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/postcss": {+ "version": "8.5.6",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.11",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/prelude-ls": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/prop-types": {+ "version": "15.8.1",+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",+ "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",+ "license": "MIT",+ "dependencies": {+ "loose-envify": "^1.4.0",+ "object-assign": "^4.1.1",+ "react-is": "^16.13.1"+ }+ },+ "node_modules/prop-types/node_modules/react-is": {+ "version": "16.13.1",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",+ "license": "MIT"+ },+ "node_modules/punycode": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/react": {+ "version": "19.2.4",+ "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",+ "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/react-dom": {+ "version": "19.2.4",+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",+ "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "scheduler": "^0.27.0"+ },+ "peerDependencies": {+ "react": "^19.2.4"+ }+ },+ "node_modules/react-is": {+ "version": "19.2.4",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.4.tgz",+ "integrity": "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA==",+ "license": "MIT",+ "peer": true+ },+ "node_modules/react-redux": {+ "version": "9.2.0",+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",+ "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@types/use-sync-external-store": "^0.0.6",+ "use-sync-external-store": "^1.4.0"+ },+ "peerDependencies": {+ "@types/react": "^18.2.25 || ^19",+ "react": "^18.0 || ^19",+ "redux": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "redux": {+ "optional": true+ }+ }+ },+ "node_modules/react-refresh": {+ "version": "0.18.0",+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz",+ "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/react-router": {+ "version": "7.13.1",+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.13.1.tgz",+ "integrity": "sha512-td+xP4X2/6BJvZoX6xw++A2DdEi++YypA69bJUV5oVvqf6/9/9nNlD70YO1e9d3MyamJEBQFEzk6mbfDYbqrSA==",+ "license": "MIT",+ "dependencies": {+ "cookie": "^1.0.1",+ "set-cookie-parser": "^2.6.0"+ },+ "engines": {+ "node": ">=20.0.0"+ },+ "peerDependencies": {+ "react": ">=18",+ "react-dom": ">=18"+ },+ "peerDependenciesMeta": {+ "react-dom": {+ "optional": true+ }+ }+ },+ "node_modules/react-router-dom": {+ "version": "7.13.1",+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.13.1.tgz",+ "integrity": "sha512-UJnV3Rxc5TgUPJt2KJpo1Jpy0OKQr0AjgbZzBFjaPJcFOb2Y8jA5H3LT8HUJAiRLlWrEXWHbF1Z4SCZaQjWDHw==",+ "license": "MIT",+ "dependencies": {+ "react-router": "7.13.1"+ },+ "engines": {+ "node": ">=20.0.0"+ },+ "peerDependencies": {+ "react": ">=18",+ "react-dom": ">=18"+ }+ },+ "node_modules/react-transition-group": {+ "version": "4.4.5",+ "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",+ "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "@babel/runtime": "^7.5.5",+ "dom-helpers": "^5.0.1",+ "loose-envify": "^1.4.0",+ "prop-types": "^15.6.2"+ },+ "peerDependencies": {+ "react": ">=16.6.0",+ "react-dom": ">=16.6.0"+ }+ },+ "node_modules/recharts": {+ "version": "3.7.0",+ "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.7.0.tgz",+ "integrity": "sha512-l2VCsy3XXeraxIID9fx23eCb6iCBsxUQDnE8tWm6DFdszVAO7WVY/ChAD9wVit01y6B2PMupYiMmQwhgPHc9Ew==",+ "license": "MIT",+ "workspaces": [+ "www"+ ],+ "dependencies": {+ "@reduxjs/toolkit": "1.x.x || 2.x.x",+ "clsx": "^2.1.1",+ "decimal.js-light": "^2.5.1",+ "es-toolkit": "^1.39.3",+ "eventemitter3": "^5.0.1",+ "immer": "^10.1.1",+ "react-redux": "8.x.x || 9.x.x",+ "reselect": "5.1.1",+ "tiny-invariant": "^1.3.3",+ "use-sync-external-store": "^1.2.2",+ "victory-vendor": "^37.0.2"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },+ "node_modules/redux": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",+ "license": "MIT",+ "peer": true+ },+ "node_modules/redux-thunk": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",+ "license": "MIT",+ "peerDependencies": {+ "redux": "^5.0.0"+ }+ },+ "node_modules/reselect": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",+ "license": "MIT"+ },+ "node_modules/resolve": {+ "version": "1.22.11",+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz",+ "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==",+ "license": "MIT",+ "dependencies": {+ "is-core-module": "^2.16.1",+ "path-parse": "^1.0.7",+ "supports-preserve-symlinks-flag": "^1.0.0"+ },+ "bin": {+ "resolve": "bin/resolve"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/resolve-from": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/robust-predicates": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz",+ "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==",+ "license": "Unlicense"+ },+ "node_modules/rollup": {+ "version": "4.59.0",+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz",+ "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "1.0.8"+ },+ "bin": {+ "rollup": "dist/bin/rollup"+ },+ "engines": {+ "node": ">=18.0.0",+ "npm": ">=8.0.0"+ },+ "optionalDependencies": {+ "@rollup/rollup-android-arm-eabi": "4.59.0",+ "@rollup/rollup-android-arm64": "4.59.0",+ "@rollup/rollup-darwin-arm64": "4.59.0",+ "@rollup/rollup-darwin-x64": "4.59.0",+ "@rollup/rollup-freebsd-arm64": "4.59.0",+ "@rollup/rollup-freebsd-x64": "4.59.0",+ "@rollup/rollup-linux-arm-gnueabihf": "4.59.0",+ "@rollup/rollup-linux-arm-musleabihf": "4.59.0",+ "@rollup/rollup-linux-arm64-gnu": "4.59.0",+ "@rollup/rollup-linux-arm64-musl": "4.59.0",+ "@rollup/rollup-linux-loong64-gnu": "4.59.0",+ "@rollup/rollup-linux-loong64-musl": "4.59.0",+ "@rollup/rollup-linux-ppc64-gnu": "4.59.0",+ "@rollup/rollup-linux-ppc64-musl": "4.59.0",+ "@rollup/rollup-linux-riscv64-gnu": "4.59.0",+ "@rollup/rollup-linux-riscv64-musl": "4.59.0",+ "@rollup/rollup-linux-s390x-gnu": "4.59.0",+ "@rollup/rollup-linux-x64-gnu": "4.59.0",+ "@rollup/rollup-linux-x64-musl": "4.59.0",+ "@rollup/rollup-openbsd-x64": "4.59.0",+ "@rollup/rollup-openharmony-arm64": "4.59.0",+ "@rollup/rollup-win32-arm64-msvc": "4.59.0",+ "@rollup/rollup-win32-ia32-msvc": "4.59.0",+ "@rollup/rollup-win32-x64-gnu": "4.59.0",+ "@rollup/rollup-win32-x64-msvc": "4.59.0",+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/scheduler": {+ "version": "0.27.0",+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",+ "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/set-cookie-parser": {+ "version": "2.7.2",+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",+ "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",+ "license": "MIT"+ },+ "node_modules/shebang-command": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "shebang-regex": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/shebang-regex": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/source-map": {+ "version": "0.5.7",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",+ "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/source-map-js": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/strip-json-comments": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/stylis": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz",+ "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==",+ "license": "MIT"+ },+ "node_modules/supports-color": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/supports-preserve-symlinks-flag": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/tiny-invariant": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",+ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",+ "license": "MIT"+ },+ "node_modules/tinyglobby": {+ "version": "0.2.15",+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fdir": "^6.5.0",+ "picomatch": "^4.0.3"+ },+ "engines": {+ "node": ">=12.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/SuperchupuDev"+ }+ },+ "node_modules/type-check": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "prelude-ls": "^1.2.1"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/update-browserslist-db": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "escalade": "^3.2.0",+ "picocolors": "^1.1.1"+ },+ "bin": {+ "update-browserslist-db": "cli.js"+ },+ "peerDependencies": {+ "browserslist": ">= 4.21.0"+ }+ },+ "node_modules/uri-js": {+ "version": "4.4.1",+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "punycode": "^2.1.0"+ }+ },+ "node_modules/use-sync-external-store": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",+ "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",+ "license": "MIT",+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },+ "node_modules/victory-vendor": {+ "version": "37.3.6",+ "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",+ "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",+ "license": "MIT AND ISC",+ "dependencies": {+ "@types/d3-array": "^3.0.3",+ "@types/d3-ease": "^3.0.0",+ "@types/d3-interpolate": "^3.0.1",+ "@types/d3-scale": "^4.0.2",+ "@types/d3-shape": "^3.1.0",+ "@types/d3-time": "^3.0.0",+ "@types/d3-timer": "^3.0.0",+ "d3-array": "^3.1.6",+ "d3-ease": "^3.0.1",+ "d3-interpolate": "^3.0.1",+ "d3-scale": "^4.0.2",+ "d3-shape": "^3.1.0",+ "d3-time": "^3.0.0",+ "d3-timer": "^3.0.1"+ }+ },+ "node_modules/vite": {+ "version": "7.3.1",+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz",+ "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "esbuild": "^0.27.0",+ "fdir": "^6.5.0",+ "picomatch": "^4.0.3",+ "postcss": "^8.5.6",+ "rollup": "^4.43.0",+ "tinyglobby": "^0.2.15"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^20.19.0 || >=22.12.0",+ "jiti": ">=1.21.0",+ "less": "^4.0.0",+ "lightningcss": "^1.21.0",+ "sass": "^1.70.0",+ "sass-embedded": "^1.70.0",+ "stylus": ">=0.54.8",+ "sugarss": "^5.0.0",+ "terser": "^5.16.0",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "jiti": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ },+ "node_modules/which": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "isexe": "^2.0.0"+ },+ "bin": {+ "node-which": "bin/node-which"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/word-wrap": {+ "version": "1.2.5",+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/yallist": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/yocto-queue": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/zod": {+ "version": "4.3.6",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",+ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },+ "node_modules/zod-validation-error": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz",+ "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18.0.0"+ },+ "peerDependencies": {+ "zod": "^3.25.0 || ^4.0.0"+ }+ }+ }+}diff --git a/frontend/package.json b/frontend/package.jsonnew file mode 100644index 0000000..e04da42--- /dev/null+++ b/frontend/package.json@@ -0,0 +1,35 @@+{+ "name": "frontend",+ "private": true,+ "version": "0.0.0",+ "type": "module",+ "scripts": {+ "dev": "vite",+ "build": "vite build",+ "lint": "eslint .",+ "preview": "vite preview"+ },+ "dependencies": {+ "@emotion/react": "^11.14.0",+ "@emotion/styled": "^11.14.1",+ "@mui/icons-material": "^7.3.8",+ "@mui/material": "^7.3.8",+ "@mui/x-charts": "^8.5.0",+ "@mui/x-data-grid": "^8.5.0",+ "react": "^19.2.0",+ "react-dom": "^19.2.0",+ "react-router-dom": "^7.13.1",+ "recharts": "^3.7.0"+ },+ "devDependencies": {+ "@eslint/js": "^9.39.1",+ "@types/react": "^19.2.7",+ "@types/react-dom": "^19.2.3",+ "@vitejs/plugin-react": "^5.1.1",+ "eslint": "^9.39.1",+ "eslint-plugin-react-hooks": "^7.0.1",+ "eslint-plugin-react-refresh": "^0.4.24",+ "globals": "^16.5.0",+ "vite": "^7.3.1"+ }+}diff --git a/frontend/public/logo.svg b/frontend/public/logo.svgnew file mode 100644index 0000000..4e31651--- /dev/null+++ b/frontend/public/logo.svg@@ -0,0 +1,26 @@+<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">+ <defs>+ <linearGradient id="logoBg" x1="0" y1="0" x2="120" y2="120" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stop-color="#FF0000"/>+ <stop offset="100%" stop-color="#CC0000"/>+ </linearGradient>+ <linearGradient id="barGrad1" x1="0" y1="100" x2="0" y2="30" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.95"/>+ <stop offset="100%" stop-color="#FFFFFF" stop-opacity="0.7"/>+ </linearGradient>+ <linearGradient id="playGrad" x1="70" y1="20" x2="110" y2="55" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stop-color="#FFFFFF"/>+ <stop offset="100%" stop-color="#FFD4D4"/>+ </linearGradient>+ </defs>+ <rect width="120" height="120" rx="28" fill="url(#logoBg)"/>+ <rect x="18" y="72" width="16" height="26" rx="4" fill="url(#barGrad1)" opacity="0.9"/>+ <rect x="40" y="52" width="16" height="46" rx="4" fill="url(#barGrad1)" opacity="0.95"/>+ <rect x="62" y="36" width="16" height="62" rx="4" fill="url(#barGrad1)"/>+ <path d="M26 68 L48 48 L70 32" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.6"/>+ <g transform="translate(82, 18)">+ <rect width="30" height="22" rx="5" fill="rgba(255,255,255,0.2)"/>+ <path d="M11 5 L23 11 L11 17Z" fill="url(#playGrad)"/>+ </g>+ <circle cx="70" cy="32" r="4" fill="#FFFFFF" opacity="0.9"/>+</svg>diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxnew file mode 100644index 0000000..a1529d8--- /dev/null+++ b/frontend/src/App.jsx@@ -0,0 +1,103 @@+import React, { useState, useEffect, useCallback } from 'react';+import { ThemeProvider, CssBaseline, Box, Snackbar, Alert } from '@mui/material';+import theme from './theme';+import Sidebar from './components/Sidebar';+import Overview from './components/Overview';+import ChannelAnalytics from './components/ChannelAnalytics';+import AccountManager from './components/AccountManager';+import Settings from './components/Settings';+import VideoExplorer from './components/VideoExplorer';+import ShortsExplorer from './components/ShortsExplorer';+import ReelsExplorer from './components/ReelsExplorer';+import InstagramAnalytics from './components/InstagramAnalytics';+import UploadContent from './components/UploadContent';+import { api } from './services/api';+import { normalizeAccount } from './utils/formatters';++export default function App() {+ const [tab, setTab] = useState('overview');+ const [accounts, setAccounts] = useState([]);+ const [selectedAccount, setSelectedAccount] = useState(null);+ const [toast, setToast] = useState({ open: false, message: '', severity: 'success' });+ const [loading, setLoading] = useState(false);++ const showToast = useCallback((message, severity = 'success') => {+ setToast({ open: true, message, severity });+ }, []);++ const loadAccounts = useCallback(async () => {+ try {+ const data = await api.getAccounts();+ setAccounts(data.map(normalizeAccount));+ } catch (err) {+ showToast('Failed to load accounts: ' + err.message, 'error');+ }+ }, [showToast]);++ useEffect(() => { loadAccounts(); }, [loadAccounts]);++ const handleViewChannel = (account) => {+ setSelectedAccount(account);+ setTab(account.platform === 'instagram' ? 'ig-analytics' : 'channel');+ };++ const handleRefreshAll = async () => {+ setLoading(true);+ try {+ const res = await api.refreshAll();+ setAccounts((res.accounts || []).map(normalizeAccount));+ showToast('All accounts refreshed!');+ } catch (err) {+ showToast(err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ const renderTab = () => {+ switch (tab) {+ case 'overview':+ return <Overview accounts={accounts} onViewChannel={handleViewChannel} onRefreshAll={handleRefreshAll} loading={loading} />;+ case 'channel':+ return selectedAccount+ ? <ChannelAnalytics account={selectedAccount} showToast={showToast} onBack={() => setTab('overview')} />+ : <Overview accounts={accounts} onViewChannel={handleViewChannel} onRefreshAll={handleRefreshAll} loading={loading} />;+ case 'videos':+ return <VideoExplorer accounts={accounts} showToast={showToast} />;+ case 'shorts':+ return <ShortsExplorer accounts={accounts} showToast={showToast} />;+ case 'reels':+ return <ReelsExplorer accounts={accounts} showToast={showToast} />;+ case 'upload':+ return <UploadContent accounts={accounts} showToast={showToast} />;+ case 'accounts':+ return <AccountManager accounts={accounts} setAccounts={setAccounts} showToast={showToast} onRefresh={loadAccounts} />;+ case 'ig-analytics':+ return selectedAccount?.platform === 'instagram'+ ? <InstagramAnalytics account={selectedAccount} showToast={showToast} onBack={() => setTab('overview')} />+ : <Overview accounts={accounts} onViewChannel={handleViewChannel} onRefreshAll={handleRefreshAll} loading={loading} />;+ case 'settings':+ return <Settings showToast={showToast} onRefresh={loadAccounts} />;+ default:+ return <Overview accounts={accounts} onViewChannel={handleViewChannel} onRefreshAll={handleRefreshAll} loading={loading} />;+ }+ };++ return (+ <ThemeProvider theme={theme}>+ <CssBaseline />+ <Box sx={{ display: 'flex', minHeight: '100vh', bgcolor: 'background.default' }}>+ <Sidebar tab={tab} setTab={setTab} accounts={accounts} onViewChannel={handleViewChannel} />+ <Box component="main" sx={{ flexGrow: 1, p: { xs: 2, md: 3 }, minWidth: 0, overflowX: 'hidden' }}>+ {renderTab()}+ </Box>+ </Box>+ <Snackbar open={toast.open} autoHideDuration={4000} onClose={() => setToast(t => ({ ...t, open: false }))}+ anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}>+ <Alert severity={toast.severity} variant="filled" onClose={() => setToast(t => ({ ...t, open: false }))}>+ {toast.message}+ </Alert>+ </Snackbar>+ </ThemeProvider>+ );+}diff --git a/frontend/src/assets/react.svg b/frontend/src/assets/react.svgnew file mode 100644index 0000000..6c87de9--- /dev/null+++ b/frontend/src/assets/react.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>\ No newline at end of filediff --git a/frontend/src/components/AccountManager.jsx b/frontend/src/components/AccountManager.jsxnew file mode 100644index 0000000..7883675--- /dev/null+++ b/frontend/src/components/AccountManager.jsx@@ -0,0 +1,387 @@+import React, { useState } from 'react';+import {+ Box, Typography, Grid, Card, CardContent, Button, TextField, Dialog,+ DialogTitle, DialogContent, DialogActions, IconButton, Avatar, Chip,+ LinearProgress, CircularProgress, InputAdornment, Tabs, Tab, Alert,+} from '@mui/material';+import {+ Add, Delete, Refresh, Search, YouTube, People, Visibility, VideoLibrary,+ Link as LinkIcon, CheckCircle, Instagram, Favorite, Photo, Key,+} from '@mui/icons-material';+import { api } from '../services/api';+import { fmtNum, timeAgo } from '../utils/formatters';++export default function AccountManager({ accounts, showToast, onRefresh }) {+ const [dialogOpen, setDialogOpen] = useState(false);+ const [dialogTab, setDialogTab] = useState(0); // 0 = YouTube, 1 = Instagram+ const [input, setInput] = useState('');+ const [igToken, setIgToken] = useState('');+ const [resolving, setResolving] = useState(false);+ const [resolved, setResolved] = useState(null);+ const [adding, setAdding] = useState(false);+ const [refreshingId, setRefreshingId] = useState(null);++ const handleResolve = async () => {+ if (!input.trim()) return;+ setResolving(true);+ setResolved(null);+ try {+ const res = await api.resolveChannel(input.trim());+ setResolved(res.data || res);+ } catch (err) {+ showToast('Could not resolve channel: ' + err.message, 'error');+ } finally {+ setResolving(false);+ }+ };++ const handleAdd = async () => {+ if (!input.trim()) return;+ setAdding(true);+ try {+ await api.addAccount(input.trim());+ showToast('Channel added successfully!', 'success');+ setDialogOpen(false);+ setInput('');+ setResolved(null);+ onRefresh();+ } catch (err) {+ showToast('Failed to add account: ' + err.message, 'error');+ } finally {+ setAdding(false);+ }+ };++ const handleDelete = async (id) => {+ try {+ await api.deleteAccount(id);+ showToast('Account removed', 'success');+ onRefresh();+ } catch (err) {+ showToast('Failed to delete: ' + err.message, 'error');+ }+ };++ const handleRefreshOne = async (id) => {+ setRefreshingId(id);+ try {+ await api.refreshAccount(id);+ showToast('Account refreshed', 'success');+ onRefresh();+ } catch (err) {+ showToast('Refresh failed: ' + err.message, 'error');+ } finally {+ setRefreshingId(null);+ }+ };++ const handleRefreshAll = async () => {+ setRefreshingId('all');+ try {+ await api.refreshAll();+ showToast('All accounts refreshed', 'success');+ onRefresh();+ } catch (err) {+ showToast('Refresh all failed: ' + err.message, 'error');+ } finally {+ setRefreshingId(null);+ }+ };++ const handleAddInstagram = async () => {+ if (!igToken.trim()) return;+ setAdding(true);+ try {+ await api.addInstagramAccount(igToken.trim());+ showToast('Instagram account added successfully!', 'success');+ setDialogOpen(false);+ setIgToken('');+ onRefresh();+ } catch (err) {+ showToast('Failed to add Instagram account: ' + err.message, 'error');+ } finally {+ setAdding(false);+ }+ };++ const closeDialog = () => {+ setDialogOpen(false);+ setResolved(null);+ setInput('');+ setIgToken('');+ };++ const ytAccounts = accounts.filter(a => a.platform !== 'instagram');+ const igAccounts = accounts.filter(a => a.platform === 'instagram');++ return (+ <Box>+ <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>+ Manage Accounts+ </Typography>+ <Box sx={{ display: 'flex', gap: 1 }}>+ <Button variant="outlined" startIcon={<Refresh />} onClick={handleRefreshAll}+ disabled={refreshingId === 'all'} sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ {refreshingId === 'all' ? 'Refreshing...' : 'Refresh All'}+ </Button>+ <Button variant="contained" startIcon={<Add />} onClick={() => setDialogOpen(true)}+ sx={{ background: 'linear-gradient(135deg, #667eea, #764ba2)' }}>+ Add Account+ </Button>+ </Box>+ </Box>++ {accounts.length === 0 ? (+ <Card sx={{ p: 6, textAlign: 'center' }}>+ <People sx={{ fontSize: 64, color: '#667eea', mb: 2 }} />+ <Typography variant="h6" sx={{ mb: 1, fontWeight: 600 }}>No Accounts Added</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Add a YouTube channel or Instagram account to start tracking analytics.+ </Typography>+ <Button variant="contained" startIcon={<Add />} onClick={() => setDialogOpen(true)}+ sx={{ background: 'linear-gradient(135deg, #667eea, #764ba2)' }}>+ Add Your First Account+ </Button>+ </Card>+ ) : (+ <>+ {/* YouTube Accounts */}+ {ytAccounts.length > 0 && (+ <Box sx={{ mb: 4 }}>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2, display: 'flex', alignItems: 'center', gap: 1 }}>+ <YouTube sx={{ color: '#FF0000' }} /> YouTube Channels+ <Chip label={ytAccounts.length} size="small" sx={{ fontSize: 12, height: 22, bgcolor: 'rgba(255,0,0,0.1)', color: '#FF4444' }} />+ </Typography>+ <Grid container spacing={2.5}>+ {ytAccounts.map(acct => (+ <Grid size={{ xs: 12, sm: 6, md: 4 }} key={acct.id}>+ <Card sx={{ '&:hover': { transform: 'translateY(-2px)', transition: 'all 0.2s', borderColor: 'rgba(255,0,0,0.3)' } }}>+ <CardContent>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 2 }}>+ <Avatar src={acct.thumbnail || acct.thumbnails?.default || acct.thumbnailUrl} sx={{ width: 56, height: 56, border: '2px solid rgba(255,0,0,0.2)' }}>+ <YouTube />+ </Avatar>+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="subtitle1" sx={{ fontWeight: 700, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {acct.title || acct.channelId}+ </Typography>+ {acct.customUrl && (+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>{acct.customUrl}</Typography>+ )}+ </Box>+ </Box>+ <Grid container spacing={1} sx={{ mb: 2 }}>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(255,0,0,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Subscribers</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.subscriberCount)}</Typography>+ </Box>+ </Grid>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(62,166,255,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Views</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.viewCount)}</Typography>+ </Box>+ </Grid>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(76,175,80,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Videos</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.videoCount)}</Typography>+ </Box>+ </Grid>+ </Grid>+ {acct.lastUpdated && (+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', mb: 1.5 }}>+ Last updated: {timeAgo(acct.lastUpdated)}+ </Typography>+ )}+ <Box sx={{ display: 'flex', gap: 1 }}>+ <Button size="small" startIcon={<Refresh />} onClick={() => handleRefreshOne(acct.id)}+ disabled={refreshingId === acct.id} fullWidth variant="outlined"+ sx={{ borderColor: 'rgba(255,255,255,0.1)', fontSize: 12 }}>+ {refreshingId === acct.id ? 'Refreshing...' : 'Refresh'}+ </Button>+ <IconButton size="small" onClick={() => handleDelete(acct.id)}+ sx={{ color: 'error.main', border: '1px solid rgba(255,0,0,0.2)', borderRadius: 2 }}>+ <Delete fontSize="small" />+ </IconButton>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ ))}+ </Grid>+ </Box>+ )}++ {/* Instagram Accounts */}+ {igAccounts.length > 0 && (+ <Box sx={{ mb: 4 }}>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2, display: 'flex', alignItems: 'center', gap: 1 }}>+ <Instagram sx={{ color: '#E1306C' }} /> Instagram Accounts+ <Chip label={igAccounts.length} size="small" sx={{ fontSize: 12, height: 22, bgcolor: 'rgba(225,48,108,0.1)', color: '#E1306C' }} />+ </Typography>+ <Grid container spacing={2.5}>+ {igAccounts.map(acct => (+ <Grid size={{ xs: 12, sm: 6, md: 4 }} key={acct.id}>+ <Card sx={{ '&:hover': { transform: 'translateY(-2px)', transition: 'all 0.2s', borderColor: 'rgba(225,48,108,0.3)' } }}>+ <CardContent>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 2 }}>+ <Avatar src={acct.profilePictureUrl || acct.thumbnail} sx={{ width: 56, height: 56, border: '2px solid rgba(225,48,108,0.3)' }}>+ <Instagram />+ </Avatar>+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="subtitle1" sx={{ fontWeight: 700, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {acct.title || acct.username || acct.igUsername}+ </Typography>+ {(acct.username || acct.igUsername) && (+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>@{acct.username || acct.igUsername}</Typography>+ )}+ </Box>+ </Box>+ <Grid container spacing={1} sx={{ mb: 2 }}>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(225,48,108,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Followers</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.followersCount)}</Typography>+ </Box>+ </Grid>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(138,58,185,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Following</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.followsCount)}</Typography>+ </Box>+ </Grid>+ <Grid size={4}>+ <Box sx={{ textAlign: 'center', p: 1, borderRadius: 2, bgcolor: 'rgba(81,91,212,0.06)' }}>+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block' }}>Posts</Typography>+ <Typography variant="body2" sx={{ fontWeight: 700 }}>{fmtNum(acct.mediaCount)}</Typography>+ </Box>+ </Grid>+ </Grid>+ {acct.lastUpdated && (+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', mb: 1.5 }}>+ Last updated: {timeAgo(acct.lastUpdated)}+ </Typography>+ )}+ <Box sx={{ display: 'flex', gap: 1 }}>+ <Button size="small" startIcon={<Refresh />} onClick={() => handleRefreshOne(acct.id)}+ disabled={refreshingId === acct.id} fullWidth variant="outlined"+ sx={{ borderColor: 'rgba(255,255,255,0.1)', fontSize: 12 }}>+ {refreshingId === acct.id ? 'Refreshing...' : 'Refresh'}+ </Button>+ <IconButton size="small" onClick={() => handleDelete(acct.id)}+ sx={{ color: 'error.main', border: '1px solid rgba(255,0,0,0.2)', borderRadius: 2 }}>+ <Delete fontSize="small" />+ </IconButton>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ ))}+ </Grid>+ </Box>+ )}+ </>+ )}++ {/* Add Account Dialog */}+ <Dialog open={dialogOpen} onClose={closeDialog}+ maxWidth="sm" fullWidth PaperProps={{ sx: { bgcolor: '#1A1A1A', backgroundImage: 'none' } }}>+ <DialogTitle sx={{ fontWeight: 700, pb: 0 }}>+ Add Account+ </DialogTitle>+ <DialogContent>+ <Tabs value={dialogTab} onChange={(_, v) => setDialogTab(v)} sx={{ mb: 2, mt: 1 }}+ TabIndicatorProps={{ sx: { background: dialogTab === 0 ? '#FF0000' : 'linear-gradient(90deg, #F58529, #DD2A7B, #8134AF)' } }}>+ <Tab icon={<YouTube sx={{ color: dialogTab === 0 ? '#FF0000' : 'text.secondary' }} />}+ label="YouTube" iconPosition="start" sx={{ textTransform: 'none', fontWeight: 600 }} />+ <Tab icon={<Instagram sx={{ color: dialogTab === 1 ? '#E1306C' : 'text.secondary' }} />}+ label="Instagram" iconPosition="start" sx={{ textTransform: 'none', fontWeight: 600 }} />+ </Tabs>++ {dialogTab === 0 ? (+ <>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 2 }}>+ Enter a YouTube channel URL, @handle, or channel ID.+ </Typography>+ <Box sx={{ display: 'flex', gap: 1, mb: 2 }}>+ <TextField fullWidth value={input} onChange={e => setInput(e.target.value)}+ placeholder="e.g. @MrBeast, https://youtube.com/@MrBeast, UCX6OQ3..."+ size="small" onKeyDown={e => e.key === 'Enter' && handleResolve()}+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><LinkIcon sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }} />+ <Button variant="contained" onClick={handleResolve} disabled={resolving || !input.trim()}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)', minWidth: 100 }}>+ {resolving ? <CircularProgress size={20} /> : <Search />}+ </Button>+ </Box>+ {resolving && <LinearProgress color="error" sx={{ mb: 2 }} />}+ {resolved && (+ <Card sx={{ bgcolor: 'rgba(76,175,80,0.05)', border: '1px solid rgba(76,175,80,0.2)' }}>+ <CardContent sx={{ display: 'flex', alignItems: 'center', gap: 2, p: 2, '&:last-child': { pb: 2 } }}>+ <Avatar src={resolved.thumbnails?.medium || resolved.thumbnails?.default} sx={{ width: 56, height: 56 }}>+ <YouTube />+ </Avatar>+ <Box sx={{ flex: 1 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ <Typography variant="subtitle1" sx={{ fontWeight: 700 }}>{resolved.title}</Typography>+ <CheckCircle sx={{ fontSize: 18, color: '#4CAF50' }} />+ </Box>+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>+ {resolved.customUrl} {resolved.channelId && `• ${resolved.channelId}`}+ </Typography>+ {resolved.subscriberCount != null && (+ <Box sx={{ display: 'flex', gap: 1.5, mt: 0.5 }}>+ <Chip label={`${fmtNum(resolved.subscriberCount)} subs`} size="small" sx={{ fontSize: 11, height: 22 }} />+ <Chip label={`${fmtNum(resolved.videoCount)} videos`} size="small" sx={{ fontSize: 11, height: 22 }} />+ </Box>+ )}+ </Box>+ </CardContent>+ </Card>+ )}+ </>+ ) : (+ <>+ <Alert severity="info" sx={{ mb: 2, bgcolor: 'rgba(81,91,212,0.08)', '& .MuiAlert-icon': { color: '#8134AF' } }}>+ Paste your <b>Instagram Access Token</b> from the App Dashboard (Instagram → API setup → Generate Token).+ Tokens from the dashboard are already long-lived (~60 days).+ </Alert>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 2 }}>+ Your app needs the <b>instagram_business_basic</b> permission, and your Instagram account must be+ a <b>Business</b> or <b>Creator</b> professional account.+ </Typography>+ <TextField fullWidth value={igToken} onChange={e => setIgToken(e.target.value)}+ placeholder="Paste your Instagram access token here..."+ size="small" multiline rows={3}+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start" sx={{ alignSelf: 'flex-start', mt: 1 }}><Key sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }} />+ </>+ )}+ </DialogContent>+ <DialogActions sx={{ px: 3, pb: 2 }}>+ <Button onClick={closeDialog}>Cancel</Button>+ {dialogTab === 0 ? (+ <Button variant="contained" onClick={handleAdd} disabled={!input.trim() || adding}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)' }}>+ {adding ? <CircularProgress size={20} /> : 'Add Channel'}+ </Button>+ ) : (+ <Button variant="contained" onClick={handleAddInstagram} disabled={!igToken.trim() || adding}+ sx={{ background: 'linear-gradient(135deg, #F58529, #DD2A7B, #8134AF)' }}>+ {adding ? <CircularProgress size={20} /> : 'Add Instagram'}+ </Button>+ )}+ </DialogActions>+ </Dialog>+ </Box>+ );+}diff --git a/frontend/src/components/ChannelAnalytics.jsx b/frontend/src/components/ChannelAnalytics.jsxnew file mode 100644index 0000000..a18dea0--- /dev/null+++ b/frontend/src/components/ChannelAnalytics.jsx@@ -0,0 +1,781 @@+import React, { useState, useEffect } from 'react';+import {+ Box, Typography, Grid, Card, CardContent, Button, Avatar, Chip, Tabs, Tab,+ LinearProgress, Table, TableBody, TableCell, TableContainer, TableHead, TableRow,+ IconButton, Tooltip, Divider, Skeleton, Paper, CircularProgress,+} from '@mui/material';+import {+ ArrowBack, Refresh, Visibility, People, VideoLibrary, ThumbUp, Comment,+ TrendingUp, TrendingDown, Schedule, EmojiEvents, Speed, BarChart as BarChartIcon,+ Whatshot, Timeline, CalendarMonth, AccessTime, HighQuality, ClosedCaption,+ Tag, Category, Timelapse, WorkspacePremium, ShowChart, PieChartOutline,+ Subscriptions, QueryStats, Analytics, SignalCellularAlt, Insights,+ PlayCircleOutline,+} from '@mui/icons-material';+import {+ BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip as ReTooltip,+ ResponsiveContainer, LineChart, Line, PieChart, Pie, Cell, Legend,+ AreaChart, Area, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar,+} from 'recharts';+import StatCard from './StatCard';+import { api } from '../services/api';+import { fmtNum, fmtNumFull, fmtDate, fmtPercent, fmtDuration, timeAgo, CATEGORY_MAP } from '../utils/formatters';++const COLORS = ['#FF0000', '#3EA6FF', '#4CAF50', '#FF9800', '#AB47BC', '#26A69A', '#EC407A', '#5C6BC0', '#FFCA28', '#00BCD4'];++export default function ChannelAnalytics({ account, showToast, onBack }) {+ const [data, setData] = useState(null);+ const [loading, setLoading] = useState(true);+ const [tabValue, setTabValue] = useState(0);++ useEffect(() => {+ loadAnalytics();+ }, [account.id]);++ const loadAnalytics = async () => {+ setLoading(true);+ try {+ const res = await api.getAnalytics(account.id);+ setData(res);+ } catch (err) {+ showToast('Failed to load analytics: ' + err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ if (loading) {+ return (+ <Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 3 }}>+ <Button startIcon={<ArrowBack />} onClick={onBack}>Back</Button>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>Loading Analytics...</Typography>+ </Box>+ <LinearProgress color="error" sx={{ mb: 3 }} />+ <Grid container spacing={2.5}>+ {[...Array(8)].map((_, i) => (+ <Grid size={{ xs: 12, sm: 6, md: 3 }} key={i}>+ <Skeleton variant="rounded" height={100} sx={{ borderRadius: 3 }} />+ </Grid>+ ))}+ </Grid>+ </Box>+ );+ }++ if (!data) return null;+ const { channel, analytics } = data;++ const dayData = analytics.publishDayDistribution+ ? Object.entries(analytics.publishDayDistribution).map(([day, count]) => ({ day, count }))+ : [];++ const hourData = analytics.publishHourDistribution+ ? Object.entries(analytics.publishHourDistribution)+ .sort((a, b) => parseInt(a[0]) - parseInt(b[0]))+ .map(([hour, count]) => ({ hour: `${hour}:00`, count }))+ : [];++ const durationData = analytics.durationDistribution+ ? [+ { name: 'Shorts (<1m)', value: analytics.durationDistribution.short, color: '#FF0000' },+ { name: 'Medium (1-10m)', value: analytics.durationDistribution.medium, color: '#3EA6FF' },+ { name: 'Long (10-60m)', value: analytics.durationDistribution.long, color: '#4CAF50' },+ { name: 'Very Long (>1h)', value: analytics.durationDistribution.veryLong, color: '#FF9800' },+ ].filter(d => d.value > 0)+ : [];++ const catData = analytics.categoryDistribution+ ? Object.entries(analytics.categoryDistribution).map(([id, count]) => ({+ name: CATEGORY_MAP[id] || `Cat ${id}`, value: count,+ }))+ : [];++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 1 }}>+ <Button startIcon={<ArrowBack />} onClick={onBack} sx={{ color: 'text.secondary' }}>Back</Button>+ </Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2.5, mb: 3 }}>+ <Avatar src={channel.thumbnails?.high || channel.thumbnails?.medium} sx={{ width: 72, height: 72, border: '3px solid rgba(255,0,0,0.3)' }} />+ <Box sx={{ flex: 1 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>{channel.title}</Typography>+ <Box sx={{ display: 'flex', gap: 1.5, alignItems: 'center', mt: 0.5, flexWrap: 'wrap' }}>+ {channel.customUrl && <Chip label={channel.customUrl} size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.15)' }} />}+ {channel.country && channel.country !== 'Unknown' && <Chip label={channel.country} size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.15)' }} />}+ <Chip label={`${channel.channelAgeYears} years old`} size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.15)' }} />+ <Chip label={`Since ${fmtDate(channel.publishedAt)}`} size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.15)' }} />+ </Box>+ </Box>+ <Button variant="contained" startIcon={<Refresh />} onClick={loadAnalytics}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)' }}>Refresh</Button>+ </Box>++ {/* Navigation Tabs */}+ <Tabs value={tabValue} onChange={(_, v) => setTabValue(v)} sx={{ mb: 3 }}+ textColor="inherit" TabIndicatorProps={{ sx: { bgcolor: '#FF0000' } }}+ variant="scrollable" scrollButtons="auto">+ <Tab label="Overview" />+ <Tab label="Videos" />+ <Tab label="Engagement" />+ <Tab label="Content" />+ <Tab label="Publishing" />+ <Tab label="Growth" />+ <Tab label="Shorts vs Regular" />+ <Tab label="Tags & SEO" />+ </Tabs>++ {/* TAB 0: Overview */}+ {tabValue === 0 && (+ <Box>+ {/* Primary KPIs */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<Visibility />} label="Total Views" value={fmtNum(channel.viewCount)} subtitle={fmtNumFull(channel.viewCount)} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<People />} label="Subscribers" value={fmtNum(channel.subscriberCount)} subtitle={fmtNumFull(channel.subscriberCount)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<VideoLibrary />} label="Total Videos" value={fmtNum(channel.videoCount)} subtitle={`${analytics.totalVideos} analyzed`} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<ThumbUp />} label="Total Likes" value={fmtNum(analytics.totalLikes)} subtitle={fmtNumFull(analytics.totalLikes)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<Comment />} label="Total Comments" value={fmtNum(analytics.totalComments)} subtitle={fmtNumFull(analytics.totalComments)} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<TrendingUp />} label="Engagement Rate" value={fmtPercent(analytics.overallEngagementRate)} subtitle="Likes+Comments/Views" gradient="teal" small />+ </Grid>+ </Grid>++ {/* Secondary KPIs */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Speed />} label="Avg Views/Video" value={fmtNum(analytics.avgViews)} gradient="cyan" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<ThumbUp />} label="Avg Likes/Video" value={fmtNum(analytics.avgLikes)} gradient="indigo" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Comment />} label="Avg Comments/Video" value={fmtNum(analytics.avgComments)} gradient="pink" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<QueryStats />} label="Median Views" value={fmtNum(analytics.medianViews)} gradient="amber" small />+ </Grid>+ </Grid>++ {/* Channel-Level Computed Metrics */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Visibility />} label="Views per Subscriber" value={channel.viewsPerSubscriber} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<TrendingUp />} label="Avg Subs Gained/Day" value={fmtNum(channel.avgSubGainPerDay)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Visibility />} label="Avg Views/Day" value={fmtNum(channel.avgViewsPerDay)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Timelapse />} label="Avg Duration" value={analytics.avgDurationFormatted} gradient="orange" small />+ </Grid>+ </Grid>++ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<CalendarMonth />} label="Est. Monthly Views" value={fmtNum(channel.estimatedMonthlyViews)} gradient="indigo" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<People />} label="Est. Monthly Subs" value={fmtNum(channel.estimatedMonthlySubGain)} gradient="teal" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Whatshot />} label="Virality Score" value={`${analytics.viralityScore}x`} subtitle="Best vs Average" gradient="pink" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<WorkspacePremium />} label="Consistency Score" value={`${analytics.consistencyScore}/100`} gradient="amber" small />+ </Grid>+ </Grid>++ {/* Recent Activity */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Schedule />} label="Videos Last 7 Days" value={analytics.videosLast7Days} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Schedule />} label="Videos Last 30 Days" value={analytics.videosLast30Days} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Schedule />} label="Videos Last 90 Days" value={analytics.videosLast90Days} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Schedule />} label="Videos Last Year" value={analytics.videosLast365Days} gradient="orange" small />+ </Grid>+ </Grid>++ {/* Upload Frequency */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Speed />} label="Uploads/Week" value={analytics.uploadFrequencyPerWeek} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Speed />} label="Uploads/Month" value={analytics.uploadFrequencyPerMonth} gradient="cyan" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Timelapse />} label="Total Watch Time" value={fmtNum(analytics.estimatedTotalWatchTimeHours) + 'h'} subtitle="Estimated" gradient="indigo" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Timelapse />} label="Total Duration" value={analytics.totalDurationFormatted} gradient="amber" small />+ </Grid>+ </Grid>++ {/* Best Performing Videos */}+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2, mt: 1 }}>+ <EmojiEvents sx={{ verticalAlign: 'middle', mr: 1, color: '#FFD700' }} /> Best Performing Videos+ </Typography>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ {[+ { label: 'Most Viewed', video: analytics.bestByViews, color: '#FF0000' },+ { label: 'Most Liked', video: analytics.bestByLikes, color: '#4CAF50' },+ { label: 'Most Comments', video: analytics.bestByComments, color: '#3EA6FF' },+ { label: 'Best Engagement', video: analytics.bestByEngagement, color: '#FF9800' },+ ].map(({ label, video, color }) => video && (+ <Grid size={{ xs: 12, sm: 6, md: 3 }} key={label}>+ <Card sx={{ cursor: 'pointer', '&:hover': { transform: 'translateY(-2px)', transition: 'all 0.2s' } }}+ onClick={() => window.open(`https://www.youtube.com/watch?v=${video.videoId}`, '_blank', 'noopener')}>+ <Box sx={{ position: 'relative' }}>+ <Box component="img" src={video.thumbnail} sx={{ width: '100%', aspectRatio: '16/9', objectFit: 'cover' }} />+ <Chip label={label} size="small" sx={{ position: 'absolute', top: 8, left: 8, bgcolor: color, color: '#fff', fontWeight: 600 }} />+ <Box sx={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', bgcolor: 'rgba(0,0,0,0)', transition: 'all 0.2s', '&:hover': { bgcolor: 'rgba(0,0,0,0.4)' } }}>+ <PlayCircleOutline sx={{ fontSize: 40, color: '#fff', opacity: 0, transition: 'opacity 0.2s', '.MuiCard-root:hover &': { opacity: 1 } }} />+ </Box>+ </Box>+ <CardContent sx={{ p: 1.5, '&:last-child': { pb: 1.5 } }}>+ <Typography variant="body2" sx={{ fontWeight: 600, mb: 0.5, display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden' }}>+ {video.title}+ </Typography>+ <Box sx={{ display: 'flex', gap: 1.5, fontSize: 12, color: 'text.secondary', alignItems: 'center' }}>+ <span>{fmtNum(video.viewCount)} views</span>+ <span>{fmtNum(video.likeCount)} likes</span>+ <span>{fmtNum(video.commentCount)} comments</span>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ ))}+ </Grid>+ </Box>+ )}++ {/* TAB 1: Videos */}+ {tabValue === 1 && (+ <Box>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Top 10 Videos by Views+ </Typography>+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <ResponsiveContainer width="100%" height={350}>+ <BarChart data={(analytics.top10ByViews || []).map(v => ({ name: v?.title?.substring(0, 30) + '...', views: v?.viewCount || 0, likes: v?.likeCount || 0 }))}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#aaa', fontSize: 10 }} angle={-20} textAnchor="end" height={80} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} tickFormatter={fmtNum} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} formatter={v => fmtNumFull(v)} />+ <Bar dataKey="views" fill="#FF0000" radius={[6, 6, 0, 0]} name="Views" />+ <Bar dataKey="likes" fill="#4CAF50" radius={[6, 6, 0, 0]} name="Likes" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>++ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>All Videos</Typography>+ <Card>+ <TableContainer sx={{ maxHeight: 600 }}>+ <Table size="small" stickyHeader>+ <TableHead>+ <TableRow>+ <TableCell sx={{ bgcolor: '#1A1A1A' }}>#</TableCell>+ <TableCell sx={{ bgcolor: '#1A1A1A' }}>Video</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Views</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Likes</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Comments</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Engagement</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Duration</TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>Published</TableCell>+ <TableCell align="center" sx={{ bgcolor: '#1A1A1A', width: 50 }}>Watch</TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {(analytics.top10ByViews || []).concat(analytics.top10ByLikes || [])+ .filter((v, i, arr) => v && arr.findIndex(x => x?.videoId === v?.videoId) === i)+ .sort((a, b) => (b?.viewCount || 0) - (a?.viewCount || 0))+ .map((v, i) => v && (+ <TableRow key={v.videoId} hover sx={{ cursor: 'pointer' }}+ onClick={() => window.open(`https://www.youtube.com/watch?v=${v.videoId}`, '_blank', 'noopener')}>+ <TableCell>{i + 1}</TableCell>+ <TableCell>+ <Typography variant="body2" sx={{ fontWeight: 500, maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {v.title}+ </Typography>+ </TableCell>+ <TableCell align="right" sx={{ fontWeight: 600 }}>{fmtNum(v.viewCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.likeCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.commentCount)}</TableCell>+ <TableCell align="right">+ <Chip label={fmtPercent(v.engagementRate)} size="small"+ sx={{ bgcolor: parseFloat(v.engagementRate) > 5 ? 'rgba(76,175,80,0.15)' : 'rgba(255,255,255,0.05)', color: parseFloat(v.engagementRate) > 5 ? '#4CAF50' : 'text.secondary', fontWeight: 600, fontSize: 12 }} />+ </TableCell>+ <TableCell align="right">{fmtDuration(v.durationSeconds)}</TableCell>+ <TableCell align="right">+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>{fmtDate(v.publishedAt)}</Typography>+ </TableCell>+ <TableCell align="center">+ <Tooltip title="Watch on YouTube">+ <IconButton size="small" onClick={(e) => { e.stopPropagation(); window.open(`https://www.youtube.com/watch?v=${v.videoId}`, '_blank', 'noopener'); }}+ sx={{ color: '#FF0000', '&:hover': { bgcolor: 'rgba(255,0,0,0.1)' } }}>+ <PlayCircleOutline fontSize="small" />+ </IconButton>+ </Tooltip>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </TableContainer>+ </Card>+ </Box>+ )}++ {/* TAB 2: Engagement */}+ {tabValue === 2 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<ThumbUp />} label="Total Engagement" value={fmtNum(analytics.totalEngagement)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<TrendingUp />} label="Engagement Rate" value={fmtPercent(analytics.overallEngagementRate)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<ThumbUp />} label="Avg Like Rate" value={analytics.totalViews > 0 ? fmtPercent((analytics.totalLikes / analytics.totalViews * 100)) : '0%'} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<Comment />} label="Avg Comment Rate" value={analytics.totalViews > 0 ? fmtPercent((analytics.totalComments / analytics.totalViews * 100)) : '0%'} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<Whatshot />} label="Virality Score" value={`${analytics.viralityScore}x`} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<SignalCellularAlt />} label="Like/Comment Ratio" value={analytics.totalComments > 0 ? (analytics.totalLikes / analytics.totalComments).toFixed(1) + ':1' : 'N/A'} gradient="teal" small />+ </Grid>+ </Grid>++ <Grid container spacing={2.5}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Engagement Rate Trend</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <AreaChart data={(analytics.engagementTrend || [])}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="month" tick={{ fill: '#aaa', fontSize: 11 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 11 }} tickFormatter={v => v + '%'} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Area type="monotone" dataKey="value" stroke="#4CAF50" fill="rgba(76,175,80,0.15)" strokeWidth={2} name="Engagement %" />+ </AreaChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Like Rate Trend</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <AreaChart data={(analytics.likeRateTrend || [])}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="month" tick={{ fill: '#aaa', fontSize: 11 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 11 }} tickFormatter={v => v + '%'} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Area type="monotone" dataKey="value" stroke="#FF0000" fill="rgba(255,0,0,0.1)" strokeWidth={2} name="Like Rate %" />+ </AreaChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ <Card sx={{ mt: 2.5 }}>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Top 10 by Engagement Rate</Typography>+ <TableContainer>+ <Table size="small">+ <TableHead>+ <TableRow>+ <TableCell>#</TableCell>+ <TableCell>Video</TableCell>+ <TableCell align="right">Views</TableCell>+ <TableCell align="right">Likes</TableCell>+ <TableCell align="right">Comments</TableCell>+ <TableCell align="right">Engagement Rate</TableCell>+ <TableCell align="center" sx={{ width: 50 }}>Watch</TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {(analytics.top10ByEngagement || []).map((v, i) => v && (+ <TableRow key={v.videoId} hover sx={{ cursor: 'pointer' }}+ onClick={() => window.open(`https://www.youtube.com/watch?v=${v.videoId}`, '_blank', 'noopener')}>+ <TableCell>{i + 1}</TableCell>+ <TableCell>+ <Typography variant="body2" sx={{ fontWeight: 500, maxWidth: 350, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {v.title}+ </Typography>+ </TableCell>+ <TableCell align="right">{fmtNum(v.viewCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.likeCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.commentCount)}</TableCell>+ <TableCell align="right">+ <Chip label={fmtPercent(v.engagementRate)} size="small"+ sx={{ bgcolor: 'rgba(76,175,80,0.15)', color: '#4CAF50', fontWeight: 600 }} />+ </TableCell>+ <TableCell align="center">+ <Tooltip title="Watch on YouTube">+ <IconButton size="small" onClick={(e) => { e.stopPropagation(); window.open(`https://www.youtube.com/watch?v=${v.videoId}`, '_blank', 'noopener'); }}+ sx={{ color: '#FF0000', '&:hover': { bgcolor: 'rgba(255,0,0,0.1)' } }}>+ <PlayCircleOutline fontSize="small" />+ </IconButton>+ </Tooltip>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </TableContainer>+ </CardContent>+ </Card>+ </Box>+ )}++ {/* TAB 3: Content */}+ {tabValue === 3 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<HighQuality />} label="HD Videos" value={analytics.hdCount} subtitle={fmtPercent(analytics.hdPercentage)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<ClosedCaption />} label="With Captions" value={analytics.captionCount} subtitle={fmtPercent(analytics.captionPercentage)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<WorkspacePremium />} label="Licensed" value={analytics.licensedCount} subtitle={fmtPercent(analytics.licensedPercentage)} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<VideoLibrary />} label="Embeddable" value={analytics.embeddableCount} subtitle={fmtPercent(analytics.embeddablePercentage)} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<People />} label="Made for Kids" value={analytics.madeForKidsCount} gradient="cyan" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2 }}>+ <StatCard icon={<Timelapse />} label="Avg Duration" value={analytics.avgDurationFormatted} gradient="amber" small />+ </Grid>+ </Grid>++ <Grid container spacing={2.5}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Duration Distribution</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <PieChart>+ <Pie data={durationData} dataKey="value" nameKey="name" cx="50%" cy="50%" outerRadius={100} innerRadius={55} paddingAngle={4}>+ {durationData.map((d, i) => <Cell key={i} fill={d.color} />)}+ </Pie>+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Legend />+ </PieChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Category Distribution</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <BarChart data={catData} layout="vertical">+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis type="number" tick={{ fill: '#aaa', fontSize: 12 }} />+ <YAxis dataKey="name" type="category" tick={{ fill: '#aaa', fontSize: 12 }} width={120} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Bar dataKey="value" fill="#3EA6FF" radius={[0, 6, 6, 0]} name="Videos" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* Views Distribution */}+ <Card sx={{ mt: 2.5 }}>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Views Distribution</Typography>+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={(analytics.viewsDistribution?.ranges || []).map((r, i) => ({ range: r, count: analytics.viewsDistribution.counts[i] || 0 }))}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="range" tick={{ fill: '#aaa', fontSize: 10 }} angle={-20} textAnchor="end" height={60} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Bar dataKey="count" fill="#FF9800" radius={[6, 6, 0, 0]} name="Videos" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Box>+ )}++ {/* TAB 4: Publishing */}+ {tabValue === 4 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<CalendarMonth />} label="Peak Publish Day" value={analytics.peakPublishDay || 'N/A'} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<AccessTime />} label="Peak Publish Hour" value={analytics.peakPublishHour !== undefined ? `${analytics.peakPublishHour}:00 UTC` : 'N/A'} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Speed />} label="Uploads/Week" value={analytics.uploadFrequencyPerWeek} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<WorkspacePremium />} label="Consistency" value={`${analytics.consistencyScore}/100`} gradient="purple" small />+ </Grid>+ </Grid>++ <Grid container spacing={2.5}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Publish Day Distribution</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <BarChart data={dayData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="day" tick={{ fill: '#aaa', fontSize: 12 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Bar dataKey="count" fill="#3EA6FF" radius={[6, 6, 0, 0]} name="Videos" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Publish Hour Distribution (UTC)</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <AreaChart data={hourData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="hour" tick={{ fill: '#aaa', fontSize: 11 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Area type="monotone" dataKey="count" stroke="#FF9800" fill="rgba(255,152,0,0.15)" strokeWidth={2} name="Videos" />+ </AreaChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ </Grid>+ </Box>+ )}++ {/* TAB 5: Growth */}+ {tabValue === 5 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<TrendingUp />} label="Est. Yearly Views" value={fmtNum(channel.estimatedYearlyViews)} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<People />} label="Est. Yearly Subs" value={fmtNum(channel.estimatedYearlySubGain)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Visibility />} label="Views/Day Avg" value={fmtNum(channel.avgViewsPerDay)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Subscriptions />} label="Subs/Day Avg" value={fmtNum(channel.avgSubGainPerDay)} gradient="purple" small />+ </Grid>+ </Grid>++ <Card sx={{ mb: 2.5 }}>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Monthly Views Trend</Typography>+ <ResponsiveContainer width="100%" height={350}>+ <AreaChart data={(analytics.viewsTrend || [])}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="month" tick={{ fill: '#aaa', fontSize: 11 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 11 }} tickFormatter={fmtNum} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} formatter={v => fmtNumFull(v)} />+ <Area type="monotone" dataKey="value" stroke="#FF0000" fill="rgba(255,0,0,0.1)" strokeWidth={2} name="Views" />+ </AreaChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>++ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Monthly Upload Count</Typography>+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={(analytics.viewsTrend || []).map(t => ({ month: t.month, uploads: t.count }))}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="month" tick={{ fill: '#aaa', fontSize: 11 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Bar dataKey="uploads" fill="#4CAF50" radius={[6, 6, 0, 0]} name="Uploads" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Box>+ )}++ {/* TAB 6: Shorts vs Regular */}+ {tabValue === 6 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Whatshot />} label="Shorts Count" value={analytics.shortsCount} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<VideoLibrary />} label="Regular Videos" value={analytics.regularCount} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Visibility />} label="Avg Short Views" value={fmtNum(analytics.avgShortViews)} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<Visibility />} label="Avg Regular Views" value={fmtNum(analytics.avgRegularViews)} gradient="green" small />+ </Grid>+ </Grid>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<ThumbUp />} label="Avg Short Likes" value={fmtNum(analytics.avgShortLikes)} gradient="pink" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<ThumbUp />} label="Avg Regular Likes" value={fmtNum(analytics.avgRegularLikes)} gradient="teal" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<BarChartIcon />} label="Shorts %" value={analytics.totalVideos > 0 ? fmtPercent(analytics.shortsCount / analytics.totalVideos * 100) : '0%'} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <StatCard icon={<BarChartIcon />} label="Regular %" value={analytics.totalVideos > 0 ? fmtPercent(analytics.regularCount / analytics.totalVideos * 100) : '0%'} gradient="indigo" small />+ </Grid>+ </Grid>++ <Grid container spacing={2.5}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Content Split</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <PieChart>+ <Pie+ data={[+ { name: 'Shorts', value: analytics.shortsCount, color: '#FF0000' },+ { name: 'Regular', value: analytics.regularCount, color: '#3EA6FF' },+ ].filter(d => d.value > 0)}+ dataKey="value" nameKey="name" cx="50%" cy="50%" outerRadius={100} innerRadius={55} paddingAngle={4}>+ {[{ color: '#FF0000' }, { color: '#3EA6FF' }].map((d, i) => <Cell key={i} fill={d.color} />)}+ </Pie>+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Legend />+ </PieChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Performance Comparison</Typography>+ <ResponsiveContainer width="100%" height={300}>+ <BarChart data={[+ { metric: 'Avg Views', Shorts: analytics.avgShortViews, Regular: analytics.avgRegularViews },+ { metric: 'Avg Likes', Shorts: analytics.avgShortLikes, Regular: analytics.avgRegularLikes },+ ]}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="metric" tick={{ fill: '#aaa', fontSize: 12 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} tickFormatter={fmtNum} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} formatter={v => fmtNumFull(v)} />+ <Bar dataKey="Shorts" fill="#FF0000" radius={[6, 6, 0, 0]} />+ <Bar dataKey="Regular" fill="#3EA6FF" radius={[6, 6, 0, 0]} />+ <Legend />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ </Grid>+ </Box>+ )}++ {/* TAB 7: Tags & SEO */}+ {tabValue === 7 && (+ <Box>+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<Tag />} label="Unique Tags" value={analytics.tagFrequency?.length || 0} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<ClosedCaption />} label="Caption Rate" value={fmtPercent(analytics.captionPercentage)} gradient="green" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<HighQuality />} label="HD Rate" value={fmtPercent(analytics.hdPercentage)} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 3 }}>+ <StatCard icon={<VideoLibrary />} label="Embeddable Rate" value={fmtPercent(analytics.embeddablePercentage)} gradient="orange" small />+ </Grid>+ </Grid>++ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>+ <Tag sx={{ verticalAlign: 'middle', mr: 1 }} /> Most Used Tags+ </Typography>+ <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>+ {(analytics.tagFrequency || []).map(({ tag, count }, i) => (+ <Chip key={i} label={`${tag} (${count})`} size="small" variant="outlined"+ sx={{+ borderColor: `rgba(${i < 5 ? '255,0,0' : i < 15 ? '62,166,255' : '170,170,170'},${0.4 - i * 0.012})`,+ color: i < 5 ? '#FF4444' : i < 15 ? '#3EA6FF' : '#aaa',+ fontWeight: i < 5 ? 600 : 400,+ fontSize: Math.max(11, 14 - i * 0.15),+ }} />+ ))}+ {(!analytics.tagFrequency || analytics.tagFrequency.length === 0) && (+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>No tags data available</Typography>+ )}+ </Box>+ </CardContent>+ </Card>++ {(analytics.tagFrequency || []).length > 0 && (+ <Card sx={{ mt: 2.5 }}>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Tag Usage Frequency</Typography>+ <ResponsiveContainer width="100%" height={400}>+ <BarChart data={(analytics.tagFrequency || []).slice(0, 20)} layout="vertical">+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis type="number" tick={{ fill: '#aaa', fontSize: 12 }} />+ <YAxis dataKey="tag" type="category" tick={{ fill: '#aaa', fontSize: 11 }} width={150} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }} />+ <Bar dataKey="count" fill="#FF0000" radius={[0, 6, 6, 0]} name="Usage Count" />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ )}+ </Box>+ )}+ </Box>+ );+}diff --git a/frontend/src/components/InstagramAnalytics.jsx b/frontend/src/components/InstagramAnalytics.jsxnew file mode 100644index 0000000..2a26ab9--- /dev/null+++ b/frontend/src/components/InstagramAnalytics.jsx@@ -0,0 +1,641 @@+import React, { useState, useEffect } from 'react';+import {+ Box, Typography, Grid, Card, CardContent, Button, Avatar, Chip,+ CircularProgress, LinearProgress, IconButton, Tooltip, Divider,+ Table, TableBody, TableCell, TableContainer, TableHead, TableRow,+} from '@mui/material';+import {+ Instagram, ArrowBack, Refresh, Favorite, ChatBubble, People,+ PersonAdd, Photo, Collections, Movie, Link as LinkIcon, OpenInNew,+ TrendingUp, CalendarMonth, Schedule, Speed, Star, ThumbDown,+ Tag, Notes, BarChart as BarChartIcon, Whatshot, WorkspacePremium,+ QueryStats,+} from '@mui/icons-material';+import {+ BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip as ReTooltip,+ ResponsiveContainer, PieChart, Pie, Cell, Legend, LineChart, Line,+ AreaChart, Area,+} from 'recharts';+import StatCard from './StatCard';+import { fmtNum, fmtNumFull, fmtDate, timeAgo } from '../utils/formatters';+import { api } from '../services/api';++const IG_GRADIENT = 'linear-gradient(135deg, #F58529, #DD2A7B, #8134AF, #515BD4)';+const IG_COLORS = ['#F58529', '#DD2A7B', '#8134AF', '#515BD4', '#FEDA77', '#405DE6'];+const MEDIA_TYPE_NAMES = { IMAGE: 'Photos', VIDEO: 'Videos', CAROUSEL_ALBUM: 'Carousels', REEL: 'Reels' };+const MEDIA_TYPE_COLORS = { IMAGE: '#F58529', VIDEO: '#DD2A7B', CAROUSEL_ALBUM: '#8134AF', REEL: '#515BD4' };++const chartTooltipStyle = { background: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 };++export default function InstagramAnalytics({ account, showToast, onBack }) {+ const [loading, setLoading] = useState(true);+ const [profile, setProfile] = useState(null);+ const [analytics, setAnalytics] = useState(null);+ const [refreshing, setRefreshing] = useState(false);++ const loadAnalytics = async () => {+ setLoading(true);+ try {+ const data = await api.getIGAnalytics(account.id);+ setProfile(data.profile);+ setAnalytics(data.analytics);+ } catch (err) {+ showToast('Failed to load Instagram analytics: ' + err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => { loadAnalytics(); }, [account.id]);++ const handleRefresh = async () => {+ setRefreshing(true);+ try {+ await api.refreshAccount(account.id);+ await loadAnalytics();+ showToast('Instagram account refreshed!');+ } catch (err) {+ showToast('Refresh failed: ' + err.message, 'error');+ } finally {+ setRefreshing(false);+ }+ };++ if (loading) {+ return (+ <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '50vh' }}>+ <CircularProgress sx={{ color: '#DD2A7B' }} />+ </Box>+ );+ }++ const p = profile || account;+ const a = analytics || {};++ const mediaTypeData = a.mediaTypeDistribution+ ? Object.entries(a.mediaTypeDistribution).map(([key, value], i) => ({+ name: MEDIA_TYPE_NAMES[key] || key,+ value,+ color: MEDIA_TYPE_COLORS[key] || IG_COLORS[i % IG_COLORS.length],+ }))+ : [];++ const topPostsData = (a.topPosts || []).slice(0, 8).map((post, i) => ({+ name: `#${i + 1}`,+ likes: post.likeCount,+ comments: post.commentsCount,+ total: post.likeCount + post.commentsCount,+ }));++ const perfByTypeData = a.performanceByType+ ? Object.entries(a.performanceByType).map(([type, s]) => ({+ name: MEDIA_TYPE_NAMES[type] || type,+ avgLikes: s.avgLikes,+ avgComments: s.avgComments,+ count: s.count,+ color: MEDIA_TYPE_COLORS[type] || '#999',+ }))+ : [];++ const dayOfWeekData = (a.postsByDayOfWeek || []).map(d => ({+ name: d.shortDay, posts: d.posts,+ avgEngagement: d.avgEngagement,+ avgLikes: d.avgLikes,+ }));++ const timelineData = (a.engagementTimeline || []).map(m => ({+ name: m.month, posts: m.posts,+ likes: m.likes, comments: m.comments,+ avgLikes: m.avgLikes, engagement: m.engagement,+ }));++ const captionData = a.captionLengthCorrelation || [];++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', mb: 3 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>+ <Button variant="outlined" onClick={onBack}+ sx={{ borderColor: 'rgba(255,255,255,0.15)', minWidth: 40, p: 1 }}>+ <ArrowBack />+ </Button>+ <Avatar src={p.profilePictureUrl} sx={{ width: 56, height: 56, border: '3px solid #DD2A7B' }}>+ <Instagram />+ </Avatar>+ <Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>{p.name || p.username}</Typography>+ <Instagram sx={{ color: '#DD2A7B' }} />+ </Box>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>+ @{p.username}+ {p.website && (+ <Chip icon={<LinkIcon sx={{ fontSize: 14 }} />} label={p.website}+ size="small" clickable component="a" href={p.website} target="_blank"+ sx={{ ml: 1, fontSize: 11, height: 22 }} />+ )}+ </Typography>+ {p.biography && (+ <Typography variant="caption" sx={{ color: 'text.secondary', mt: 0.5, display: 'block', maxWidth: 500 }}>+ {p.biography}+ </Typography>+ )}+ </Box>+ </Box>+ <Button variant="contained" startIcon={refreshing ? <CircularProgress size={16} /> : <Refresh />}+ onClick={handleRefresh} disabled={refreshing}+ sx={{ background: IG_GRADIENT }}>+ Refresh+ </Button>+ </Box>++ {refreshing && <LinearProgress sx={{ mb: 2, borderRadius: 1, '& .MuiLinearProgress-bar': { background: IG_GRADIENT } }} />}++ {/* ROW 1: Key Stats */}+ <Grid container spacing={2} sx={{ mb: 2.5 }}>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<People />} label="Followers" value={fmtNum(p.followersCount)}+ subtitle={fmtNumFull(p.followersCount)} gradient="purple" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<PersonAdd />} label="Following" value={fmtNum(p.followsCount)}+ subtitle={fmtNumFull(p.followsCount)} gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Photo />} label="Total Posts" value={fmtNum(a.totalPosts || p.mediaCount)}+ subtitle={`${a.fetchedPosts || 0} analyzed`} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Favorite />} label="Total Likes" value={fmtNum(a.totalLikes)}+ subtitle={fmtNumFull(a.totalLikes)} gradient="red" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<ChatBubble />} label="Total Comments" value={fmtNum(a.totalComments)}+ subtitle={fmtNumFull(a.totalComments)} gradient="teal" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<TrendingUp />} label="Engagement Rate" value={`${a.engagementRate || 0}%`}+ subtitle={`Avg ${fmtNum(a.avgLikes)} likes/post`} gradient="green" small />+ </Grid>+ </Grid>++ {/* ROW 2: Averages & Medians */}+ <Grid container spacing={2} sx={{ mb: 2.5 }}>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Speed />} label="Avg Likes/Post" value={fmtNum(a.avgLikes)} gradient="cyan" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<ChatBubble />} label="Avg Comments" value={fmtNum(a.avgComments)} gradient="indigo" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<QueryStats />} label="Median Likes" value={fmtNum(a.medianLikes)} gradient="amber" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<People />} label="Follower Ratio"+ value={p.followersCount > 0 ? (p.followersCount / Math.max(1, p.followsCount)).toFixed(1) : '0'}+ subtitle="Followers / Following" gradient="pink" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Favorite />} label="Likes/Follower" value={`${a.likesPerFollower || 0}%`}+ subtitle="Per post avg" gradient="red" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<TrendingUp />} label="Like:Comment" value={`${a.likesToCommentsRatio || 0}:1`}+ subtitle="Ratio" gradient="blue" small />+ </Grid>+ </Grid>++ {/* ROW 3: Activity & Scores */}+ <Grid container spacing={2} sx={{ mb: 2.5 }}>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Schedule />} label="Posts/Week" value={a.postFrequency?.perWeek || 0}+ subtitle={`${a.postFrequency?.perMonth || 0}/month`} gradient="orange" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<CalendarMonth />} label="Last 7 Days" value={a.postsLast7Days || 0}+ subtitle="Recent posts" gradient="red" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<CalendarMonth />} label="Last 30 Days" value={a.postsLast30Days || 0}+ subtitle="Monthly" gradient="green" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<CalendarMonth />} label="Last 90 Days" value={a.postsLast90Days || 0}+ subtitle="Quarterly" gradient="blue" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<Whatshot />} label="Virality Score" value={`${a.viralityScore || 0}x`}+ subtitle="Best vs Average" gradient="pink" small />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 2 }}>+ <StatCard icon={<WorkspacePremium />} label="Consistency" value={`${a.consistencyScore || 0}/100`}+ subtitle="Engagement stability" gradient="amber" small />+ </Grid>+ </Grid>++ {/* Best posting day & hour */}+ {(a.bestPostingDay || a.bestPostingHour) && (+ <Card sx={{ mb: 2.5, p: 2 }}>+ <Box sx={{ display: 'flex', gap: 3, flexWrap: 'wrap' }}>+ {a.bestPostingDay && (+ <Chip icon={<Star sx={{ color: '#FFD700 !important' }} />}+ label={`Best Day: ${a.bestPostingDay}`}+ sx={{ fontSize: 13, fontWeight: 600, height: 32 }} />+ )}+ {a.bestPostingHour && (+ <Chip icon={<Schedule sx={{ color: '#4CAF50 !important' }} />}+ label={`Best Hour: ${a.bestPostingHour}`}+ sx={{ fontSize: 13, fontWeight: 600, height: 32 }} />+ )}+ <Chip icon={<TrendingUp sx={{ color: '#2196F3 !important' }} />}+ label={`Avg Engagement: ${fmtNum(a.avgEngagement || 0)}/post`}+ sx={{ fontSize: 13, fontWeight: 600, height: 32 }} />+ </Box>+ </Card>+ )}++ {/* CHARTS ROW 1: Engagement Timeline + Content Mix */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ <Grid size={{ xs: 12, md: 8 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Engagement Timeline+ </Typography>+ {timelineData.length > 0 ? (+ <ResponsiveContainer width="100%" height={300}>+ <AreaChart data={timelineData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#999', fontSize: 11 }} />+ <YAxis tick={{ fill: '#999', fontSize: 11 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Area type="monotone" dataKey="likes" name="Likes" stroke="#DD2A7B" fill="rgba(221,42,123,0.2)" />+ <Area type="monotone" dataKey="comments" name="Comments" stroke="#8134AF" fill="rgba(129,52,175,0.2)" />+ </AreaChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ Not enough data for timeline+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 4 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Content Type Mix+ </Typography>+ {mediaTypeData.length > 0 ? (+ <ResponsiveContainer width="100%" height={300}>+ <PieChart>+ <Pie data={mediaTypeData} dataKey="value" nameKey="name"+ cx="50%" cy="50%" outerRadius={70} innerRadius={35}+ label={({ cx, cy, midAngle, outerRadius, name, value }) => {+ const RADIAN = Math.PI / 180;+ const radius = outerRadius + 18;+ const x = cx + radius * Math.cos(-midAngle * RADIAN);+ const y = cy + radius * Math.sin(-midAngle * RADIAN);+ return (+ <text x={x} y={y} fill="#ccc" fontSize={11} fontWeight={500}+ textAnchor={x > cx ? 'start' : 'end'} dominantBaseline="central">+ {`${value}`}+ </text>+ );+ }}+ labelLine={{ strokeWidth: 1, stroke: '#666' }}>+ {mediaTypeData.map((entry, i) => (+ <Cell key={i} fill={entry.color} />+ ))}+ </Pie>+ <Legend wrapperStyle={{ fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle}+ formatter={(value, name) => [`${value} posts`, name]} />+ </PieChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No data+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* CHARTS ROW 2: Performance by Type + Day of Week */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Performance by Content Type+ </Typography>+ {perfByTypeData.length > 0 ? (+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={perfByTypeData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#999', fontSize: 12 }} />+ <YAxis tick={{ fill: '#999', fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Bar dataKey="avgLikes" name="Avg Likes" fill="#DD2A7B" radius={[4, 4, 0, 0]} />+ <Bar dataKey="avgComments" name="Avg Comments" fill="#8134AF" radius={[4, 4, 0, 0]} />+ </BarChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No data+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Best Posting Days+ </Typography>+ {dayOfWeekData.length > 0 ? (+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={dayOfWeekData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#999', fontSize: 12 }} />+ <YAxis tick={{ fill: '#999', fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Bar dataKey="avgEngagement" name="Avg Engagement" fill="#F58529" radius={[4, 4, 0, 0]} />+ <Bar dataKey="posts" name="Posts" fill="rgba(255,255,255,0.15)" radius={[4, 4, 0, 0]} />+ </BarChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No data+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* CHARTS ROW 3: Top Posts Bar + Caption Length Analysis */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Top Posts by Engagement+ </Typography>+ {topPostsData.length > 0 ? (+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={topPostsData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#999', fontSize: 12 }} />+ <YAxis tick={{ fill: '#999', fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Bar dataKey="likes" name="Likes" fill="#DD2A7B" radius={[4, 4, 0, 0]} />+ <Bar dataKey="comments" name="Comments" fill="#8134AF" radius={[4, 4, 0, 0]} />+ </BarChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No data+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Caption Length vs Engagement+ </Typography>+ {captionData.length > 0 ? (+ <ResponsiveContainer width="100%" height={280}>+ <BarChart data={captionData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="label" tick={{ fill: '#999', fontSize: 11 }} />+ <YAxis tick={{ fill: '#999', fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Bar dataKey="avgEngagement" name="Avg Engagement" fill="#515BD4" radius={[4, 4, 0, 0]} />+ </BarChart>+ </ResponsiveContainer>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No data+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* Monthly Posting Volume */}+ {timelineData.length > 1 && (+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Monthly Posting Volume+ </Typography>+ <ResponsiveContainer width="100%" height={250}>+ <BarChart data={timelineData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#999', fontSize: 11 }} />+ <YAxis tick={{ fill: '#999', fontSize: 12 }} />+ <ReTooltip contentStyle={chartTooltipStyle} />+ <Bar dataKey="posts" name="Posts" fill="#F58529" radius={[4, 4, 0, 0]} />+ </BarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ )}++ {/* Top Hashtags */}+ {(a.hashtagAnalysis || []).length > 0 && (+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ <Tag sx={{ verticalAlign: 'middle', mr: 1, color: '#DD2A7B' }} />+ Top Hashtags+ </Typography>+ <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>+ {a.hashtagAnalysis.slice(0, 20).map((h, i) => (+ <Tooltip key={h.tag} title={`Used ${h.count}x \u2022 Avg engagement: ${fmtNum(h.avgEngagement)}`}>+ <Chip label={`${h.tag} (${h.count})`}+ sx={{+ fontSize: 12, fontWeight: 500,+ bgcolor: `${IG_COLORS[i % IG_COLORS.length]}22`,+ borderColor: IG_COLORS[i % IG_COLORS.length],+ color: IG_COLORS[i % IG_COLORS.length],+ }}+ variant="outlined" />+ </Tooltip>+ ))}+ </Box>+ </CardContent>+ </Card>+ )}++ {/* Recent Media Grid */}+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Recent Posts ({a.fetchedPosts || 0} loaded)+ </Typography>+ {(a.recentMedia || []).length > 0 ? (+ <Grid container spacing={2}>+ {a.recentMedia.map((post) => (+ <Grid size={{ xs: 6, sm: 4, md: 3, lg: 2 }} key={post.id}>+ <Card sx={{+ position: 'relative', overflow: 'hidden', cursor: 'pointer',+ '&:hover': { transform: 'translateY(-2px)', transition: 'all 0.2s' },+ '&:hover .media-overlay': { opacity: 1 },+ }}+ onClick={() => post.permalink && window.open(post.permalink, '_blank')}>+ <Box sx={{+ width: '100%', paddingTop: '100%', position: 'relative',+ bgcolor: 'rgba(255,255,255,0.05)',+ }}>+ <Box component="img"+ src={post.thumbnailUrl || post.mediaUrl}+ sx={{+ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%',+ objectFit: 'cover',+ }}+ onError={(e) => { e.target.style.display = 'none'; }}+ />+ {post.mediaType !== 'IMAGE' && (+ <Chip label={MEDIA_TYPE_NAMES[post.mediaType] || post.mediaType}+ size="small"+ sx={{+ position: 'absolute', top: 8, right: 8,+ bgcolor: 'rgba(0,0,0,0.7)', color: '#fff', fontSize: 10, height: 20,+ }} />+ )}+ </Box>+ <Box className="media-overlay" sx={{+ position: 'absolute', bottom: 0, left: 0, right: 0,+ background: 'linear-gradient(transparent, rgba(0,0,0,0.8))',+ p: 1, opacity: 0, transition: 'opacity 0.2s',+ display: 'flex', justifyContent: 'center', gap: 2,+ }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5, color: '#fff' }}>+ <Favorite sx={{ fontSize: 14 }} />+ <Typography variant="caption" sx={{ fontWeight: 600 }}>{fmtNum(post.likeCount)}</Typography>+ </Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5, color: '#fff' }}>+ <ChatBubble sx={{ fontSize: 14 }} />+ <Typography variant="caption" sx={{ fontWeight: 600 }}>{fmtNum(post.commentsCount)}</Typography>+ </Box>+ </Box>+ </Card>+ </Grid>+ ))}+ </Grid>+ ) : (+ <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center', py: 4 }}>+ No posts found+ </Typography>+ )}+ </CardContent>+ </Card>++ {/* Top Posts Table */}+ {(a.topPosts || []).length > 0 && (+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Top Performing Posts+ </Typography>+ <TableContainer>+ <Table size="small">+ <TableHead>+ <TableRow>+ <TableCell sx={{ fontWeight: 600 }}>#</TableCell>+ <TableCell sx={{ fontWeight: 600 }}>Caption</TableCell>+ <TableCell sx={{ fontWeight: 600 }}>Type</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Likes</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Comments</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Engagement</TableCell>+ <TableCell sx={{ fontWeight: 600 }}>Date</TableCell>+ <TableCell></TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {a.topPosts.slice(0, 10).map((post, i) => (+ <TableRow key={post.id} hover>+ <TableCell>{i + 1}</TableCell>+ <TableCell sx={{ maxWidth: 250, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {post.caption || '(no caption)'}+ </TableCell>+ <TableCell>+ <Chip label={MEDIA_TYPE_NAMES[post.mediaType] || post.mediaType} size="small"+ sx={{ fontSize: 10, height: 20, bgcolor: `${MEDIA_TYPE_COLORS[post.mediaType] || '#999'}33`, color: MEDIA_TYPE_COLORS[post.mediaType] || '#999' }} />+ </TableCell>+ <TableCell align="right">{fmtNum(post.likeCount)}</TableCell>+ <TableCell align="right">{fmtNum(post.commentsCount)}</TableCell>+ <TableCell align="right">{fmtNum(post.engagement)}</TableCell>+ <TableCell>{fmtDate(post.timestamp)}</TableCell>+ <TableCell>+ {post.permalink && (+ <IconButton size="small" onClick={() => window.open(post.permalink, '_blank')}>+ <OpenInNew fontSize="small" />+ </IconButton>+ )}+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </TableContainer>+ </CardContent>+ </Card>+ )}++ {/* Performance by Type Table */}+ {perfByTypeData.length > 0 && (+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Performance Summary by Content Type+ </Typography>+ <TableContainer>+ <Table size="small">+ <TableHead>+ <TableRow>+ <TableCell sx={{ fontWeight: 600 }}>Type</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Count</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Avg Likes</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Avg Comments</TableCell>+ <TableCell sx={{ fontWeight: 600 }} align="right">Avg Engagement</TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {perfByTypeData.map(row => (+ <TableRow key={row.name} hover>+ <TableCell>+ <Chip label={row.name} size="small"+ sx={{ fontSize: 11, height: 22, bgcolor: `${row.color}33`, color: row.color }} />+ </TableCell>+ <TableCell align="right">{row.count}</TableCell>+ <TableCell align="right">{fmtNum(row.avgLikes)}</TableCell>+ <TableCell align="right">{fmtNum(row.avgComments)}</TableCell>+ <TableCell align="right">{fmtNum(row.avgLikes + row.avgComments)}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </TableContainer>+ </CardContent>+ </Card>+ )}++ {/* Last Updated */}+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', textAlign: 'center', mt: 3 }}>+ Last updated: {timeAgo(account.lastUpdated)}+ </Typography>+ </Box>+ );+}diff --git a/frontend/src/components/Logo.jsx b/frontend/src/components/Logo.jsxnew file mode 100644index 0000000..97d7144--- /dev/null+++ b/frontend/src/components/Logo.jsx@@ -0,0 +1,70 @@+import React from 'react';+import { Box } from '@mui/material';++export default function Logo({ size = 40 }) {+ return (+ <Box+ sx={{+ width: size,+ height: size,+ flexShrink: 0,+ position: 'relative',+ }}+ >+ <svg+ width={size}+ height={size}+ viewBox="0 0 120 120"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ {/* Background circle with gradient */}+ <defs>+ <linearGradient id="logoBg" x1="0" y1="0" x2="120" y2="120" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stopColor="#FF0000" />+ <stop offset="100%" stopColor="#CC0000" />+ </linearGradient>+ <linearGradient id="barGrad1" x1="0" y1="100" x2="0" y2="30" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stopColor="#FFFFFF" stopOpacity="0.95" />+ <stop offset="100%" stopColor="#FFFFFF" stopOpacity="0.7" />+ </linearGradient>+ <linearGradient id="playGrad" x1="70" y1="20" x2="110" y2="55" gradientUnits="userSpaceOnUse">+ <stop offset="0%" stopColor="#FFFFFF" />+ <stop offset="100%" stopColor="#FFD4D4" />+ </linearGradient>+ <filter id="shadow" x="-4" y="-2" width="128" height="128">+ <feDropShadow dx="0" dy="2" stdDeviation="3" floodColor="#000" floodOpacity="0.25" />+ </filter>+ </defs>++ {/* Main circle */}+ <rect width="120" height="120" rx="28" fill="url(#logoBg)" filter="url(#shadow)" />++ {/* Analytics bars */}+ <rect x="18" y="72" width="16" height="26" rx="4" fill="url(#barGrad1)" opacity="0.9" />+ <rect x="40" y="52" width="16" height="46" rx="4" fill="url(#barGrad1)" opacity="0.95" />+ <rect x="62" y="36" width="16" height="62" rx="4" fill="url(#barGrad1)" />++ {/* Upward trend line */}+ <path+ d="M26 68 L48 48 L70 32"+ stroke="#FFFFFF"+ strokeWidth="4"+ strokeLinecap="round"+ strokeLinejoin="round"+ fill="none"+ opacity="0.6"+ />++ {/* Play button triangle (YouTube) */}+ <g transform="translate(82, 18)">+ <rect width="30" height="22" rx="5" fill="rgba(255,255,255,0.2)" />+ <path d="M11 5 L23 11 L11 17Z" fill="url(#playGrad)" />+ </g>++ {/* Subtle dot accent */}+ <circle cx="70" cy="32" r="4" fill="#FFFFFF" opacity="0.9" />+ </svg>+ </Box>+ );+}diff --git a/frontend/src/components/Overview.jsx b/frontend/src/components/Overview.jsxnew file mode 100644index 0000000..a720604--- /dev/null+++ b/frontend/src/components/Overview.jsx@@ -0,0 +1,282 @@+import React from 'react';+import {+ Box, Typography, Grid, Card, CardContent, Button, Avatar, Chip,+ LinearProgress, Table, TableBody, TableCell, TableContainer, TableHead, TableRow,+ IconButton, Tooltip, Paper, Divider,+} from '@mui/material';+import {+ Visibility, People, VideoLibrary, YouTube, Refresh, TrendingUp,+ EmojiEvents, OpenInNew, Speed, BarChart, Instagram, Favorite, Photo,+} from '@mui/icons-material';+import {+ BarChart as ReBarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip as ReTooltip,+ ResponsiveContainer, PieChart, Pie, Cell, Legend,+} from 'recharts';+import StatCard from './StatCard';+import { fmtNum, fmtNumFull, fmtDate, timeAgo } from '../utils/formatters';++const COLORS = ['#FF0000', '#3EA6FF', '#4CAF50', '#FF9800', '#AB47BC', '#26A69A', '#EC407A', '#5C6BC0'];++export default function Overview({ accounts, onViewChannel, onRefreshAll, loading }) {+ const ytAccounts = accounts.filter(a => a.platform !== 'instagram');+ const igAccounts = accounts.filter(a => a.platform === 'instagram');++ const totals = accounts.reduce((acc, a) => {+ if (a.platform === 'instagram') {+ return {+ ...acc,+ followers: acc.followers + (a.followersCount || 0),+ posts: acc.posts + (a.mediaCount || 0),+ };+ }+ return {+ ...acc,+ subscribers: acc.subscribers + (a.subscriberCount || 0),+ views: acc.views + (a.viewCount || 0),+ videos: acc.videos + (a.videoCount || 0),+ };+ }, { subscribers: 0, views: 0, videos: 0, followers: 0, posts: 0 });++ const totalAudience = totals.subscribers + totals.followers;++ const sorted = {+ byAudience: [...accounts].sort((a, b) => (b.subscriberCount || b.followersCount || 0) - (a.subscriberCount || a.followersCount || 0)),+ byContent: [...accounts].sort((a, b) => (b.viewCount || b.mediaCount || 0) - (a.viewCount || a.mediaCount || 0)),+ };++ const chartData = accounts.map(a => ({+ name: a.title?.length > 20 ? a.title.substring(0, 20) + '...' : a.title,+ audience: a.subscriberCount || a.followersCount || 0,+ platform: a.platform || 'youtube',+ }));++ const pieData = accounts.map((a, i) => ({+ name: a.title?.length > 15 ? a.title.substring(0, 15) + '...' : a.title,+ value: a.subscriberCount || a.followersCount || 0,+ color: COLORS[i % COLORS.length],+ }));++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', mb: 3 }}>+ <Box>+ <Typography variant="h4" sx={{ fontWeight: 700, mb: 0.5 }}>Dashboard Overview</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>+ Combined analytics across {accounts.length} account{accounts.length !== 1 ? 's' : ''}+ {ytAccounts.length > 0 && igAccounts.length > 0 && ` (${ytAccounts.length} YouTube, ${igAccounts.length} Instagram)`}+ </Typography>+ </Box>+ <Button variant="contained" startIcon={<Refresh />} onClick={onRefreshAll}+ disabled={loading || accounts.length === 0}+ sx={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>+ {loading ? 'Refreshing...' : 'Refresh All'}+ </Button>+ </Box>++ {loading && <LinearProgress sx={{ mb: 2, borderRadius: 1 }} color="error" />}++ {/* KPI Cards */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ <Grid size={{ xs: 12, sm: 6, md: 3 }}>+ <StatCard icon={<People />} label="Total Audience" value={fmtNum(totalAudience)}+ subtitle={`${fmtNum(totals.subscribers)} subs + ${fmtNum(totals.followers)} followers`} gradient="green" />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 3 }}>+ <StatCard icon={<Visibility />} label="Total YT Views" value={fmtNum(totals.views)}+ subtitle={fmtNumFull(totals.views)} gradient="red" />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 3 }}>+ <StatCard icon={<VideoLibrary />} label="Total Content" value={fmtNum(totals.videos + totals.posts)}+ subtitle={`${fmtNum(totals.videos)} videos + ${fmtNum(totals.posts)} posts`} gradient="orange" />+ </Grid>+ <Grid size={{ xs: 12, sm: 6, md: 3 }}>+ <StatCard icon={<BarChart />} label="Accounts" value={accounts.length}+ subtitle={`${ytAccounts.length} YT · ${igAccounts.length} IG`} gradient="purple" />+ </Grid>+ </Grid>++ {accounts.length === 0 ? (+ <Card sx={{ p: 6, textAlign: 'center' }}>+ <People sx={{ fontSize: 64, color: 'text.secondary', mb: 2 }} />+ <Typography variant="h5" sx={{ mb: 1 }}>Welcome to Social Media Analytics</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 2 }}>+ Add your first YouTube channel or Instagram account to start tracking analytics+ </Typography>+ </Card>+ ) : (+ <>+ {/* Charts Row */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ <Grid size={{ xs: 12, md: 8 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>+ <BarChart sx={{ verticalAlign: 'middle', mr: 1, color: 'primary.main' }} />+ Audience Comparison+ </Typography>+ <ResponsiveContainer width="100%" height={320}>+ <ReBarChart data={chartData}>+ <CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.06)" />+ <XAxis dataKey="name" tick={{ fill: '#aaa', fontSize: 12 }} />+ <YAxis tick={{ fill: '#aaa', fontSize: 12 }} tickFormatter={fmtNum} />+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }}+ formatter={(v) => fmtNumFull(v)} />+ <Bar dataKey="audience" fill="#667eea" radius={[6, 6, 0, 0]} name="Audience" />+ </ReBarChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ <Grid size={{ xs: 12, md: 4 }}>+ <Card sx={{ height: '100%' }}>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>Audience Share</Typography>+ <ResponsiveContainer width="100%" height={280}>+ <PieChart>+ <Pie data={pieData} dataKey="value" nameKey="name" cx="50%" cy="50%"+ outerRadius={90} innerRadius={50} paddingAngle={3}>+ {pieData.map((entry, i) => (+ <Cell key={i} fill={entry.color} />+ ))}+ </Pie>+ <ReTooltip contentStyle={{ backgroundColor: '#1A1A1A', border: '1px solid rgba(255,255,255,0.1)', borderRadius: 8 }}+ formatter={(v) => fmtNumFull(v)} />+ <Legend />+ </PieChart>+ </ResponsiveContainer>+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* Account Rankings */}+ <Grid container spacing={2.5} sx={{ mb: 3 }}>+ {/* Top by Audience */}+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600, display: 'flex', alignItems: 'center', gap: 1 }}>+ <EmojiEvents sx={{ color: '#FFD700' }} /> Top by Audience+ </Typography>+ {sorted.byAudience.map((a, i) => {+ const isIG = a.platform === 'instagram';+ return (+ <Box key={a.id} sx={{ display: 'flex', alignItems: 'center', gap: 1.5, py: 1, cursor: 'pointer', '&:hover': { bgcolor: 'rgba(255,255,255,0.03)' }, borderRadius: 1, px: 1 }}+ onClick={() => onViewChannel(a)}>+ <Typography sx={{ width: 24, fontWeight: 700, color: i === 0 ? '#FFD700' : i === 1 ? '#C0C0C0' : i === 2 ? '#CD7F32' : 'text.secondary', fontSize: 16 }}>+ {i + 1}+ </Typography>+ <Avatar src={a.thumbnail || a.profilePictureUrl || a.thumbnails?.default} sx={{ width: 32, height: 32 }} />+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="body2" noWrap sx={{ fontWeight: 500 }}>{a.title}</Typography>+ </Box>+ {isIG ? <Instagram sx={{ fontSize: 16, color: '#E1306C' }} /> : <YouTube sx={{ fontSize: 16, color: '#FF0000' }} />}+ <Chip label={fmtNum(isIG ? a.followersCount : a.subscriberCount)} size="small"+ sx={{ bgcolor: isIG ? 'rgba(225,48,108,0.15)' : 'rgba(76,175,80,0.15)', color: isIG ? '#E1306C' : '#4CAF50', fontWeight: 600 }} />+ </Box>+ );+ })}+ </CardContent>+ </Card>+ </Grid>++ {/* Top by Content */}+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600, display: 'flex', alignItems: 'center', gap: 1 }}>+ <TrendingUp sx={{ color: '#FF9800' }} /> Top by Content+ </Typography>+ {sorted.byContent.map((a, i) => {+ const isIG = a.platform === 'instagram';+ return (+ <Box key={a.id} sx={{ display: 'flex', alignItems: 'center', gap: 1.5, py: 1, cursor: 'pointer', '&:hover': { bgcolor: 'rgba(255,255,255,0.03)' }, borderRadius: 1, px: 1 }}+ onClick={() => onViewChannel(a)}>+ <Typography sx={{ width: 24, fontWeight: 700, color: i === 0 ? '#FFD700' : 'text.secondary', fontSize: 16 }}>+ {i + 1}+ </Typography>+ <Avatar src={a.thumbnail || a.profilePictureUrl || a.thumbnails?.default} sx={{ width: 32, height: 32 }} />+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="body2" noWrap sx={{ fontWeight: 500 }}>{a.title}</Typography>+ </Box>+ {isIG ? <Instagram sx={{ fontSize: 16, color: '#E1306C' }} /> : <YouTube sx={{ fontSize: 16, color: '#FF0000' }} />}+ <Chip label={isIG ? `${fmtNum(a.mediaCount)} posts` : `${fmtNum(a.viewCount)} views`} size="small"+ sx={{ bgcolor: isIG ? 'rgba(138,58,185,0.15)' : 'rgba(255,0,0,0.15)', color: isIG ? '#8134AF' : '#FF4444', fontWeight: 600 }} />+ </Box>+ );+ })}+ </CardContent>+ </Card>+ </Grid>+ </Grid>++ {/* All Accounts Table */}+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>All Accounts</Typography>+ <TableContainer>+ <Table size="small">+ <TableHead>+ <TableRow>+ <TableCell>#</TableCell>+ <TableCell>Account</TableCell>+ <TableCell align="center">Platform</TableCell>+ <TableCell align="right">Audience</TableCell>+ <TableCell align="right">Content</TableCell>+ <TableCell align="right">Last Updated</TableCell>+ <TableCell align="center">Actions</TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {sorted.byAudience.map((a, i) => {+ const isIG = a.platform === 'instagram';+ return (+ <TableRow key={a.id} hover sx={{ cursor: 'pointer' }} onClick={() => onViewChannel(a)}>+ <TableCell>{i + 1}</TableCell>+ <TableCell>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>+ <Avatar src={a.thumbnail || a.profilePictureUrl || a.thumbnails?.default} sx={{ width: 32, height: 32 }} />+ <Box>+ <Typography variant="body2" sx={{ fontWeight: 600 }}>{a.title}</Typography>+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>+ {isIG ? `@${a.username || a.igUsername}` : (a.customUrl || a.channelId)}+ </Typography>+ </Box>+ </Box>+ </TableCell>+ <TableCell align="center">+ {isIG ? <Instagram sx={{ color: '#E1306C', fontSize: 20 }} /> : <YouTube sx={{ color: '#FF0000', fontSize: 20 }} />}+ </TableCell>+ <TableCell align="right" sx={{ fontWeight: 600 }}>+ {fmtNum(isIG ? a.followersCount : a.subscriberCount)}+ <Typography variant="caption" sx={{ display: 'block', color: 'text.secondary' }}>+ {isIG ? 'followers' : 'subscribers'}+ </Typography>+ </TableCell>+ <TableCell align="right">+ {isIG ? `${fmtNum(a.mediaCount)} posts` : `${fmtNum(a.viewCount)} views / ${fmtNum(a.videoCount)} videos`}+ </TableCell>+ <TableCell align="right">+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>{timeAgo(a.lastUpdated)}</Typography>+ </TableCell>+ <TableCell align="center">+ <Tooltip title="View Analytics">+ <IconButton size="small" onClick={(e) => { e.stopPropagation(); onViewChannel(a); }}>+ <OpenInNew fontSize="small" />+ </IconButton>+ </Tooltip>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ </TableContainer>+ </CardContent>+ </Card>+ </>+ )}+ </Box>+ );+}diff --git a/frontend/src/components/ReelsExplorer.jsx b/frontend/src/components/ReelsExplorer.jsxnew file mode 100644index 0000000..fef3ce5--- /dev/null+++ b/frontend/src/components/ReelsExplorer.jsx@@ -0,0 +1,382 @@+import React, { useState, useEffect, useMemo } from 'react';+import {+ Box, Typography, Card, CardContent, Grid, TextField, InputAdornment,+ Select, MenuItem, FormControl, InputLabel, Chip, LinearProgress,+ Avatar, Button, Pagination, Skeleton,+} from '@mui/material';+import {+ Search, Visibility, FavoriteBorder, ChatBubbleOutline, PlayCircleOutline,+ Instagram, MovieFilter, Photo, Collections, ViewCarousel,+} from '@mui/icons-material';+import { api } from '../services/api';+import { fmtNum, fmtDate, timeAgo } from '../utils/formatters';++const ITEMS_PER_PAGE = 24;++const MEDIA_TYPE_FILTER = [+ { label: 'All Types', value: 'all' },+ { label: 'Reels', value: 'REEL' },+ { label: 'Videos', value: 'VIDEO' },+ { label: 'Photos', value: 'IMAGE' },+ { label: 'Carousels', value: 'CAROUSEL_ALBUM' },+];++const MEDIA_TYPE_META = {+ REEL: { label: 'Reel', color: '#E1306C', icon: <MovieFilter sx={{ fontSize: '13px !important', color: '#fff !important' }} /> },+ VIDEO: { label: 'Video', color: '#833AB4', icon: <PlayCircleOutline sx={{ fontSize: '13px !important', color: '#fff !important' }} /> },+ IMAGE: { label: 'Photo', color: '#F77737', icon: <Photo sx={{ fontSize: '13px !important', color: '#fff !important' }} /> },+ CAROUSEL_ALBUM: { label: 'Carousel', color: '#405DE6', icon: <ViewCarousel sx={{ fontSize: '13px !important', color: '#fff !important' }} /> },+};++const PERFORMANCE_TIERS = [+ { label: 'All', value: 'all' },+ { label: 'Viral (>100K)', value: 'viral', min: 100000 },+ { label: 'High (10K–100K)', value: 'high', min: 10000, max: 100000 },+ { label: 'Medium (1K–10K)', value: 'medium', min: 1000, max: 10000 },+ { label: 'Low (<1K)', value: 'low', max: 1000 },+];++const SORT_OPTIONS = [+ { label: 'Most Liked', field: 'likeCount' },+ { label: 'Most Comments', field: 'commentsCount' },+ { label: 'Best Engagement', field: 'engagementRate' },+ { label: 'Newest First', field: 'timestamp' },+];++export default function ReelsExplorer({ accounts, showToast }) {+ const [media, setMedia] = useState([]);+ const [loading, setLoading] = useState(true);+ const [search, setSearch] = useState('');+ const [accountFilter, setAccountFilter] = useState('all');+ const [mediaTypeFilter, setMediaTypeFilter] = useState('all');+ const [performanceTier, setPerformanceTier] = useState('all');+ const [sortField, setSortField] = useState('likeCount');+ const [page, setPage] = useState(1);+ const [igAccounts, setIgAccounts] = useState([]);++ useEffect(() => {+ loadAllMedia();+ }, [accounts]);++ const loadAllMedia = async () => {+ setLoading(true);+ try {+ const allMedia = [];+ const acctList = [];+ const igAccts = (accounts || []).filter(a => a.platform === 'instagram');+ for (const acct of igAccts) {+ try {+ const res = await api.getIGMedia(acct.id);+ const items = res.media || [];+ const acctName = acct.title || acct.username || acct.name || 'Unknown';+ acctList.push({+ id: acct.id,+ title: acctName,+ thumbnail: acct.profilePictureUrl || acct.thumbnailUrl || '',+ });+ for (const m of items) {+ const likes = m.likeCount || 0;+ const comments = m.commentsCount || 0;+ const total = likes + comments;+ allMedia.push({+ ...m,+ accountName: acctName,+ accountId: acct.id,+ accountThumbnail: acct.profilePictureUrl || acct.thumbnailUrl || '',+ engagementRate: total > 0 ? total : 0,+ });+ }+ } catch (e) {+ console.warn(`Failed to load media for IG account ${acct.id}:`, e.message);+ }+ }+ setMedia(allMedia);+ setIgAccounts(acctList);+ } catch (err) {+ showToast('Failed to load media: ' + err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ const filteredMedia = useMemo(() => {+ let result = [...media];++ if (accountFilter !== 'all') result = result.filter(r => r.accountId === accountFilter);++ if (mediaTypeFilter !== 'all') result = result.filter(r => r.mediaType === mediaTypeFilter);++ if (search.trim()) {+ const q = search.toLowerCase();+ result = result.filter(r => r.caption?.toLowerCase().includes(q));+ }++ if (performanceTier !== 'all') {+ const tier = PERFORMANCE_TIERS.find(t => t.value === performanceTier);+ if (tier) {+ if (tier.min != null) result = result.filter(r => (r.likeCount || 0) >= tier.min);+ if (tier.max != null) result = result.filter(r => (r.likeCount || 0) < tier.max);+ }+ }++ result.sort((a, b) => {+ const aVal = sortField === 'timestamp' ? new Date(a[sortField] || 0).getTime() : (parseFloat(a[sortField]) || 0);+ const bVal = sortField === 'timestamp' ? new Date(b[sortField] || 0).getTime() : (parseFloat(b[sortField]) || 0);+ return bVal - aVal;+ });++ return result;+ }, [media, accountFilter, mediaTypeFilter, search, performanceTier, sortField]);++ const pageCount = Math.ceil(filteredMedia.length / ITEMS_PER_PAGE);+ const paginatedMedia = filteredMedia.slice((page - 1) * ITEMS_PER_PAGE, page * ITEMS_PER_PAGE);++ const stats = useMemo(() => {+ const total = filteredMedia.length;+ const totalLikes = filteredMedia.reduce((s, r) => s + (r.likeCount || 0), 0);+ const totalComments = filteredMedia.reduce((s, r) => s + (r.commentsCount || 0), 0);+ const avgLikes = total > 0 ? Math.round(totalLikes / total) : 0;+ const reels = filteredMedia.filter(m => m.mediaType === 'REEL' || m.mediaType === 'VIDEO').length;+ const photos = filteredMedia.filter(m => m.mediaType === 'IMAGE').length;+ const carousels = filteredMedia.filter(m => m.mediaType === 'CAROUSEL_ALBUM').length;+ return { total, totalLikes, totalComments, avgLikes, reels, photos, carousels };+ }, [filteredMedia]);++ const openOnInstagram = (permalink) => {+ if (permalink) window.open(permalink, '_blank', 'noopener');+ };++ if (loading) {+ return (+ <Box>+ <Typography variant="h4" sx={{ fontWeight: 700, mb: 3 }}>+ <Instagram sx={{ verticalAlign: 'middle', mr: 1, color: '#E1306C', fontSize: 36 }} />+ IG Content Explorer+ </Typography>+ <LinearProgress sx={{ mb: 3, '& .MuiLinearProgress-bar': { background: 'linear-gradient(90deg, #833AB4, #E1306C, #F77737)' } }} />+ <Grid container spacing={2}>+ {[...Array(8)].map((_, i) => (+ <Grid size={{ xs: 6, sm: 4, md: 3, lg: 2 }} key={i}>+ <Skeleton variant="rounded" height={320} sx={{ borderRadius: 3 }} />+ </Grid>+ ))}+ </Grid>+ </Box>+ );+ }++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 3, flexWrap: 'wrap', gap: 2 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>+ <Instagram sx={{ verticalAlign: 'middle', mr: 1, color: '#E1306C', fontSize: 36 }} />+ IG Content Explorer+ </Typography>+ <Button variant="contained" onClick={loadAllMedia}+ sx={{ background: 'linear-gradient(135deg, #833AB4, #E1306C, #F77737)' }}>+ Refresh All+ </Button>+ </Box>++ {/* Summary Stats */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Posts</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700 }}>{fmtNum(stats.total)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Reels</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#E1306C' }}>{fmtNum(stats.reels)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Photos</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#F77737' }}>{fmtNum(stats.photos)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Likes</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#E1306C' }}>{fmtNum(stats.totalLikes)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Comments</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#833AB4' }}>{fmtNum(stats.totalComments)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 2 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Avg Likes</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#F77737' }}>{fmtNum(stats.avgLikes)}</Typography>+ </Card>+ </Grid>+ </Grid>++ {/* Filters */}+ <Card sx={{ mb: 3, p: 2 }}>+ <Grid container spacing={2} alignItems="center">+ <Grid size={{ xs: 12, sm: 2.4 }}>+ <TextField fullWidth size="small" placeholder="Search posts..."+ value={search} onChange={(e) => { setSearch(e.target.value); setPage(1); }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><Search sx={{ color: 'text.secondary' }} /></InputAdornment> } }}+ />+ </Grid>+ <Grid size={{ xs: 6, sm: 2.4 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Media Type</InputLabel>+ <Select value={mediaTypeFilter} label="Media Type"+ onChange={(e) => { setMediaTypeFilter(e.target.value); setPage(1); }}>+ {MEDIA_TYPE_FILTER.map(t => (+ <MenuItem key={t.value} value={t.value}>{t.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 6, sm: 2.4 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Account</InputLabel>+ <Select value={accountFilter} label="Account"+ onChange={(e) => { setAccountFilter(e.target.value); setPage(1); }}>+ <MenuItem value="all">All Accounts ({igAccounts.length})</MenuItem>+ {igAccounts.map(a => (+ <MenuItem key={a.id} value={a.id}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ {a.thumbnail && <Avatar src={a.thumbnail} sx={{ width: 20, height: 20 }} />}+ {a.title}+ </Box>+ </MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 6, sm: 2.4 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Performance</InputLabel>+ <Select value={performanceTier} label="Performance"+ onChange={(e) => { setPerformanceTier(e.target.value); setPage(1); }}>+ {PERFORMANCE_TIERS.map(t => (+ <MenuItem key={t.value} value={t.value}>{t.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 6, sm: 2.4 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Sort By</InputLabel>+ <Select value={sortField} label="Sort By"+ onChange={(e) => { setSortField(e.target.value); setPage(1); }}>+ {SORT_OPTIONS.map(s => (+ <MenuItem key={s.field} value={s.field}>{s.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ </Grid>+ <Box sx={{ mt: 1.5 }}>+ <Typography variant="caption" color="text.secondary">+ Showing {paginatedMedia.length} of {filteredMedia.length} posts+ {mediaTypeFilter !== 'all' && ` • Type: ${MEDIA_TYPE_FILTER.find(t => t.value === mediaTypeFilter)?.label}`}+ {accountFilter !== 'all' && ` • Account: ${igAccounts.find(a => a.id === accountFilter)?.title}`}+ {performanceTier !== 'all' && ` • ${PERFORMANCE_TIERS.find(t => t.value === performanceTier)?.label}`}+ </Typography>+ </Box>+ </Card>++ {/* Media Grid */}+ <Grid container spacing={2}>+ {paginatedMedia.map((r, i) => {+ const isVideo = r.mediaType === 'REEL' || r.mediaType === 'VIDEO';+ const typeMeta = MEDIA_TYPE_META[r.mediaType] || MEDIA_TYPE_META.IMAGE;+ return (+ <Grid size={{ xs: 6, sm: 4, md: 3, lg: 2 }} key={`${r.id}-${i}`}>+ <Card sx={{+ cursor: 'pointer', borderRadius: 3, overflow: 'hidden',+ '&:hover': { transform: 'translateY(-4px)', transition: 'all 0.2s', boxShadow: '0 8px 24px rgba(0,0,0,0.4)' },+ }} onClick={() => openOnInstagram(r.permalink)}>+ <Box sx={{ position: 'relative' }}>+ <Box component="img" src={r.thumbnailUrl || r.mediaUrl}+ sx={{ width: '100%', aspectRatio: isVideo ? '9/16' : '1/1', objectFit: 'cover', display: 'block', bgcolor: '#222' }}+ onError={(e) => { e.target.style.display = 'none'; }}+ />+ {/* Play overlay for videos/reels */}+ {isVideo && (+ <Box sx={{+ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,+ display: 'flex', alignItems: 'center', justifyContent: 'center',+ bgcolor: 'transparent', transition: 'all 0.2s',+ '&:hover': { bgcolor: 'rgba(0,0,0,0.35)' },+ }}>+ <PlayCircleOutline sx={{+ fontSize: 44, color: '#fff', opacity: 0, transition: 'opacity 0.2s',+ '.MuiCard-root:hover &': { opacity: 1 },+ }} />+ </Box>+ )}+ {/* Likes badge */}+ <Chip icon={<FavoriteBorder sx={{ fontSize: '13px !important', color: '#fff !important' }} />}+ label={fmtNum(r.likeCount)} size="small"+ sx={{ position: 'absolute', top: 6, right: 6, bgcolor: 'rgba(0,0,0,0.75)', color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ {/* Media type badge */}+ <Chip icon={typeMeta.icon}+ label={typeMeta.label} size="small"+ sx={{ position: 'absolute', bottom: 6, right: 6, bgcolor: `${typeMeta.color}dd`, color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ </Box>+ <CardContent sx={{ p: 1.5, '&:last-child': { pb: 1.5 } }}>+ <Typography variant="body2" sx={{+ fontWeight: 600, mb: 0.5, fontSize: 12,+ display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden', lineHeight: 1.4,+ }}>+ {r.caption || 'No caption'}+ </Typography>+ {igAccounts.length > 1 && (+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', mb: 0.5, fontSize: 11 }}>+ {r.accountName}+ </Typography>+ )}+ <Box sx={{ display: 'flex', gap: 1, fontSize: 11, color: 'text.secondary', alignItems: 'center' }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <FavoriteBorder sx={{ fontSize: 12 }} /> {fmtNum(r.likeCount)}+ </Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <ChatBubbleOutline sx={{ fontSize: 12 }} /> {fmtNum(r.commentsCount)}+ </Box>+ <Box sx={{ ml: 'auto', fontSize: 10 }}>{timeAgo(r.timestamp)}</Box>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ );+ })}+ </Grid>++ {/* Pagination */}+ {pageCount > 1 && (+ <Box sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}>+ <Pagination count={pageCount} page={page} onChange={(_, p) => setPage(p)}+ sx={{ '& .Mui-selected': { background: 'linear-gradient(135deg, #833AB4, #E1306C) !important', color: '#fff' } }}+ shape="rounded" size="large" />+ </Box>+ )}++ {/* Empty state */}+ {filteredMedia.length === 0 && !loading && (+ <Box sx={{ textAlign: 'center', py: 8 }}>+ <Instagram sx={{ fontSize: 64, color: 'text.disabled', mb: 2 }} />+ <Typography variant="h6" color="text.secondary">No posts found</Typography>+ <Typography variant="body2" color="text.disabled" sx={{ mt: 1 }}>+ {(accounts || []).filter(a => a.platform === 'instagram').length === 0+ ? 'Add an Instagram account first to explore content'+ : 'Try adjusting your filters or search query'}+ </Typography>+ </Box>+ )}+ </Box>+ );+}diff --git a/frontend/src/components/Settings.jsx b/frontend/src/components/Settings.jsxnew file mode 100644index 0000000..629cf2e--- /dev/null+++ b/frontend/src/components/Settings.jsx@@ -0,0 +1,490 @@+import React, { useState, useEffect } from 'react';+import {+ Box, Typography, Grid, Card, CardContent, Button, TextField,+ InputAdornment, IconButton, Chip, Divider, Alert, CircularProgress,+} from '@mui/material';+import {+ Key, Save, Visibility, VisibilityOff, CheckCircle, Error as ErrorIcon,+ Refresh, Info, GitHub, Code, Instagram, Cloud, Sync, Schedule,+} from '@mui/icons-material';+import { api } from '../services/api';++export default function Settings({ showToast, onRefresh }) {+ const [apiKey, setApiKey] = useState('');+ const [igAppId, setIgAppId] = useState('');+ const [igAppSecret, setIgAppSecret] = useState('');+ const [cloudinaryName, setCloudinaryName] = useState('');+ const [cloudinaryPreset, setCloudinaryPreset] = useState('');+ const [githubToken, setGithubToken] = useState('');+ const [githubRepo, setGithubRepo] = useState('');+ const [githubBranch, setGithubBranch] = useState('main');+ const [showGhToken, setShowGhToken] = useState(false);+ const [savingGh, setSavingGh] = useState(false);+ const [syncingGh, setSyncingGh] = useState(false);+ const [showKey, setShowKey] = useState(false);+ const [showIgSecret, setShowIgSecret] = useState(false);+ const [saving, setSaving] = useState(false);+ const [savingIg, setSavingIg] = useState(false);+ const [savingCloud, setSavingCloud] = useState(false);+ const [testing, setTesting] = useState(false);+ const [testResult, setTestResult] = useState(null);+ const [loading, setLoading] = useState(true);++ useEffect(() => {+ loadKeys();+ }, []);++ const loadKeys = async () => {+ setLoading(true);+ try {+ const res = await api.getKeys();+ setApiKey(res.youtube || '');+ if (res.instagram) {+ setIgAppId(res.instagram.appId || '');+ setIgAppSecret(res.instagram.appSecret || '');+ }+ if (res.cloudinary) {+ setCloudinaryName(res.cloudinary.cloudName || '');+ setCloudinaryPreset(res.cloudinary.uploadPreset || '');+ }+ if (res.github) {+ setGithubToken(res.github.token || '');+ setGithubRepo(res.github.repo || '');+ setGithubBranch(res.github.branch || 'main');+ }+ } catch (err) {+ showToast('Failed to load API keys', 'error');+ } finally {+ setLoading(false);+ }+ };++ const handleSave = async () => {+ setSaving(true);+ try {+ await api.saveKey(apiKey);+ showToast('API key saved successfully', 'success');+ } catch (err) {+ showToast('Failed to save API key: ' + err.message, 'error');+ } finally {+ setSaving(false);+ }+ };++ const handleTest = async () => {+ setTesting(true);+ setTestResult(null);+ try {+ const res = await api.health();+ if (res.status === 'ok') {+ setTestResult({ success: true, message: 'API connection successful!' });+ } else {+ setTestResult({ success: false, message: 'API health check returned unexpected status.' });+ }+ } catch (err) {+ setTestResult({ success: false, message: 'Connection failed: ' + err.message });+ } finally {+ setTesting(false);+ }+ };++ const handleRefreshAll = async () => {+ try {+ await api.refreshAll();+ showToast('All accounts refreshed successfully', 'success');+ onRefresh();+ } catch (err) {+ showToast('Refresh failed: ' + err.message, 'error');+ }+ };++ const handleSaveInstagram = async () => {+ setSavingIg(true);+ try {+ await api.saveKeys({ instagram: { appId: igAppId, appSecret: igAppSecret } });+ showToast('Instagram credentials saved successfully', 'success');+ } catch (err) {+ showToast('Failed to save Instagram credentials: ' + err.message, 'error');+ } finally {+ setSavingIg(false);+ }+ };++ const handleSaveCloudinary = async () => {+ setSavingCloud(true);+ try {+ await api.saveKeys({ cloudinary: { cloudName: cloudinaryName, uploadPreset: cloudinaryPreset } });+ showToast('Cloudinary settings saved successfully', 'success');+ } catch (err) {+ showToast('Failed to save Cloudinary settings: ' + err.message, 'error');+ } finally {+ setSavingCloud(false);+ }+ };++ const handleSaveGitHub = async () => {+ setSavingGh(true);+ try {+ await api.saveKeys({ github: { token: githubToken, repo: githubRepo, branch: githubBranch } });+ showToast('GitHub Actions settings saved successfully', 'success');+ } catch (err) {+ showToast('Failed to save GitHub settings: ' + err.message, 'error');+ } finally {+ setSavingGh(false);+ }+ };++ const handleSyncGitHub = async () => {+ setSyncingGh(true);+ try {+ await api.syncToGitHub();+ showToast('Scheduled posts synced to GitHub', 'success');+ } catch (err) {+ showToast('Sync failed: ' + err.message, 'error');+ } finally {+ setSyncingGh(false);+ }+ };++ const maskedKey = apiKey ? apiKey.substring(0, 8) + '•'.repeat(Math.max(0, apiKey.length - 12)) + apiKey.substring(apiKey.length - 4) : '';+ const maskedIgSecret = igAppSecret ? igAppSecret.substring(0, 6) + '•'.repeat(Math.max(0, igAppSecret.length - 10)) + igAppSecret.substring(igAppSecret.length - 4) : '';+ const maskedGhToken = githubToken ? 'ghp_' + '•'.repeat(Math.max(0, githubToken.length - 8)) + githubToken.substring(githubToken.length - 4) : '';++ return (+ <Box>+ <Typography variant="h4" sx={{ fontWeight: 700, mb: 3 }}>+ Settings+ </Typography>++ <Grid container spacing={3}>+ {/* Left Column — all settings cards */}+ <Grid size={{ xs: 12, md: 8 }}>++ {/* API Key Configuration */}+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 0.5 }}>+ <Key sx={{ verticalAlign: 'middle', mr: 1, color: '#FF9800' }} />+ YouTube Data API Key+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Required to fetch YouTube channel and video data. Get your key from the{' '}+ <Box component="a" href="https://console.cloud.google.com/apis/credentials" target="_blank"+ sx={{ color: '#3EA6FF', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }}>+ Google Cloud Console+ </Box>.+ </Typography>++ <TextField fullWidth value={showKey ? apiKey : maskedKey}+ onChange={e => setApiKey(e.target.value)}+ placeholder="AIzaSy..." size="small"+ onFocus={() => setShowKey(true)}+ type={showKey ? 'text' : 'text'}+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Key sx={{ color: 'text.secondary' }} /></InputAdornment>,+ endAdornment: (+ <InputAdornment position="end">+ <IconButton size="small" onClick={() => setShowKey(!showKey)}>+ {showKey ? <VisibilityOff fontSize="small" /> : <Visibility fontSize="small" />}+ </IconButton>+ </InputAdornment>+ ),+ }+ }}+ sx={{ mb: 2 }} />++ <Box sx={{ display: 'flex', gap: 1.5 }}>+ <Button variant="contained" startIcon={saving ? <CircularProgress size={16} /> : <Save />}+ onClick={handleSave} disabled={saving || !apiKey.trim()}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)' }}>+ Save Key+ </Button>+ <Button variant="outlined" startIcon={testing ? <CircularProgress size={16} /> : <CheckCircle />}+ onClick={handleTest} disabled={testing}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ Test Connection+ </Button>+ </Box>++ {testResult && (+ <Alert severity={testResult.success ? 'success' : 'error'} sx={{ mt: 2 }}>+ {testResult.message}+ </Alert>+ )}+ </CardContent>+ </Card>++ {/* Instagram Credentials */}+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 0.5 }}>+ <Instagram sx={{ verticalAlign: 'middle', mr: 1, color: '#E1306C' }} />+ Instagram App Credentials+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Optional — enables long-lived token exchange (~60 days). Get these from{' '}+ <Box component="a" href="https://developers.facebook.com/apps/" target="_blank"+ sx={{ color: '#E1306C', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }}>+ App Dashboard → Instagram → API setup with Instagram login+ </Box>.+ </Typography>++ <TextField fullWidth value={igAppId}+ onChange={e => setIgAppId(e.target.value)}+ placeholder="Instagram App ID from App Dashboard" size="small" label="Instagram App ID"+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Code sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }}+ sx={{ mb: 2 }} />++ <TextField fullWidth value={showIgSecret ? igAppSecret : maskedIgSecret}+ onChange={e => setIgAppSecret(e.target.value)}+ placeholder="Instagram App Secret from App Dashboard" size="small" label="Instagram App Secret"+ onFocus={() => setShowIgSecret(true)}+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Key sx={{ color: 'text.secondary' }} /></InputAdornment>,+ endAdornment: (+ <InputAdornment position="end">+ <IconButton size="small" onClick={() => setShowIgSecret(!showIgSecret)}>+ {showIgSecret ? <VisibilityOff fontSize="small" /> : <Visibility fontSize="small" />}+ </IconButton>+ </InputAdornment>+ ),+ }+ }}+ sx={{ mb: 2 }} />++ <Button variant="contained" startIcon={savingIg ? <CircularProgress size={16} /> : <Save />}+ onClick={handleSaveInstagram} disabled={savingIg || (!igAppId.trim() && !igAppSecret.trim())}+ sx={{ background: 'linear-gradient(135deg, #F58529, #DD2A7B, #8134AF)' }}>+ Save Instagram Credentials+ </Button>++ <Alert severity="info" sx={{ mt: 2 }}>+ Only the <strong>Instagram App Secret</strong> is needed for token exchange. You can add accounts+ without credentials — tokens from the App Dashboard are already long-lived (60 days).+ </Alert>+ </CardContent>+ </Card>++ {/* Cloudinary CDN Settings */}+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 0.5 }}>+ <Cloud sx={{ verticalAlign: 'middle', mr: 1, color: '#3448C5' }} />+ Cloudinary CDN (for Instagram Uploads)+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Instagram API requires media at a public URL. Cloudinary is used to host your files before publishing.+ Get a free account at{' '}+ <Box component="a" href="https://cloudinary.com/users/register_free" target="_blank"+ sx={{ color: '#3448C5', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }}>+ cloudinary.com+ </Box>. Use an <strong>unsigned upload preset</strong>.+ </Typography>++ <TextField fullWidth value={cloudinaryName}+ onChange={e => setCloudinaryName(e.target.value)}+ placeholder="e.g. my-cloud-name" size="small" label="Cloud Name"+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Cloud sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }}+ sx={{ mb: 2 }} />++ <TextField fullWidth value={cloudinaryPreset}+ onChange={e => setCloudinaryPreset(e.target.value)}+ placeholder="e.g. ml_default (unsigned preset)" size="small" label="Upload Preset (unsigned)"+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Code sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }}+ sx={{ mb: 2 }} />++ <Button variant="contained" startIcon={savingCloud ? <CircularProgress size={16} /> : <Save />}+ onClick={handleSaveCloudinary} disabled={savingCloud || !cloudinaryName.trim()}+ sx={{ background: 'linear-gradient(135deg, #3448C5, #0C6DD7)' }}>+ Save Cloudinary Settings+ </Button>++ <Alert severity="info" sx={{ mt: 2 }}>+ Create an <strong>unsigned upload preset</strong> in Cloudinary → Settings → Upload → Upload presets → Add.+ This allows direct browser uploads without exposing API secrets.+ </Alert>+ </CardContent>+ </Card>++ {/* GitHub Actions — Cloud Scheduling */}+ <Card sx={{ mb: 3 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 0.5 }}>+ <GitHub sx={{ verticalAlign: 'middle', mr: 1 }} />+ GitHub Actions (Cloud Scheduling)+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Publish scheduled posts from the cloud — even when your PC is off. Runs every 15 min via GitHub Actions (free).+ Create a{' '}+ <Box component="a" href="https://github.com/settings/tokens?type=beta" target="_blank"+ sx={{ color: '#fff', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } }}>+ Fine-grained Personal Access Token+ </Box>{' '}+ with <strong>Contents: Read & Write</strong> permission.+ </Typography>++ <TextField fullWidth value={showGhToken ? githubToken : maskedGhToken}+ onChange={e => setGithubToken(e.target.value)}+ placeholder="ghp_xxxxxxxxxxxx" size="small" label="GitHub Personal Access Token"+ onFocus={() => setShowGhToken(true)}+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Key sx={{ color: 'text.secondary' }} /></InputAdornment>,+ endAdornment: (+ <InputAdornment position="end">+ <IconButton size="small" onClick={() => setShowGhToken(!showGhToken)}>+ {showGhToken ? <VisibilityOff fontSize="small" /> : <Visibility fontSize="small" />}+ </IconButton>+ </InputAdornment>+ ),+ }+ }}+ sx={{ mb: 2 }} />++ <TextField fullWidth value={githubRepo}+ onChange={e => setGithubRepo(e.target.value)}+ placeholder="username/repo-name" size="small" label="Repository (owner/repo)"+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><GitHub sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }}+ sx={{ mb: 2 }} />++ <TextField fullWidth value={githubBranch}+ onChange={e => setGithubBranch(e.target.value)}+ placeholder="main" size="small" label="Branch"+ slotProps={{+ input: {+ startAdornment: <InputAdornment position="start"><Code sx={{ color: 'text.secondary' }} /></InputAdornment>,+ }+ }}+ sx={{ mb: 2 }} />++ <Box sx={{ display: 'flex', gap: 1.5, flexWrap: 'wrap' }}>+ <Button variant="contained" startIcon={savingGh ? <CircularProgress size={16} /> : <Save />}+ onClick={handleSaveGitHub} disabled={savingGh || !githubToken.trim() || !githubRepo.trim()}+ sx={{ background: 'linear-gradient(135deg, #333, #555)' }}>+ Save GitHub Settings+ </Button>+ <Button variant="outlined" startIcon={syncingGh ? <CircularProgress size={16} /> : <Sync />}+ onClick={handleSyncGitHub} disabled={syncingGh || !githubToken.trim() || !githubRepo.trim()}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ Sync Now+ </Button>+ </Box>++ <Alert severity="info" sx={{ mt: 2 }}>+ <strong>Setup steps:</strong><br />+ 1. Push this project to a GitHub repo<br />+ 2. Go to repo → Settings → Secrets → Actions → New Secret<br />+ 3. Add secret <code>ACCOUNTS_JSON</code> with the Base64 of your <code>accounts.json</code><br />+ PowerShell: <code>[Convert]::ToBase64String([IO.File]::ReadAllBytes("backend\data\accounts.json"))</code><br />+ 4. The workflow runs every 15 min automatically+ </Alert>+ </CardContent>+ </Card>++ {/* How to get API Keys */}+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ <Info sx={{ verticalAlign: 'middle', mr: 1, color: '#3EA6FF' }} />+ How to Get a YouTube API Key+ </Typography>+ <Box component="ol" sx={{ pl: 2, color: 'text.secondary', '& li': { mb: 1.5, lineHeight: 1.6 } }}>+ <li>Go to the <Box component="a" href="https://console.cloud.google.com/" target="_blank" sx={{ color: '#3EA6FF' }}>Google Cloud Console</Box></li>+ <li>Create a new project or select an existing one</li>+ <li>Enable the <strong style={{ color: '#fff' }}>YouTube Data API v3</strong> from the API Library</li>+ <li>Go to <strong style={{ color: '#fff' }}>Credentials</strong> → <strong style={{ color: '#fff' }}>Create Credentials</strong> → <strong style={{ color: '#fff' }}>API Key</strong></li>+ <li>Copy the API key and paste it above</li>+ <li>Optional: Restrict the key to YouTube Data API v3 only for security</li>+ </Box>+ <Alert severity="info" sx={{ mt: 2 }}>+ The free quota allows ~10,000 units/day. Fetching a channel uses ~5 units, video details ~3 units per batch.+ </Alert>++ <Divider sx={{ my: 3 }} />++ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ <Instagram sx={{ verticalAlign: 'middle', mr: 1, color: '#E1306C' }} />+ How to Get Instagram Access+ </Typography>+ <Box component="ol" sx={{ pl: 2, color: 'text.secondary', '& li': { mb: 1.5, lineHeight: 1.6 } }}>+ <li>Go to <Box component="a" href="https://developers.facebook.com/apps/" target="_blank" sx={{ color: '#E1306C' }}>Meta for Developers</Box> and create a new app (type: <strong style={{ color: '#fff' }}>Business</strong>)</li>+ <li>In the app dashboard, add the <strong style={{ color: '#fff' }}>Instagram</strong> product and set up <strong style={{ color: '#fff' }}>API setup with Instagram business login</strong></li>+ <li>Your Instagram account must be a <strong style={{ color: '#fff' }}>Business</strong> or <strong style={{ color: '#fff' }}>Creator</strong> professional account (no Facebook Page link needed)</li>+ <li>In the Instagram API setup section, find your <strong style={{ color: '#fff' }}>Instagram App ID</strong> and <strong style={{ color: '#fff' }}>Instagram App Secret</strong> under Business login settings</li>+ <li>Add your Instagram account as a <strong style={{ color: '#fff' }}>Tester</strong> under App Roles → Instagram Testers, then accept the invite</li>+ <li>Click <strong style={{ color: '#fff' }}>Generate Token</strong> next to your Instagram account to get a long-lived access token (60 days)</li>+ <li>Required permission: <strong style={{ color: '#fff' }}>instagram_business_basic</strong></li>+ <li>Paste the access token in the <strong style={{ color: '#fff' }}>Add Account → Instagram</strong> dialog</li>+ </Box>+ <Alert severity="warning" sx={{ mt: 2 }}>+ In development mode, only test users / Instagram Testers can use the app.+ Tokens from the App Dashboard are long-lived (~60 days). Tokens from the Business Login+ flow are short-lived (1 hour) and need the App Secret for exchange.+ </Alert>+ </CardContent>+ </Card>++ </Grid>++ {/* Right Column — Quick Actions + About (sticky at top) */}+ <Grid size={{ xs: 12, md: 4 }}>+ <Box sx={{ position: 'sticky', top: 24 }}>+ <Card sx={{ mb: 2 }}>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ <Refresh sx={{ verticalAlign: 'middle', mr: 1, color: '#4CAF50' }} />+ Quick Actions+ </Typography>+ <Button fullWidth variant="outlined" startIcon={<Refresh />} onClick={handleRefreshAll}+ sx={{ borderColor: 'rgba(255,255,255,0.15)', mb: 1.5 }}>+ Refresh All Accounts+ </Button>+ <Button fullWidth variant="outlined" startIcon={<CheckCircle />} onClick={handleTest}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ Test API Health+ </Button>+ </CardContent>+ </Card>++ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>About</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 2, lineHeight: 1.7 }}>+ Social Media Analytics Dashboard — a comprehensive analytics tool for tracking YouTube and Instagram+ performance with engagement metrics, growth tracking, and more.+ </Typography>+ <Divider sx={{ my: 2 }} />+ <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>+ <Chip label="React" size="small" variant="outlined" sx={{ borderColor: 'rgba(97,219,251,0.3)', color: '#61DAFB' }} />+ <Chip label="MUI v7" size="small" variant="outlined" sx={{ borderColor: 'rgba(0,127,255,0.3)', color: '#007FFF' }} />+ <Chip label="Recharts" size="small" variant="outlined" sx={{ borderColor: 'rgba(130,202,157,0.3)', color: '#82ca9d' }} />+ <Chip label="Node.js" size="small" variant="outlined" sx={{ borderColor: 'rgba(104,159,56,0.3)', color: '#68A038' }} />+ <Chip label="YouTube API v3" size="small" variant="outlined" sx={{ borderColor: 'rgba(255,0,0,0.3)', color: '#FF4444' }} />+ <Chip label="Instagram Graph API" size="small" variant="outlined" sx={{ borderColor: 'rgba(225,48,108,0.3)', color: '#E1306C' }} />+ </Box>+ </CardContent>+ </Card>+ </Box>+ </Grid>+ </Grid>+ </Box>+ );+}diff --git a/frontend/src/components/ShortsExplorer.jsx b/frontend/src/components/ShortsExplorer.jsxnew file mode 100644index 0000000..ccbbbf2--- /dev/null+++ b/frontend/src/components/ShortsExplorer.jsx@@ -0,0 +1,331 @@+import React, { useState, useEffect, useMemo } from 'react';+import {+ Box, Typography, Card, CardContent, Grid, TextField, InputAdornment,+ Select, MenuItem, FormControl, InputLabel, Chip, IconButton, Tooltip,+ LinearProgress, Avatar, Button, Pagination, Skeleton,+} from '@mui/material';+import {+ Search, Visibility, ThumbUp, Comment, PlayCircleOutline, YouTube,+} from '@mui/icons-material';+import { api } from '../services/api';+import { fmtNum, fmtDate, fmtDuration, fmtPercent, timeAgo } from '../utils/formatters';++const ITEMS_PER_PAGE = 24;++const PERFORMANCE_TIERS = [+ { label: 'All', value: 'all' },+ { label: 'Viral (>1M)', value: 'viral', min: 1000000 },+ { label: 'High (100K–1M)', value: 'high', min: 100000, max: 1000000 },+ { label: 'Medium (10K–100K)', value: 'medium', min: 10000, max: 100000 },+ { label: 'Low (<10K)', value: 'low', max: 10000 },+];++const SORT_OPTIONS = [+ { label: 'Most Viewed', field: 'viewCount' },+ { label: 'Most Liked', field: 'likeCount' },+ { label: 'Most Comments', field: 'commentCount' },+ { label: 'Best Engagement', field: 'engagementRate' },+ { label: 'Newest First', field: 'publishedAt' },+];++function parseDurationToSeconds(iso) {+ if (!iso || iso === 'P0D') return 0;+ const m = iso.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);+ if (!m) return 0;+ return (parseInt(m[1] || 0) * 3600) + (parseInt(m[2] || 0) * 60) + parseInt(m[3] || 0);+}++export default function ShortsExplorer({ accounts, showToast }) {+ const [shorts, setShorts] = useState([]);+ const [loading, setLoading] = useState(true);+ const [search, setSearch] = useState('');+ const [channelFilter, setChannelFilter] = useState('all');+ const [performanceTier, setPerformanceTier] = useState('all');+ const [sortField, setSortField] = useState('viewCount');+ const [page, setPage] = useState(1);+ const [channels, setChannels] = useState([]);++ useEffect(() => {+ loadAllShorts();+ }, [accounts]);++ const loadAllShorts = async () => {+ setLoading(true);+ try {+ const allShorts = [];+ const channelList = [];+ for (const acct of (accounts || [])) {+ try {+ const res = await api.getVideos(acct.id);+ const vids = res.videos || res.data?.videos || [];+ const channelTitle = acct.title || acct.name || acct.channelTitle || 'Unknown';+ channelList.push({ id: acct.id, title: channelTitle, thumbnail: acct.thumbnails?.default || acct.thumbnailUrl || '' });+ for (const v of vids) {+ const dur = v.durationSeconds || parseDurationToSeconds(v.duration);+ if (dur > 0 && dur <= 60) {+ const thumb = v.thumbnail || v.thumbnails?.medium || v.thumbnails?.high || v.thumbnails?.default || '';+ const views = v.viewCount || 0;+ const likes = v.likeCount || 0;+ const comments = v.commentCount || 0;+ allShorts.push({+ ...v,+ thumbnail: thumb,+ channelTitle,+ channelId: acct.id,+ durationSeconds: dur,+ engagementRate: views > 0 ? ((likes + comments) / views * 100).toFixed(2) : '0.00',+ });+ }+ }+ } catch (e) {+ console.warn(`Failed to load videos for ${acct.id}:`, e.message);+ }+ }+ setShorts(allShorts);+ setChannels(channelList);+ } catch (err) {+ showToast('Failed to load shorts: ' + err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ const filteredShorts = useMemo(() => {+ let result = [...shorts];+ if (channelFilter !== 'all') result = result.filter(v => v.channelId === channelFilter);+ if (search.trim()) {+ const q = search.toLowerCase();+ result = result.filter(v => v.title?.toLowerCase().includes(q) || (v.tags || []).some(t => t.toLowerCase().includes(q)));+ }+ if (performanceTier !== 'all') {+ const tier = PERFORMANCE_TIERS.find(t => t.value === performanceTier);+ if (tier) {+ if (tier.min != null) result = result.filter(v => (v.viewCount || 0) >= tier.min);+ if (tier.max != null) result = result.filter(v => (v.viewCount || 0) < tier.max);+ }+ }+ result.sort((a, b) => {+ const aVal = sortField === 'publishedAt' ? new Date(a[sortField] || 0).getTime() : (parseFloat(a[sortField]) || 0);+ const bVal = sortField === 'publishedAt' ? new Date(b[sortField] || 0).getTime() : (parseFloat(b[sortField]) || 0);+ return bVal - aVal;+ });+ return result;+ }, [shorts, channelFilter, search, performanceTier, sortField]);++ const pageCount = Math.ceil(filteredShorts.length / ITEMS_PER_PAGE);+ const paginatedShorts = filteredShorts.slice((page - 1) * ITEMS_PER_PAGE, page * ITEMS_PER_PAGE);++ const stats = useMemo(() => {+ const total = filteredShorts.length;+ const totalViews = filteredShorts.reduce((s, v) => s + (v.viewCount || 0), 0);+ const totalLikes = filteredShorts.reduce((s, v) => s + (v.likeCount || 0), 0);+ const avgViews = total > 0 ? Math.round(totalViews / total) : 0;+ return { total, totalViews, totalLikes, avgViews };+ }, [filteredShorts]);++ const openOnYouTube = (videoId) => {+ window.open(`https://www.youtube.com/shorts/${videoId}`, '_blank', 'noopener');+ };++ if (loading) {+ return (+ <Box>+ <Typography variant="h4" sx={{ fontWeight: 700, mb: 3 }}>+ <YouTube sx={{ verticalAlign: 'middle', mr: 1, color: '#FF0000', fontSize: 36 }} />+ Shorts Explorer+ </Typography>+ <LinearProgress color="error" sx={{ mb: 3 }} />+ <Grid container spacing={2}>+ {[...Array(8)].map((_, i) => (+ <Grid size={{ xs: 6, sm: 4, md: 3, lg: 2 }} key={i}>+ <Skeleton variant="rounded" height={320} sx={{ borderRadius: 3 }} />+ </Grid>+ ))}+ </Grid>+ </Box>+ );+ }++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 3, flexWrap: 'wrap', gap: 2 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>+ <YouTube sx={{ verticalAlign: 'middle', mr: 1, color: '#FF0000', fontSize: 36 }} />+ Shorts Explorer+ </Typography>+ <Button variant="contained" onClick={loadAllShorts}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)' }}>+ Refresh All+ </Button>+ </Box>++ {/* Summary Stats */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 3 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Shorts</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700 }}>{fmtNum(stats.total)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Views</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#FF0000' }}>{fmtNum(stats.totalViews)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Likes</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#4CAF50' }}>{fmtNum(stats.totalLikes)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Avg Views</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#FF9800' }}>{fmtNum(stats.avgViews)}</Typography>+ </Card>+ </Grid>+ </Grid>++ {/* Filters */}+ <Card sx={{ mb: 3, p: 2 }}>+ <Grid container spacing={2} alignItems="center">+ <Grid size={{ xs: 12, sm: 3 }}>+ <TextField fullWidth size="small" placeholder="Search shorts..."+ value={search} onChange={(e) => { setSearch(e.target.value); setPage(1); }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><Search sx={{ color: 'text.secondary' }} /></InputAdornment> } }}+ />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Channel</InputLabel>+ <Select value={channelFilter} label="Channel"+ onChange={(e) => { setChannelFilter(e.target.value); setPage(1); }}>+ <MenuItem value="all">All Channels ({channels.length})</MenuItem>+ {channels.map(c => (+ <MenuItem key={c.id} value={c.id}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ {c.thumbnail && <Avatar src={c.thumbnail} sx={{ width: 20, height: 20 }} />}+ {c.title}+ </Box>+ </MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Performance</InputLabel>+ <Select value={performanceTier} label="Performance"+ onChange={(e) => { setPerformanceTier(e.target.value); setPage(1); }}>+ {PERFORMANCE_TIERS.map(t => (+ <MenuItem key={t.value} value={t.value}>{t.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 12, sm: 3 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Sort By</InputLabel>+ <Select value={sortField} label="Sort By"+ onChange={(e) => { setSortField(e.target.value); setPage(1); }}>+ {SORT_OPTIONS.map(s => (+ <MenuItem key={s.field} value={s.field}>{s.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ </Grid>+ <Box sx={{ mt: 1.5 }}>+ <Typography variant="caption" color="text.secondary">+ Showing {paginatedShorts.length} of {filteredShorts.length} shorts+ {channelFilter !== 'all' && ` • Channel: ${channels.find(c => c.id === channelFilter)?.title}`}+ {performanceTier !== 'all' && ` • ${PERFORMANCE_TIERS.find(t => t.value === performanceTier)?.label}`}+ </Typography>+ </Box>+ </Card>++ {/* Shorts Grid — vertical 9:16 card layout */}+ <Grid container spacing={2}>+ {paginatedShorts.map((v, i) => (+ <Grid size={{ xs: 6, sm: 4, md: 3, lg: 2 }} key={`${v.videoId}-${i}`}>+ <Card sx={{+ cursor: 'pointer', borderRadius: 3, overflow: 'hidden',+ '&:hover': { transform: 'translateY(-4px)', transition: 'all 0.2s', boxShadow: '0 8px 24px rgba(0,0,0,0.4)' },+ }} onClick={() => openOnYouTube(v.videoId)}>+ <Box sx={{ position: 'relative' }}>+ <Box component="img" src={v.thumbnail}+ sx={{ width: '100%', aspectRatio: '9/16', objectFit: 'cover', display: 'block', bgcolor: '#222' }}+ onError={(e) => { e.target.style.display = 'none'; }}+ />+ {/* Play overlay */}+ <Box sx={{+ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,+ display: 'flex', alignItems: 'center', justifyContent: 'center',+ bgcolor: 'transparent', transition: 'all 0.2s',+ '&:hover': { bgcolor: 'rgba(0,0,0,0.35)' },+ }}>+ <PlayCircleOutline sx={{+ fontSize: 44, color: '#fff', opacity: 0, transition: 'opacity 0.2s',+ '.MuiCard-root:hover &': { opacity: 1 },+ }} />+ </Box>+ {/* Views badge */}+ <Chip icon={<Visibility sx={{ fontSize: '13px !important', color: '#fff !important' }} />}+ label={fmtNum(v.viewCount)} size="small"+ sx={{ position: 'absolute', top: 6, right: 6, bgcolor: 'rgba(0,0,0,0.75)', color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ {/* Duration badge */}+ <Chip label={fmtDuration(v.durationSeconds)} size="small"+ sx={{ position: 'absolute', bottom: 6, right: 6, bgcolor: 'rgba(0,0,0,0.85)', color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ </Box>+ <CardContent sx={{ p: 1.5, '&:last-child': { pb: 1.5 } }}>+ <Typography variant="body2" sx={{+ fontWeight: 600, mb: 0.5, fontSize: 12,+ display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden', lineHeight: 1.4,+ }}>+ {v.title}+ </Typography>+ {channels.length > 1 && (+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', mb: 0.5, fontSize: 11 }}>+ {v.channelTitle}+ </Typography>+ )}+ <Box sx={{ display: 'flex', gap: 1, fontSize: 11, color: 'text.secondary', alignItems: 'center' }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <ThumbUp sx={{ fontSize: 12 }} /> {fmtNum(v.likeCount)}+ </Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <Comment sx={{ fontSize: 12 }} /> {fmtNum(v.commentCount)}+ </Box>+ <Box sx={{ ml: 'auto', fontSize: 10 }}>{timeAgo(v.publishedAt)}</Box>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ ))}+ </Grid>++ {/* Pagination */}+ {pageCount > 1 && (+ <Box sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}>+ <Pagination count={pageCount} page={page} onChange={(_, p) => setPage(p)}+ color="error" shape="rounded" size="large" />+ </Box>+ )}++ {/* Empty state */}+ {filteredShorts.length === 0 && !loading && (+ <Box sx={{ textAlign: 'center', py: 8 }}>+ <YouTube sx={{ fontSize: 64, color: 'text.disabled', mb: 2 }} />+ <Typography variant="h6" color="text.secondary">No shorts found</Typography>+ <Typography variant="body2" color="text.disabled" sx={{ mt: 1 }}>+ {accounts?.length === 0+ ? 'Add a channel first to explore shorts'+ : 'Try adjusting your filters or search query'}+ </Typography>+ </Box>+ )}+ </Box>+ );+}diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsxnew file mode 100644index 0000000..6c51d15--- /dev/null+++ b/frontend/src/components/Sidebar.jsx@@ -0,0 +1,115 @@+import React from 'react';+import {+ Drawer, Box, Typography, List, ListItemButton, ListItemIcon, ListItemText,+ Avatar, Divider, Chip,+} from '@mui/material';+import {+ Dashboard as DashboardIcon, YouTube as YouTubeIcon, ManageAccounts,+ Settings, TrendingUp, PlaylistPlay, ContentCut, Instagram, CloudUpload,+} from '@mui/icons-material';+import Logo from './Logo';++const DRAWER_WIDTH = 260;++const NAV = [+ { id: 'overview', label: 'Overview', icon: <DashboardIcon /> },+ { id: 'videos', label: 'All Videos', icon: <PlaylistPlay /> },+ { id: 'shorts', label: 'All Shorts', icon: <ContentCut /> },+ { id: 'reels', label: 'IG Content', icon: <Instagram /> },+ { id: 'upload', label: 'Upload', icon: <CloudUpload /> },+ { id: 'accounts', label: 'Accounts', icon: <ManageAccounts /> },+ { id: 'settings', label: 'Settings', icon: <Settings /> },+];++export default function Sidebar({ tab, setTab, accounts, onViewChannel }) {+ return (+ <Drawer variant="permanent" sx={{+ width: DRAWER_WIDTH, flexShrink: 0,+ '& .MuiDrawer-paper': { width: DRAWER_WIDTH, boxSizing: 'border-box' },+ }}>+ {/* Logo */}+ <Box sx={{ p: 2.5, display: 'flex', alignItems: 'center', gap: 1.5 }}>+ <Logo size={40} />+ <Box>+ <Typography variant="h6" sx={{ fontWeight: 700, fontSize: 16, lineHeight: 1.2, letterSpacing: '-0.3px' }}>+ Social Analytics+ </Typography>+ <Typography variant="caption" sx={{ color: 'text.secondary', fontSize: 10, letterSpacing: '0.5px' }}>+ Dashboard Pro+ </Typography>+ </Box>+ </Box>++ <Divider sx={{ borderColor: 'rgba(255,255,255,0.06)' }} />++ {/* Nav */}+ <List sx={{ px: 1.5, py: 2 }}>+ {NAV.map(item => (+ <ListItemButton key={item.id} selected={tab === item.id}+ onClick={() => setTab(item.id)}+ sx={{+ borderRadius: 2, mb: 0.5, py: 1.2,+ '&.Mui-selected': { bgcolor: 'rgba(255,0,0,0.08)', '&:hover': { bgcolor: 'rgba(255,0,0,0.12)' } },+ '&:hover': { bgcolor: 'rgba(255,255,255,0.04)' },+ }}>+ <ListItemIcon sx={{ minWidth: 40, color: tab === item.id ? 'primary.main' : 'text.secondary' }}>+ {item.icon}+ </ListItemIcon>+ <ListItemText primary={item.label}+ primaryTypographyProps={{ fontSize: 14, fontWeight: tab === item.id ? 600 : 400 }} />+ </ListItemButton>+ ))}+ </List>++ <Divider sx={{ borderColor: 'rgba(255,255,255,0.06)', mx: 2 }} />++ {/* Channels Quick Access */}+ <Box sx={{ px: 2, py: 1.5 }}>+ <Typography variant="overline" sx={{ color: 'text.secondary', fontSize: 10, letterSpacing: 1.5, fontWeight: 700 }}>+ Accounts+ </Typography>+ </Box>+ <List sx={{ px: 1.5, flex: 1, overflow: 'auto' }}>+ {accounts.length === 0 ? (+ <Typography variant="caption" sx={{ display: 'block', textAlign: 'center', color: 'text.secondary', py: 2, px: 1 }}>+ No accounts added yet+ </Typography>+ ) : (+ accounts.map(acc => (+ <ListItemButton key={acc.id}+ selected={tab === 'channel' || tab === 'ig-analytics'}+ onClick={() => onViewChannel(acc)}+ sx={{+ borderRadius: 2, mb: 0.5, py: 0.8,+ '&:hover': { bgcolor: 'rgba(255,255,255,0.04)' },+ }}>+ <ListItemIcon sx={{ minWidth: 36 }}>+ <Avatar src={acc.thumbnail || acc.thumbnails?.default || acc.thumbnailUrl || acc.profilePictureUrl || ''}+ sx={{ width: 28, height: 28 }}>+ {acc.platform === 'instagram' ? <Instagram sx={{ fontSize: 16 }} /> : <YouTubeIcon sx={{ fontSize: 16 }} />}+ </Avatar>+ </ListItemIcon>+ <ListItemText primary={acc.title}+ primaryTypographyProps={{ fontSize: 13, fontWeight: 500, noWrap: true }} />+ {acc.platform === 'instagram' && (+ <Instagram sx={{ fontSize: 14, color: '#DD2A7B', ml: 0.5 }} />+ )}+ </ListItemButton>+ ))+ )}+ </List>++ {/* Footer */}+ <Box sx={{ p: 2, borderTop: '1px solid rgba(255,255,255,0.06)' }}>+ <Box sx={{ display: 'flex', gap: 0.5 }}>+ <Chip icon={<YouTubeIcon />} label={`${accounts.filter(a => a.platform !== 'instagram').length} YT`}+ size="small" variant="outlined"+ sx={{ flex: 1, justifyContent: 'flex-start', borderColor: 'rgba(255,255,255,0.1)', fontSize: 11 }} />+ <Chip icon={<Instagram />} label={`${accounts.filter(a => a.platform === 'instagram').length} IG`}+ size="small" variant="outlined"+ sx={{ flex: 1, justifyContent: 'flex-start', borderColor: 'rgba(255,255,255,0.1)', fontSize: 11 }} />+ </Box>+ </Box>+ </Drawer>+ );+}diff --git a/frontend/src/components/StatCard.jsx b/frontend/src/components/StatCard.jsxnew file mode 100644index 0000000..cabb3a4--- /dev/null+++ b/frontend/src/components/StatCard.jsx@@ -0,0 +1,53 @@+import React from 'react';+import { Card, CardContent, Box, Typography, Skeleton } from '@mui/material';++const GRADIENTS = {+ red: 'linear-gradient(135deg, #FF0000 0%, #FF4444 100%)',+ green: 'linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%)',+ blue: 'linear-gradient(135deg, #1565C0 0%, #42A5F5 100%)',+ orange: 'linear-gradient(135deg, #E65100 0%, #FF9800 100%)',+ purple: 'linear-gradient(135deg, #6A1B9A 0%, #AB47BC 100%)',+ teal: 'linear-gradient(135deg, #00695C 0%, #26A69A 100%)',+ pink: 'linear-gradient(135deg, #AD1457 0%, #EC407A 100%)',+ indigo: 'linear-gradient(135deg, #283593 0%, #5C6BC0 100%)',+ cyan: 'linear-gradient(135deg, #00838F 0%, #26C6DA 100%)',+ amber: 'linear-gradient(135deg, #FF6F00 0%, #FFCA28 100%)',+};++export default function StatCard({ icon, label, value, subtitle, gradient = 'blue', loading, small }) {+ return (+ <Card sx={{ height: '100%' }}>+ <CardContent sx={{ p: small ? 2 : 2.5, '&:last-child': { pb: small ? 2 : 2.5 } }}>+ <Box sx={{ display: 'flex', alignItems: 'flex-start', gap: 2 }}>+ <Box sx={{+ width: small ? 44 : 52, height: small ? 44 : 52, borderRadius: 2,+ background: GRADIENTS[gradient] || GRADIENTS.blue,+ display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0,+ }}>+ {React.cloneElement(icon, { sx: { color: '#fff', fontSize: small ? 22 : 26 } })}+ </Box>+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="body2" sx={{ color: 'text.secondary', fontSize: small ? 12 : 13, fontWeight: 500, mb: 0.3 }}>+ {label}+ </Typography>+ {loading ? (+ <Skeleton width="60%" height={small ? 28 : 36} />+ ) : (+ <Typography variant={small ? 'h6' : 'h5'} sx={{+ fontWeight: 700, lineHeight: 1.2, letterSpacing: '-0.02em',+ fontSize: small ? '1.1rem' : undefined,+ }}>+ {value}+ </Typography>+ )}+ {subtitle && (+ <Typography variant="caption" sx={{ color: 'text.secondary', fontSize: 11 }}>+ {subtitle}+ </Typography>+ )}+ </Box>+ </Box>+ </CardContent>+ </Card>+ );+}diff --git a/frontend/src/components/UploadContent.jsx b/frontend/src/components/UploadContent.jsxnew file mode 100644index 0000000..7358c4b--- /dev/null+++ b/frontend/src/components/UploadContent.jsx@@ -0,0 +1,963 @@+import React, { useState, useEffect, useRef, useCallback } from 'react';+import {+ Box, Typography, Card, CardContent, Grid, Button, TextField, Select,+ MenuItem, FormControl, InputLabel, Chip, LinearProgress, Avatar,+ Switch, FormControlLabel, CircularProgress, Alert, Stepper, Step,+ StepLabel, IconButton, Divider, Tooltip, InputAdornment,+} from '@mui/material';+import {+ CloudUpload, Instagram, Photo, Movie, ViewCarousel, AutoStories,+ Delete, CheckCircle, Error as ErrorIcon, Schedule, Send,+ Image as ImageIcon, VideoFile, Add, Close, Settings,+ PersonAdd, LocationOn, AlternateEmail, MusicNote, PhotoCamera,+ Timer, Science, CalendarMonth, AccessTime,+} from '@mui/icons-material';+import { api } from '../services/api';++const IG_GRADIENT = 'linear-gradient(135deg, #F58529, #DD2A7B, #8134AF, #515BD4)';++const CONTENT_TYPES = [+ { value: 'IMAGE', label: 'Photo Post', icon: <Photo />, color: '#F58529', accept: 'image/jpeg', desc: 'JPEG image, 4:5 to 1.91:1 ratio, max 8MB' },+ { value: 'REELS', label: 'Reel', icon: <Movie />, color: '#DD2A7B', accept: 'video/mp4,video/quicktime', desc: 'MP4/MOV, 9:16 ratio, 3s–15min, max 300MB' },+ { value: 'STORIES', label: 'Story', icon: <AutoStories />, color: '#8134AF', accept: 'image/jpeg,video/mp4,video/quicktime', desc: 'Image or video, 9:16, max 60s video' },+];++const PUBLISH_STEPS = ['Select Media', 'Configure', 'Upload & Publish'];++export default function UploadContent({ accounts, showToast }) {+ const [igAccounts, setIgAccounts] = useState([]);+ const [selectedAccount, setSelectedAccount] = useState('');+ const [contentType, setContentType] = useState('');+ const [file, setFile] = useState(null);+ const [filePreview, setFilePreview] = useState(null);+ const [cloudConfig, setCloudConfig] = useState(null);++ // Settings+ const [caption, setCaption] = useState('');+ const [shareToFeed, setShareToFeed] = useState(true);+ const [coverFile, setCoverFile] = useState(null);+ const [coverPreview, setCoverPreview] = useState(null);+ const [audioName, setAudioName] = useState('');+ const [thumbOffset, setThumbOffset] = useState('');+ const [locationId, setLocationId] = useState('');+ const [collaborators, setCollaborators] = useState('');+ const [userTags, setUserTags] = useState('');+ const [altText, setAltText] = useState('');++ // Schedule state+ const [scheduleMode, setScheduleMode] = useState(false);+ const [scheduleDate, setScheduleDate] = useState('');+ const [scheduleTime, setScheduleTime] = useState('');+ const [scheduledPosts, setScheduledPosts] = useState([]);+ const [showScheduled, setShowScheduled] = useState(false);+ const [loadingScheduled, setLoadingScheduled] = useState(false);++ // Publish state+ const [activeStep, setActiveStep] = useState(0);+ const [uploading, setUploading] = useState(false);+ const [uploadProgress, setUploadProgress] = useState(0);+ const [publishStatus, setPublishStatus] = useState(''); // '', 'uploading-cloudinary', 'creating-container', 'processing', 'publishing', 'done', 'error'+ const [statusMessage, setStatusMessage] = useState('');+ const [publishedMediaId, setPublishedMediaId] = useState(null);++ const fileInputRef = useRef(null);+ const coverInputRef = useRef(null);++ useEffect(() => {+ const ig = (accounts || []).filter(a => a.platform === 'instagram');+ setIgAccounts(ig);+ if (ig.length === 1) setSelectedAccount(ig[0].id);+ loadCloudinaryConfig();+ loadScheduledPosts();+ }, [accounts]);++ const loadScheduledPosts = async () => {+ try {+ const res = await api.getScheduledPosts();+ if (res.success) setScheduledPosts(res.posts || []);+ } catch { }+ };++ const loadCloudinaryConfig = async () => {+ try {+ const res = await api.getCloudinaryConfig();+ if (res.success) setCloudConfig(res);+ } catch { }+ };++ const handleFileSelect = (e) => {+ const f = e.target.files?.[0];+ if (!f) return;+ setFile(f);+ if (f.type.startsWith('image/')) {+ setFilePreview(URL.createObjectURL(f));+ } else if (f.type.startsWith('video/')) {+ setFilePreview(URL.createObjectURL(f));+ }+ };++ const handleCoverSelect = (e) => {+ const f = e.target.files?.[0];+ if (!f) return;+ setCoverFile(f);+ setCoverPreview(URL.createObjectURL(f));+ };++ const clearFile = () => {+ setFile(null);+ setFilePreview(null);+ if (fileInputRef.current) fileInputRef.current.value = '';+ };++ const clearCover = () => {+ setCoverFile(null);+ setCoverPreview(null);+ if (coverInputRef.current) coverInputRef.current.value = '';+ };++ const resetAll = () => {+ clearFile();+ clearCover();+ setCaption('');+ setShareToFeed(true);+ setAudioName('');+ setThumbOffset('');+ setLocationId('');+ setCollaborators('');+ setUserTags('');+ setAltText('');+ setContentType('');+ setActiveStep(0);+ setPublishStatus('');+ setStatusMessage('');+ setPublishedMediaId(null);+ setUploadProgress(0);+ setScheduleMode(false);+ setScheduleDate('');+ setScheduleTime('');+ };++ const uploadToCloudinary = async (fileToUpload) => {+ if (!cloudConfig) throw new Error('Cloudinary not configured. Go to Settings.');+ const formData = new FormData();+ formData.append('file', fileToUpload);+ formData.append('upload_preset', cloudConfig.uploadPreset);++ const resourceType = fileToUpload.type.startsWith('video/') ? 'video' : 'image';++ const xhr = new XMLHttpRequest();+ return new Promise((resolve, reject) => {+ xhr.upload.addEventListener('progress', (e) => {+ if (e.lengthComputable) {+ setUploadProgress(Math.round((e.loaded / e.total) * 100));+ }+ });+ xhr.addEventListener('load', () => {+ if (xhr.status >= 200 && xhr.status < 300) {+ const data = JSON.parse(xhr.responseText);+ resolve(data.secure_url);+ } else {+ try {+ const err = JSON.parse(xhr.responseText);+ reject(new Error(err.error?.message || 'Cloudinary upload failed'));+ } catch {+ reject(new Error('Cloudinary upload failed'));+ }+ }+ });+ xhr.addEventListener('error', () => reject(new Error('Network error during upload')));+ xhr.open('POST', `https://api.cloudinary.com/v1_1/${cloudConfig.cloudName}/${resourceType}/upload`);+ xhr.send(formData);+ });+ };++ const waitForContainer = async (containerId, accountId, maxAttempts = 30) => {+ for (let i = 0; i < maxAttempts; i++) {+ await new Promise(r => setTimeout(r, 3000));+ try {+ const status = await api.getIGContainerStatus(containerId, accountId);+ setStatusMessage(`Processing: ${status.statusCode || 'IN_PROGRESS'}...`);+ if (status.statusCode === 'FINISHED') return true;+ if (status.statusCode === 'ERROR') throw new Error('Container processing failed: ' + (status.status || 'Unknown error'));+ if (status.statusCode === 'EXPIRED') throw new Error('Container expired');+ if (status.statusCode === 'PUBLISHED') return true;+ } catch (err) {+ if (err.message.includes('processing failed') || err.message.includes('expired')) throw err;+ }+ }+ throw new Error('Timed out waiting for media processing');+ };++ const handlePublish = async () => {+ if (!selectedAccount || !file || !contentType) {+ showToast('Please select account, content type, and file', 'error');+ return;+ }+ if (!cloudConfig) {+ showToast('Cloudinary not configured. Please set it up in Settings.', 'error');+ return;+ }++ // If scheduling, upload to Cloudinary first then create scheduled post+ if (scheduleMode) {+ if (!scheduleDate || !scheduleTime) {+ showToast('Please set a schedule date and time', 'error');+ return;+ }+ const scheduledAt = new Date(`${scheduleDate}T${scheduleTime}`);+ const now = new Date();+ if (scheduledAt <= now) {+ showToast('Scheduled time must be in the future', 'error');+ return;+ }++ setUploading(true);+ setPublishStatus('uploading-cloudinary');+ setStatusMessage('Uploading file to CDN for scheduling...');+ setActiveStep(2);++ try {+ const mediaUrl = await uploadToCloudinary(file);+ let coverUrl = null;+ if (coverFile && contentType === 'REELS') {+ setStatusMessage('Uploading cover image...');+ coverUrl = await uploadToCloudinary(coverFile);+ }++ setPublishStatus('scheduling');+ setStatusMessage('Saving scheduled post...');++ const postData = {+ accountId: selectedAccount,+ platform: 'instagram',+ mediaType: contentType,+ mediaUrl,+ caption: caption || '',+ coverUrl: coverUrl || null,+ shareToFeed: contentType === 'REELS' ? shareToFeed : true,+ collaborators: collaborators ? collaborators.split(',').map(s => s.trim()).filter(Boolean) : [],+ audioName: audioName || '',+ thumbOffset: thumbOffset ? parseInt(thumbOffset) : null,+ locationId: locationId || '',+ userTags: userTags ? parseUserTags(userTags) : [],+ altText: (contentType === 'IMAGE' && altText) ? altText : '',+ scheduledAt: scheduledAt.toISOString(),+ };++ const res = await api.createScheduledPost(postData);+ if (!res.success) throw new Error(res.message || 'Failed to schedule');++ setPublishStatus('scheduled');+ setStatusMessage(`Scheduled for ${scheduledAt.toLocaleString()}`);+ showToast('Post scheduled successfully!', 'success');+ loadScheduledPosts();+ } catch (err) {+ setPublishStatus('error');+ setStatusMessage(err.message);+ showToast('Schedule failed: ' + err.message, 'error');+ } finally {+ setUploading(false);+ }+ return;+ }++ setUploading(true);+ setPublishStatus('uploading-cloudinary');+ setStatusMessage('Uploading file to CDN...');+ setActiveStep(2);++ try {+ // Step 1: Upload to Cloudinary+ const mediaUrl = await uploadToCloudinary(file);+ setStatusMessage('File uploaded to CDN successfully!');++ // Upload cover if provided+ let coverUrl = null;+ if (coverFile && contentType === 'REELS') {+ setStatusMessage('Uploading cover image...');+ coverUrl = await uploadToCloudinary(coverFile);+ }++ // Step 2: Create IG container+ setPublishStatus('creating-container');+ setStatusMessage('Creating Instagram media container...');++ const publishData = {+ mediaType: contentType,+ mediaUrl,+ caption: caption || undefined,+ coverUrl: coverUrl || undefined,+ shareToFeed: contentType === 'REELS' ? shareToFeed : undefined,+ collaborators: collaborators ? collaborators.split(',').map(s => s.trim()).filter(Boolean) : undefined,+ audioName: audioName || undefined,+ thumbOffset: thumbOffset ? parseInt(thumbOffset) : undefined,+ locationId: locationId || undefined,+ userTags: userTags ? parseUserTags(userTags) : undefined,+ altText: (contentType === 'IMAGE' && altText) ? altText : undefined,+ };++ const containerRes = await api.createIGContainer(selectedAccount, publishData);+ if (!containerRes.success || !containerRes.containerId) {+ throw new Error(containerRes.message || 'Failed to create container');+ }++ const containerId = containerRes.containerId;++ // Step 3: Wait for processing (videos need time)+ if (contentType === 'REELS' || contentType === 'STORIES') {+ setPublishStatus('processing');+ setStatusMessage('Instagram is processing the media...');+ await waitForContainer(containerId, selectedAccount);+ } else {+ // Images are usually ready immediately, but let's check once+ await new Promise(r => setTimeout(r, 2000));+ }++ // Step 4: Publish+ setPublishStatus('publishing');+ setStatusMessage('Publishing to Instagram...');++ const publishRes = await api.publishIGContainer(selectedAccount, containerId);+ if (!publishRes.success || !publishRes.mediaId) {+ throw new Error(publishRes.message || 'Failed to publish');+ }++ setPublishStatus('done');+ setPublishedMediaId(publishRes.mediaId);+ setStatusMessage('Published successfully!');+ showToast('Content published to Instagram!', 'success');++ } catch (err) {+ setPublishStatus('error');+ setStatusMessage(err.message);+ showToast('Publish failed: ' + err.message, 'error');+ } finally {+ setUploading(false);+ }+ };++ const parseUserTags = (str) => {+ // Format: "@user1, @user2" or "user1 0.5 0.5, user2 0.3 0.8"+ return str.split(',').map(s => {+ const parts = s.trim().replace(/^@/, '').split(/\s+/);+ return {+ username: parts[0],+ x: parts[1] ? parseFloat(parts[1]) : 0.5,+ y: parts[2] ? parseFloat(parts[2]) : 0.5,+ };+ }).filter(t => t.username);+ };++ const handleDeleteScheduled = async (id) => {+ try {+ await api.deleteScheduledPost(id);+ showToast('Scheduled post deleted', 'success');+ loadScheduledPosts();+ } catch (err) {+ showToast('Delete failed: ' + err.message, 'error');+ }+ };++ const canProceed = () => {+ if (activeStep === 0) return !!file && !!contentType && !!selectedAccount;+ if (activeStep === 1) return true;+ return false;+ };++ const selectedAcct = igAccounts.find(a => a.id === selectedAccount);+ const selectedType = CONTENT_TYPES.find(t => t.value === contentType);+ const isVideo = contentType === 'REELS' || (contentType === 'STORIES' && file?.type?.startsWith('video/'));++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 3, flexWrap: 'wrap', gap: 2 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>+ <CloudUpload sx={{ verticalAlign: 'middle', mr: 1.5, color: '#DD2A7B', fontSize: 36 }} />+ Upload Content+ </Typography>+ {publishStatus === 'done' && (+ <Button variant="contained" onClick={resetAll}+ sx={{ background: IG_GRADIENT }}>+ Upload Another+ </Button>+ )}+ </Box>++ {/* No IG accounts */}+ {igAccounts.length === 0 && (+ <Alert severity="warning" sx={{ mb: 3 }}>+ No Instagram accounts found. Add an account first in the Accounts section.+ </Alert>+ )}++ {/* No Cloudinary */}+ {!cloudConfig && (+ <Alert severity="info" sx={{ mb: 3 }}>+ <strong>Cloudinary CDN required</strong> — Instagram API needs media at a public URL.+ Configure Cloudinary in <strong>Settings</strong> to enable uploads.+ </Alert>+ )}++ {/* Stepper */}+ <Stepper activeStep={activeStep} sx={{ mb: 4 }}>+ {PUBLISH_STEPS.map((label) => (+ <Step key={label}>+ <StepLabel>{label}</StepLabel>+ </Step>+ ))}+ </Stepper>++ {/* STEP 0: Select Media */}+ {activeStep === 0 && (+ <Grid container spacing={3}>+ {/* Platform & Account */}+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ <Instagram sx={{ verticalAlign: 'middle', mr: 1, color: '#DD2A7B' }} />+ Platform & Account+ </Typography>++ <Box sx={{ mb: 2.5 }}>+ <Chip icon={<Instagram />} label="Instagram"+ sx={{ background: IG_GRADIENT, color: '#fff', fontWeight: 600, fontSize: 14, height: 36, px: 1 }} />+ <Typography variant="caption" sx={{ display: 'block', color: 'text.secondary', mt: 1 }}>+ YouTube uploads coming soon+ </Typography>+ </Box>++ <FormControl fullWidth size="small">+ <InputLabel>Select Account</InputLabel>+ <Select value={selectedAccount} label="Select Account"+ onChange={(e) => setSelectedAccount(e.target.value)}>+ {igAccounts.map(a => (+ <MenuItem key={a.id} value={a.id}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>+ <Avatar src={a.profilePictureUrl || a.thumbnailUrl || a.thumbnail}+ sx={{ width: 28, height: 28 }}>+ <Instagram sx={{ fontSize: 16 }} />+ </Avatar>+ <Box>+ <Typography sx={{ fontWeight: 500, fontSize: 14 }}>{a.title || a.username}</Typography>+ {a.username && <Typography variant="caption" sx={{ color: 'text.secondary' }}>@{a.username}</Typography>}+ </Box>+ </Box>+ </MenuItem>+ ))}+ </Select>+ </FormControl>+ </CardContent>+ </Card>+ </Grid>++ {/* Content Type */}+ <Grid size={{ xs: 12, md: 6 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Content Type+ </Typography>+ <Grid container spacing={1.5}>+ {CONTENT_TYPES.map(t => (+ <Grid size={{ xs: 4 }} key={t.value}>+ <Card+ onClick={() => { setContentType(t.value); clearFile(); }}+ sx={{+ cursor: 'pointer', textAlign: 'center', p: 2,+ border: contentType === t.value ? `2px solid ${t.color}` : '2px solid transparent',+ bgcolor: contentType === t.value ? `${t.color}15` : 'transparent',+ transition: 'all 0.2s',+ '&:hover': { bgcolor: `${t.color}10` },+ }}>+ <Box sx={{ color: t.color, mb: 0.5 }}>{t.icon}</Box>+ <Typography variant="body2" sx={{ fontWeight: 600, fontSize: 12 }}>{t.label}</Typography>+ </Card>+ </Grid>+ ))}+ </Grid>+ {selectedType && (+ <Typography variant="caption" sx={{ display: 'block', color: 'text.secondary', mt: 1.5 }}>+ {selectedType.desc}+ </Typography>+ )}+ </CardContent>+ </Card>+ </Grid>++ {/* File Upload */}+ <Grid size={12}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Select File+ </Typography>+ {!file ? (+ <Box+ onClick={() => contentType && fileInputRef.current?.click()}+ sx={{+ border: '2px dashed rgba(255,255,255,0.2)', borderRadius: 3,+ p: 6, textAlign: 'center', cursor: contentType ? 'pointer' : 'not-allowed',+ transition: 'all 0.2s',+ opacity: contentType ? 1 : 0.5,+ '&:hover': contentType ? { borderColor: '#DD2A7B', bgcolor: 'rgba(221,42,123,0.05)' } : {},+ }}>+ <CloudUpload sx={{ fontSize: 48, color: 'text.secondary', mb: 1 }} />+ <Typography variant="body1" sx={{ fontWeight: 500 }}>+ {contentType ? 'Click to select file' : 'Choose a content type first'}+ </Typography>+ {selectedType && (+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>+ {selectedType.desc}+ </Typography>+ )}+ </Box>+ ) : (+ <Box sx={{ display: 'flex', gap: 3, alignItems: 'flex-start' }}>+ <Box sx={{ width: 200, flexShrink: 0, borderRadius: 2, overflow: 'hidden', position: 'relative' }}>+ {file.type.startsWith('video/') ? (+ <video src={filePreview} controls muted+ style={{ width: '100%', maxHeight: 280, objectFit: 'contain', background: '#000', borderRadius: 8 }} />+ ) : (+ <Box component="img" src={filePreview}+ sx={{ width: '100%', maxHeight: 280, objectFit: 'contain', borderRadius: 2, bgcolor: '#111' }} />+ )}+ <IconButton onClick={clearFile} size="small"+ sx={{ position: 'absolute', top: 4, right: 4, bgcolor: 'rgba(0,0,0,0.7)', color: '#fff', '&:hover': { bgcolor: '#f44336' } }}>+ <Close fontSize="small" />+ </IconButton>+ </Box>+ <Box>+ <Typography variant="body1" sx={{ fontWeight: 600 }}>{file.name}</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>+ {(file.size / (1024 * 1024)).toFixed(2)} MB • {file.type}+ </Typography>+ <Chip label={selectedType?.label} size="small"+ sx={{ mt: 1, bgcolor: `${selectedType?.color}22`, color: selectedType?.color }} />+ </Box>+ </Box>+ )}+ <input ref={fileInputRef} type="file" hidden+ accept={selectedType?.accept || '*'}+ onChange={handleFileSelect} />+ </CardContent>+ </Card>+ </Grid>++ {/* Next button */}+ <Grid size={12}>+ <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>+ <Button variant="contained" disabled={!canProceed()}+ onClick={() => setActiveStep(1)}+ sx={{ background: IG_GRADIENT, px: 4 }}>+ Next: Configure Settings+ </Button>+ </Box>+ </Grid>+ </Grid>+ )}++ {/* STEP 1: Configure */}+ {activeStep === 1 && (+ <Grid container spacing={3}>+ {/* Caption */}+ <Grid size={{ xs: 12, md: 8 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ Caption & Details+ </Typography>+ <TextField fullWidth multiline rows={4} value={caption}+ onChange={e => setCaption(e.target.value)}+ placeholder="Write your caption... #hashtags @mentions"+ label="Caption" size="small" sx={{ mb: 2 }}+ helperText={`${caption.length}/2,200 characters`} />++ {contentType === 'IMAGE' && (+ <TextField fullWidth value={altText}+ onChange={e => setAltText(e.target.value)}+ placeholder="Describe the image for accessibility"+ label="Alt Text" size="small" sx={{ mb: 2 }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><ImageIcon sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />+ )}++ <TextField fullWidth value={collaborators}+ onChange={e => setCollaborators(e.target.value)}+ placeholder="username1, username2 (comma-separated)"+ label="Collaborators" size="small" sx={{ mb: 2 }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><PersonAdd sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />++ <TextField fullWidth value={userTags}+ onChange={e => setUserTags(e.target.value)}+ placeholder="@username1, @username2"+ label="Tag Users" size="small" sx={{ mb: 2 }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><AlternateEmail sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />++ <TextField fullWidth value={locationId}+ onChange={e => setLocationId(e.target.value)}+ placeholder="Facebook Page ID for location"+ label="Location ID (optional)" size="small"+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><LocationOn sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />+ </CardContent>+ </Card>+ </Grid>++ {/* Reel-specific settings */}+ <Grid size={{ xs: 12, md: 4 }}>+ <Card>+ <CardContent>+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 2 }}>+ {contentType === 'REELS' ? 'Reel Settings' : 'Post Settings'}+ </Typography>++ {contentType === 'REELS' && (+ <>+ <FormControlLabel+ control={<Switch checked={shareToFeed} onChange={(e) => setShareToFeed(e.target.checked)} />}+ label="Share to Feed"+ sx={{ mb: 2, display: 'block' }}+ />++ <TextField fullWidth value={audioName}+ onChange={e => setAudioName(e.target.value)}+ placeholder="Custom audio name"+ label="Audio Name" size="small" sx={{ mb: 2 }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><MusicNote sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />++ <TextField fullWidth value={thumbOffset}+ onChange={e => setThumbOffset(e.target.value)}+ placeholder="Milliseconds (e.g. 5000)"+ label="Thumbnail Offset (ms)" size="small" sx={{ mb: 2 }}+ type="number"+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><Timer sx={{ color: 'text.secondary', fontSize: 18 }} /></InputAdornment> } }} />++ <Typography variant="body2" sx={{ fontWeight: 500, mb: 1 }}>Cover Image (optional)</Typography>+ {!coverFile ? (+ <Button variant="outlined" size="small" startIcon={<PhotoCamera />}+ onClick={() => coverInputRef.current?.click()}+ sx={{ mb: 1, borderColor: 'rgba(255,255,255,0.15)' }}>+ Select Cover+ </Button>+ ) : (+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 1 }}>+ <Box component="img" src={coverPreview}+ sx={{ width: 50, height: 50, objectFit: 'cover', borderRadius: 1 }} />+ <Typography variant="caption" sx={{ flex: 1 }}>{coverFile.name}</Typography>+ <IconButton size="small" onClick={clearCover}><Close fontSize="small" /></IconButton>+ </Box>+ )}+ <input ref={coverInputRef} type="file" hidden accept="image/jpeg"+ onChange={handleCoverSelect} />+ </>+ )}++ {/* Preview info */}+ <Divider sx={{ my: 2 }} />+ <Typography variant="body2" sx={{ fontWeight: 500, mb: 1 }}>Summary</Typography>+ <Box sx={{ fontSize: 12, color: 'text.secondary' }}>+ <Box>Account: <strong style={{ color: '#fff' }}>{selectedAcct?.title || selectedAcct?.username || '—'}</strong></Box>+ <Box>Type: <strong style={{ color: selectedType?.color }}>{selectedType?.label}</strong></Box>+ <Box>File: <strong style={{ color: '#fff' }}>{file?.name || '—'}</strong></Box>+ <Box>Size: <strong style={{ color: '#fff' }}>{file ? `${(file.size / (1024 * 1024)).toFixed(2)} MB` : '—'}</strong></Box>+ {caption && <Box>Caption: <strong style={{ color: '#fff' }}>{caption.substring(0, 60)}{caption.length > 60 ? '...' : ''}</strong></Box>}+ {scheduleMode && scheduleDate && scheduleTime && (+ <Box>Schedule: <strong style={{ color: '#F58529' }}>{new Date(`${scheduleDate}T${scheduleTime}`).toLocaleString()}</strong></Box>+ )}+ </Box>+ </CardContent>+ </Card>+ </Grid>++ {/* Schedule Option */}+ <Grid size={12}>+ <Card>+ <CardContent>+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: scheduleMode ? 2 : 0 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ <Schedule sx={{ color: '#F58529' }} />+ <Typography variant="h6" sx={{ fontWeight: 600 }}>+ Schedule for Later+ </Typography>+ </Box>+ <FormControlLabel+ control={<Switch checked={scheduleMode} onChange={e => setScheduleMode(e.target.checked)} />}+ label={scheduleMode ? 'Scheduled' : 'Publish Now'}+ />+ </Box>+ {scheduleMode && (+ <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>+ <TextField+ type="date" value={scheduleDate}+ onChange={e => setScheduleDate(e.target.value)}+ label="Date" size="small"+ slotProps={{ inputLabel: { shrink: true }, input: { inputProps: { min: new Date().toISOString().split('T')[0] } } }}+ sx={{ minWidth: 180 }}+ />+ <TextField+ type="time" value={scheduleTime}+ onChange={e => setScheduleTime(e.target.value)}+ label="Time" size="small"+ slotProps={{ inputLabel: { shrink: true } }}+ sx={{ minWidth: 150 }}+ />+ {scheduleDate && scheduleTime && (+ <Chip+ icon={<CalendarMonth sx={{ fontSize: 16 }} />}+ label={new Date(`${scheduleDate}T${scheduleTime}`).toLocaleString()}+ color="warning" variant="outlined"+ sx={{ alignSelf: 'center' }}+ />+ )}+ </Box>+ )}+ {scheduleMode && (+ <Alert severity="info" sx={{ mt: 2 }}>+ <strong>Cloud Scheduling.</strong> Your file is uploaded to Cloudinary now. If GitHub Actions+ is configured (Settings), posts publish from the cloud even when your PC is off.+ Otherwise, keep the server running for on-time publishing.+ </Alert>+ )}+ </CardContent>+ </Card>+ </Grid>++ {/* Nav buttons */}+ <Grid size={12}>+ <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>+ <Button variant="outlined" onClick={() => setActiveStep(0)}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ Back+ </Button>+ <Box sx={{ display: 'flex', gap: 1.5 }}>+ <Button variant="contained" onClick={handlePublish}+ startIcon={uploading ? <CircularProgress size={16} /> : (scheduleMode ? <Schedule /> : <Send />)}+ disabled={uploading || (scheduleMode && (!scheduleDate || !scheduleTime))}+ sx={{ background: scheduleMode ? 'linear-gradient(135deg, #F58529, #FF6B35)' : IG_GRADIENT, px: 4 }}>+ {scheduleMode ? 'Schedule Post' : 'Upload & Publish Now'}+ </Button>+ </Box>+ </Box>+ </Grid>+ </Grid>+ )}++ {/* STEP 2: Upload & Publish Progress */}+ {activeStep === 2 && (+ <Card>+ <CardContent sx={{ textAlign: 'center', py: 6 }}>+ {publishStatus === 'uploading-cloudinary' && (+ <>+ <CloudUpload sx={{ fontSize: 56, color: '#3448C5', mb: 2 }} />+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 1 }}>Uploading to CDN...</Typography>+ <Box sx={{ maxWidth: 400, mx: 'auto', mb: 2 }}>+ <LinearProgress variant="determinate" value={uploadProgress}+ sx={{ height: 8, borderRadius: 4, '& .MuiLinearProgress-bar': { background: IG_GRADIENT } }} />+ </Box>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>{uploadProgress}% uploaded</Typography>+ </>+ )}++ {publishStatus === 'creating-container' && (+ <>+ <CircularProgress size={56} sx={{ color: '#DD2A7B', mb: 2 }} />+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 1 }}>Creating Instagram Container...</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>Sending media to Instagram API</Typography>+ </>+ )}++ {publishStatus === 'processing' && (+ <>+ <CircularProgress size={56} sx={{ color: '#8134AF', mb: 2 }} />+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 1 }}>Processing Media...</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>{statusMessage}</Typography>+ <Typography variant="caption" sx={{ color: 'text.disabled', display: 'block', mt: 1 }}>+ This may take a minute for videos+ </Typography>+ </>+ )}++ {publishStatus === 'publishing' && (+ <>+ <CircularProgress size={56} sx={{ color: '#F58529', mb: 2 }} />+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 1 }}>Publishing...</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>Almost there!</Typography>+ </>+ )}++ {publishStatus === 'done' && (+ <>+ <CheckCircle sx={{ fontSize: 64, color: '#4CAF50', mb: 2 }} />+ <Typography variant="h5" sx={{ fontWeight: 700, mb: 1, color: '#4CAF50' }}>+ Published Successfully!+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3 }}>+ Your {selectedType?.label?.toLowerCase()} is now live on Instagram.+ </Typography>+ {publishedMediaId && (+ <Chip label={`Media ID: ${publishedMediaId}`} variant="outlined"+ sx={{ mb: 3, borderColor: 'rgba(255,255,255,0.15)' }} />+ )}+ <Box sx={{ display: 'flex', gap: 2, justifyContent: 'center' }}>+ <Button variant="contained" onClick={resetAll}+ sx={{ background: IG_GRADIENT }}>+ Upload Another+ </Button>+ <Button variant="outlined" onClick={() => {+ if (selectedAcct?.username) {+ window.open(`https://instagram.com/${selectedAcct.username}`, '_blank');+ }+ }}+ startIcon={<Instagram />}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ View Profile+ </Button>+ </Box>+ </>+ )}++ {publishStatus === 'error' && (+ <>+ <ErrorIcon sx={{ fontSize: 64, color: '#f44336', mb: 2 }} />+ <Typography variant="h5" sx={{ fontWeight: 700, mb: 1, color: '#f44336' }}>+ {scheduleMode ? 'Schedule Failed' : 'Publish Failed'}+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 3, maxWidth: 500, mx: 'auto' }}>+ {statusMessage}+ </Typography>+ <Box sx={{ display: 'flex', gap: 2, justifyContent: 'center' }}>+ <Button variant="contained" onClick={() => { setActiveStep(1); setPublishStatus(''); }}+ sx={{ background: IG_GRADIENT }}>+ Try Again+ </Button>+ <Button variant="outlined" onClick={resetAll}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ Start Over+ </Button>+ </Box>+ </>+ )}++ {publishStatus === 'scheduling' && (+ <>+ <CircularProgress size={56} sx={{ color: '#F58529', mb: 2 }} />+ <Typography variant="h6" sx={{ fontWeight: 600, mb: 1 }}>Saving Schedule...</Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>{statusMessage}</Typography>+ </>+ )}++ {publishStatus === 'scheduled' && (+ <>+ <Schedule sx={{ fontSize: 64, color: '#F58529', mb: 2 }} />+ <Typography variant="h5" sx={{ fontWeight: 700, mb: 1, color: '#F58529' }}>+ Post Scheduled!+ </Typography>+ <Typography variant="body2" sx={{ color: 'text.secondary', mb: 1 }}>+ Your {selectedType?.label?.toLowerCase()} has been scheduled.+ </Typography>+ <Typography variant="body1" sx={{ fontWeight: 600, mb: 3 }}>+ {statusMessage}+ </Typography>+ <Alert severity="info" sx={{ maxWidth: 500, mx: 'auto', mb: 3, textAlign: 'left' }}>+ Your post is synced and will auto-publish at the scheduled time.+ With <strong>GitHub Actions</strong> configured, it publishes even when your PC is off.+ </Alert>+ <Box sx={{ display: 'flex', gap: 2, justifyContent: 'center' }}>+ <Button variant="contained" onClick={resetAll}+ sx={{ background: 'linear-gradient(135deg, #F58529, #FF6B35)' }}>+ Schedule Another+ </Button>+ <Button variant="outlined" onClick={() => { setShowScheduled(true); resetAll(); }}+ startIcon={<CalendarMonth />}+ sx={{ borderColor: 'rgba(255,255,255,0.15)' }}>+ View Scheduled+ </Button>+ </Box>+ </>+ )}+ </CardContent>+ </Card>+ )}++ {/* Scheduled Posts */}+ {scheduledPosts.length > 0 && (+ <Card sx={{ mt: 3 }}>+ <CardContent>+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}>+ <Typography variant="h6" sx={{ fontWeight: 600 }}>+ <CalendarMonth sx={{ verticalAlign: 'middle', mr: 1, color: '#F58529' }} />+ Scheduled Posts ({scheduledPosts.filter(p => p.status === 'pending').length} pending)+ </Typography>+ <Button size="small" onClick={loadScheduledPosts} startIcon={<Schedule />}+ sx={{ color: 'text.secondary' }}>Refresh</Button>+ </Box>+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>+ {scheduledPosts.sort((a, b) => new Date(a.scheduledAt) - new Date(b.scheduledAt)).map(post => {+ const acct = igAccounts.find(a => a.id === post.accountId);+ const typeInfo = CONTENT_TYPES.find(t => t.value === post.mediaType);+ const isPast = new Date(post.scheduledAt) < new Date();+ return (+ <Box key={post.id} sx={{+ display: 'flex', alignItems: 'center', gap: 2, p: 1.5,+ borderRadius: 2, bgcolor: 'rgba(255,255,255,0.03)',+ border: '1px solid rgba(255,255,255,0.06)',+ }}>+ <Box sx={{ color: typeInfo?.color || '#888', flexShrink: 0 }}>+ {typeInfo?.icon || <Photo />}+ </Box>+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="body2" sx={{ fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {post.caption || '(no caption)'}+ </Typography>+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>+ {acct?.username ? `@${acct.username}` : post.accountId} · {typeInfo?.label} · {new Date(post.scheduledAt).toLocaleString()}+ </Typography>+ </Box>+ <Chip+ size="small"+ label={post.status === 'published' ? 'Published' : post.status === 'failed' ? 'Failed' : post.status === 'publishing' ? 'Publishing...' : 'Pending'}+ sx={{+ fontWeight: 600, fontSize: 11,+ bgcolor: post.status === 'published' ? '#4CAF5022' : post.status === 'failed' ? '#f4433622' : post.status === 'publishing' ? '#FF980022' : '#F5852922',+ color: post.status === 'published' ? '#4CAF50' : post.status === 'failed' ? '#f44336' : post.status === 'publishing' ? '#FF9800' : '#F58529',+ }}+ />+ {(post.status === 'scheduled' || post.status === 'pending') && (+ <IconButton size="small" onClick={() => handleDeleteScheduled(post.id)}+ sx={{ color: 'text.secondary', '&:hover': { color: '#f44336' } }}>+ <Delete fontSize="small" />+ </IconButton>+ )}+ {post.status === 'failed' && post.error && (+ <Tooltip title={post.error}>+ <ErrorIcon sx={{ color: '#f44336', fontSize: 18 }} />+ </Tooltip>+ )}+ </Box>+ );+ })}+ </Box>+ </CardContent>+ </Card>+ )}++ {/* API Info */}+ <Card sx={{ mt: 3 }}>+ <CardContent>+ <Typography variant="body2" sx={{ color: 'text.secondary', fontSize: 12 }}>+ <strong>How it works:</strong> Files are uploaded to Cloudinary CDN first (Instagram requires public URLs),+ then a media container is created via the Instagram API, processed by Instagram's servers, and published.+ Rate limit: 100 posts per 24 hours per account.+ </Typography>+ <Box sx={{ display: 'flex', gap: 1, mt: 1.5, flexWrap: 'wrap' }}>+ <Chip label="JPEG Photos" size="small" variant="outlined" sx={{ borderColor: '#F5852922', color: '#F58529', fontSize: 11 }} />+ <Chip label="MP4/MOV Reels" size="small" variant="outlined" sx={{ borderColor: '#DD2A7B22', color: '#DD2A7B', fontSize: 11 }} />+ <Chip label="Stories" size="small" variant="outlined" sx={{ borderColor: '#8134AF22', color: '#8134AF', fontSize: 11 }} />+ <Chip label="Max 300MB videos" size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.1)', fontSize: 11 }} />+ <Chip label="Requires instagram_business_content_publish" size="small" variant="outlined" sx={{ borderColor: 'rgba(255,255,255,0.1)', fontSize: 11 }} />+ </Box>+ </CardContent>+ </Card>+ </Box>+ );+}diff --git a/frontend/src/components/VideoExplorer.jsx b/frontend/src/components/VideoExplorer.jsxnew file mode 100644index 0000000..304c36e--- /dev/null+++ b/frontend/src/components/VideoExplorer.jsx@@ -0,0 +1,452 @@+import React, { useState, useEffect, useMemo } from 'react';+import {+ Box, Typography, Card, CardContent, Grid, TextField, InputAdornment,+ Select, MenuItem, FormControl, InputLabel, Chip, IconButton, Tooltip,+ LinearProgress, Table, TableBody, TableCell, TableContainer, TableHead,+ TableRow, Avatar, Button, ToggleButton, ToggleButtonGroup, Pagination,+ Skeleton, Paper, Divider, TableSortLabel,+} from '@mui/material';+import {+ Search, OpenInNew, Visibility, ThumbUp, Comment, FilterList,+ ViewList, ViewModule, Sort, PlayCircleOutline, TrendingUp,+ Schedule, Speed, YouTube,+} from '@mui/icons-material';+import { api } from '../services/api';+import { fmtNum, fmtNumFull, fmtDate, fmtDuration, fmtPercent, timeAgo } from '../utils/formatters';++const ITEMS_PER_PAGE = 25;++function parseDurationToSeconds(iso) {+ if (!iso || iso === 'P0D') return 0;+ const m = iso.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);+ if (!m) return 0;+ return (parseInt(m[1] || 0) * 3600) + (parseInt(m[2] || 0) * 60) + parseInt(m[3] || 0);+}++const PERFORMANCE_TIERS = [+ { label: 'All', value: 'all' },+ { label: 'Viral (>1M)', value: 'viral', min: 1000000 },+ { label: 'High (100K–1M)', value: 'high', min: 100000, max: 1000000 },+ { label: 'Medium (10K–100K)', value: 'medium', min: 10000, max: 100000 },+ { label: 'Low (<10K)', value: 'low', max: 10000 },+];++export default function VideoExplorer({ accounts, showToast }) {+ const [videos, setVideos] = useState([]);+ const [loading, setLoading] = useState(true);+ const [search, setSearch] = useState('');+ const [channelFilter, setChannelFilter] = useState('all');+ const [performanceTier, setPerformanceTier] = useState('all');+ const [sortField, setSortField] = useState('viewCount');+ const [sortOrder, setSortOrder] = useState('desc');+ const [viewMode, setViewMode] = useState('table');+ const [page, setPage] = useState(1);+ const [channels, setChannels] = useState([]);++ useEffect(() => {+ loadAllVideos();+ }, [accounts]);++ const loadAllVideos = async () => {+ setLoading(true);+ try {+ const allVids = [];+ const channelList = [];+ for (const acct of (accounts || [])) {+ try {+ const res = await api.getVideos(acct.id);+ const vids = res.videos || res.data?.videos || [];+ const channelTitle = acct.title || acct.name || acct.channelTitle || 'Unknown';+ channelList.push({ id: acct.id, title: channelTitle, thumbnail: acct.thumbnails?.default || acct.thumbnailUrl || '' });+ allVids.push(...vids.map(v => {+ const thumb = v.thumbnail || v.thumbnails?.medium || v.thumbnails?.high || v.thumbnails?.default || '';+ const views = v.viewCount || 0;+ const likes = v.likeCount || 0;+ const comments = v.commentCount || 0;+ return {+ ...v,+ thumbnail: thumb,+ channelTitle,+ channelId: acct.id,+ channelThumbnail: acct.thumbnails?.default || acct.thumbnailUrl || '',+ engagementRate: views > 0 ? ((likes + comments) / views * 100).toFixed(2) : '0.00',+ durationSeconds: v.durationSeconds || parseDurationToSeconds(v.duration),+ };+ }));+ } catch (e) {+ console.warn(`Failed to load videos for ${acct.id}:`, e.message);+ }+ }+ setVideos(allVids);+ setChannels(channelList);+ } catch (err) {+ showToast('Failed to load videos: ' + err.message, 'error');+ } finally {+ setLoading(false);+ }+ };++ const filteredVideos = useMemo(() => {+ let result = [...videos];++ // Channel filter+ if (channelFilter !== 'all') {+ result = result.filter(v => v.channelId === channelFilter);+ }++ // Search filter+ if (search.trim()) {+ const q = search.toLowerCase();+ result = result.filter(v =>+ v.title?.toLowerCase().includes(q) ||+ (v.tags || []).some(t => t.toLowerCase().includes(q))+ );+ }++ // Performance tier+ if (performanceTier !== 'all') {+ const tier = PERFORMANCE_TIERS.find(t => t.value === performanceTier);+ if (tier) {+ if (tier.min != null) result = result.filter(v => (v.viewCount || 0) >= tier.min);+ if (tier.max != null) result = result.filter(v => (v.viewCount || 0) < tier.max);+ }+ }++ // Sort+ result.sort((a, b) => {+ const aVal = a[sortField] ?? 0;+ const bVal = b[sortField] ?? 0;+ if (typeof aVal === 'string') return sortOrder === 'asc' ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);+ return sortOrder === 'asc' ? aVal - bVal : bVal - aVal;+ });++ return result;+ }, [videos, channelFilter, search, performanceTier, sortField, sortOrder]);++ const pageCount = Math.ceil(filteredVideos.length / ITEMS_PER_PAGE);+ const paginatedVideos = filteredVideos.slice((page - 1) * ITEMS_PER_PAGE, page * ITEMS_PER_PAGE);++ const handleSort = (field) => {+ if (sortField === field) {+ setSortOrder(prev => prev === 'asc' ? 'desc' : 'asc');+ } else {+ setSortField(field);+ setSortOrder('desc');+ }+ };++ const openOnYouTube = (videoId) => {+ window.open(`https://www.youtube.com/watch?v=${videoId}`, '_blank', 'noopener');+ };++ // Stats summary+ const stats = useMemo(() => {+ const total = filteredVideos.length;+ const totalViews = filteredVideos.reduce((s, v) => s + (v.viewCount || 0), 0);+ const totalLikes = filteredVideos.reduce((s, v) => s + (v.likeCount || 0), 0);+ const totalComments = filteredVideos.reduce((s, v) => s + (v.commentCount || 0), 0);+ const avgViews = total > 0 ? Math.round(totalViews / total) : 0;+ return { total, totalViews, totalLikes, totalComments, avgViews };+ }, [filteredVideos]);++ if (loading) {+ return (+ <Box>+ <Typography variant="h4" sx={{ fontWeight: 700, mb: 3 }}>+ <YouTube sx={{ verticalAlign: 'middle', mr: 1, color: '#FF0000', fontSize: 36 }} />+ Video Explorer+ </Typography>+ <LinearProgress color="error" sx={{ mb: 3 }} />+ <Grid container spacing={2}>+ {[...Array(6)].map((_, i) => (+ <Grid size={{ xs: 12, sm: 6, md: 4 }} key={i}>+ <Skeleton variant="rounded" height={200} sx={{ borderRadius: 3 }} />+ </Grid>+ ))}+ </Grid>+ </Box>+ );+ }++ return (+ <Box>+ {/* Header */}+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 3, flexWrap: 'wrap', gap: 2 }}>+ <Typography variant="h4" sx={{ fontWeight: 700 }}>+ <YouTube sx={{ verticalAlign: 'middle', mr: 1, color: '#FF0000', fontSize: 36 }} />+ Video Explorer+ </Typography>+ <Button variant="contained" onClick={loadAllVideos}+ sx={{ background: 'linear-gradient(135deg, #FF0000, #FF4444)' }}>+ Refresh All+ </Button>+ </Box>++ {/* Summary Stats */}+ <Grid container spacing={2} sx={{ mb: 3 }}>+ <Grid size={{ xs: 6, sm: 4, md: 2.4 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Videos</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700 }}>{fmtNum(stats.total)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2.4 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Views</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#FF0000' }}>{fmtNum(stats.totalViews)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2.4 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Likes</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#4CAF50' }}>{fmtNum(stats.totalLikes)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2.4 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Total Comments</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#3EA6FF' }}>{fmtNum(stats.totalComments)}</Typography>+ </Card>+ </Grid>+ <Grid size={{ xs: 6, sm: 4, md: 2.4 }}>+ <Card sx={{ textAlign: 'center', p: 1.5 }}>+ <Typography variant="caption" color="text.secondary">Avg Views</Typography>+ <Typography variant="h5" sx={{ fontWeight: 700, color: '#FF9800' }}>{fmtNum(stats.avgViews)}</Typography>+ </Card>+ </Grid>+ </Grid>++ {/* Filters */}+ <Card sx={{ mb: 3, p: 2 }}>+ <Grid container spacing={2} alignItems="center">+ <Grid size={{ xs: 12, sm: 4 }}>+ <TextField+ fullWidth size="small" placeholder="Search videos by title or tag..."+ value={search} onChange={(e) => { setSearch(e.target.value); setPage(1); }}+ slotProps={{ input: { startAdornment: <InputAdornment position="start"><Search sx={{ color: 'text.secondary' }} /></InputAdornment> } }}+ />+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Channel</InputLabel>+ <Select value={channelFilter} label="Channel"+ onChange={(e) => { setChannelFilter(e.target.value); setPage(1); }}>+ <MenuItem value="all">All Channels ({channels.length})</MenuItem>+ {channels.map(c => (+ <MenuItem key={c.id} value={c.id}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ {c.thumbnail && <Avatar src={c.thumbnail} sx={{ width: 20, height: 20 }} />}+ {c.title}+ </Box>+ </MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 6, sm: 3 }}>+ <FormControl fullWidth size="small">+ <InputLabel>Performance</InputLabel>+ <Select value={performanceTier} label="Performance"+ onChange={(e) => { setPerformanceTier(e.target.value); setPage(1); }}>+ {PERFORMANCE_TIERS.map(t => (+ <MenuItem key={t.value} value={t.value}>{t.label}</MenuItem>+ ))}+ </Select>+ </FormControl>+ </Grid>+ <Grid size={{ xs: 12, sm: 2 }}>+ <ToggleButtonGroup value={viewMode} exclusive onChange={(_, v) => v && setViewMode(v)} size="small" fullWidth>+ <ToggleButton value="table"><ViewList /></ToggleButton>+ <ToggleButton value="grid"><ViewModule /></ToggleButton>+ </ToggleButtonGroup>+ </Grid>+ </Grid>+ <Box sx={{ mt: 1.5 }}>+ <Typography variant="caption" color="text.secondary">+ Showing {paginatedVideos.length} of {filteredVideos.length} videos+ {channelFilter !== 'all' && ` • Channel: ${channels.find(c => c.id === channelFilter)?.title}`}+ {performanceTier !== 'all' && ` • ${PERFORMANCE_TIERS.find(t => t.value === performanceTier)?.label}`}+ </Typography>+ </Box>+ </Card>++ {/* Table View */}+ {viewMode === 'table' && (+ <Card>+ <TableContainer sx={{ maxHeight: 700 }}>+ <Table size="small" stickyHeader>+ <TableHead>+ <TableRow>+ <TableCell sx={{ bgcolor: '#1A1A1A', width: 40 }}>#</TableCell>+ <TableCell sx={{ bgcolor: '#1A1A1A', width: 60 }}></TableCell>+ <TableCell sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'title'} direction={sortField === 'title' ? sortOrder : 'asc'} onClick={() => handleSort('title')}>+ Video+ </TableSortLabel>+ </TableCell>+ {channels.length > 1 && <TableCell sx={{ bgcolor: '#1A1A1A' }}>Channel</TableCell>}+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'viewCount'} direction={sortField === 'viewCount' ? sortOrder : 'desc'} onClick={() => handleSort('viewCount')}>+ Views+ </TableSortLabel>+ </TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'likeCount'} direction={sortField === 'likeCount' ? sortOrder : 'desc'} onClick={() => handleSort('likeCount')}>+ Likes+ </TableSortLabel>+ </TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'commentCount'} direction={sortField === 'commentCount' ? sortOrder : 'desc'} onClick={() => handleSort('commentCount')}>+ Comments+ </TableSortLabel>+ </TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'engagementRate'} direction={sortField === 'engagementRate' ? sortOrder : 'desc'} onClick={() => handleSort('engagementRate')}>+ Engagement+ </TableSortLabel>+ </TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'durationSeconds'} direction={sortField === 'durationSeconds' ? sortOrder : 'desc'} onClick={() => handleSort('durationSeconds')}>+ Duration+ </TableSortLabel>+ </TableCell>+ <TableCell align="right" sx={{ bgcolor: '#1A1A1A' }}>+ <TableSortLabel active={sortField === 'publishedAt'} direction={sortField === 'publishedAt' ? sortOrder : 'desc'} onClick={() => handleSort('publishedAt')}>+ Published+ </TableSortLabel>+ </TableCell>+ <TableCell align="center" sx={{ bgcolor: '#1A1A1A', width: 50 }}>Watch</TableCell>+ </TableRow>+ </TableHead>+ <TableBody>+ {paginatedVideos.map((v, i) => (+ <TableRow key={`${v.videoId}-${i}`} hover sx={{ cursor: 'pointer' }} onClick={() => openOnYouTube(v.videoId)}>+ <TableCell>{(page - 1) * ITEMS_PER_PAGE + i + 1}</TableCell>+ <TableCell>+ {v.thumbnail && (+ <Box component="img" src={v.thumbnail} sx={{ width: 60, height: 34, borderRadius: 1, objectFit: 'cover' }} />+ )}+ </TableCell>+ <TableCell>+ <Typography variant="body2" sx={{ fontWeight: 500, maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {v.title}+ </Typography>+ </TableCell>+ {channels.length > 1 && (+ <TableCell>+ <Chip label={v.channelTitle} size="small" variant="outlined"+ sx={{ fontSize: 11, maxWidth: 120, '& .MuiChip-label': { overflow: 'hidden', textOverflow: 'ellipsis' } }} />+ </TableCell>+ )}+ <TableCell align="right" sx={{ fontWeight: 600 }}>{fmtNum(v.viewCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.likeCount)}</TableCell>+ <TableCell align="right">{fmtNum(v.commentCount)}</TableCell>+ <TableCell align="right">+ <Chip label={fmtPercent(v.engagementRate)} size="small"+ sx={{+ bgcolor: parseFloat(v.engagementRate) > 5 ? 'rgba(76,175,80,0.15)' : 'rgba(255,255,255,0.05)',+ color: parseFloat(v.engagementRate) > 5 ? '#4CAF50' : 'text.secondary',+ fontWeight: 600, fontSize: 11,+ }} />+ </TableCell>+ <TableCell align="right">{fmtDuration(v.durationSeconds)}</TableCell>+ <TableCell align="right">+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>{fmtDate(v.publishedAt)}</Typography>+ </TableCell>+ <TableCell align="center">+ <Tooltip title="Watch on YouTube">+ <IconButton size="small" onClick={(e) => { e.stopPropagation(); openOnYouTube(v.videoId); }}+ sx={{ color: '#FF0000', '&:hover': { bgcolor: 'rgba(255,0,0,0.1)' } }}>+ <PlayCircleOutline fontSize="small" />+ </IconButton>+ </Tooltip>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </TableContainer>+ </Card>+ )}++ {/* Grid View */}+ {viewMode === 'grid' && (+ <Grid container spacing={2}>+ {paginatedVideos.map((v, i) => (+ <Grid size={{ xs: 12, sm: 6, md: 4, lg: 3 }} key={`${v.videoId}-${i}`}>+ <Card sx={{+ cursor: 'pointer',+ '&:hover': { transform: 'translateY(-4px)', transition: 'all 0.2s', boxShadow: '0 8px 24px rgba(0,0,0,0.3)' },+ }} onClick={() => openOnYouTube(v.videoId)}>+ <Box sx={{ position: 'relative' }}>+ <Box component="img" src={v.thumbnail} sx={{ width: '100%', aspectRatio: '16/9', objectFit: 'cover' }} />+ {/* Play overlay */}+ <Box sx={{+ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,+ display: 'flex', alignItems: 'center', justifyContent: 'center',+ bgcolor: 'rgba(0,0,0,0)', transition: 'all 0.2s',+ '&:hover': { bgcolor: 'rgba(0,0,0,0.4)' },+ }}>+ <PlayCircleOutline sx={{+ fontSize: 48, color: '#fff', opacity: 0, transition: 'opacity 0.2s',+ '.MuiCard-root:hover &': { opacity: 1 }+ }} />+ </Box>+ {/* Duration badge */}+ {v.durationSeconds > 0 && (+ <Chip label={fmtDuration(v.durationSeconds)} size="small"+ sx={{ position: 'absolute', bottom: 6, right: 6, bgcolor: 'rgba(0,0,0,0.85)', color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ )}+ {/* Views badge */}+ <Chip icon={<Visibility sx={{ fontSize: '14px !important', color: '#fff !important' }} />}+ label={fmtNum(v.viewCount)} size="small"+ sx={{ position: 'absolute', top: 6, right: 6, bgcolor: 'rgba(0,0,0,0.75)', color: '#fff', fontSize: 11, fontWeight: 600, height: 22 }} />+ </Box>+ <CardContent sx={{ p: 1.5, '&:last-child': { pb: 1.5 } }}>+ <Typography variant="body2" sx={{ fontWeight: 600, mb: 0.5, display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden', lineHeight: 1.4 }}>+ {v.title}+ </Typography>+ {channels.length > 1 && (+ <Typography variant="caption" sx={{ color: 'text.secondary', display: 'block', mb: 0.5 }}>+ {v.channelTitle}+ </Typography>+ )}+ <Box sx={{ display: 'flex', gap: 1.5, fontSize: 11, color: 'text.secondary', alignItems: 'center' }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <ThumbUp sx={{ fontSize: 13 }} /> {fmtNum(v.likeCount)}+ </Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.3 }}>+ <Comment sx={{ fontSize: 13 }} /> {fmtNum(v.commentCount)}+ </Box>+ <Box sx={{ ml: 'auto', fontSize: 11 }}>{timeAgo(v.publishedAt)}</Box>+ </Box>+ </CardContent>+ </Card>+ </Grid>+ ))}+ </Grid>+ )}++ {/* Pagination */}+ {pageCount > 1 && (+ <Box sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}>+ <Pagination count={pageCount} page={page} onChange={(_, p) => setPage(p)}+ color="error" shape="rounded" size="large" />+ </Box>+ )}++ {/* Empty state */}+ {filteredVideos.length === 0 && !loading && (+ <Box sx={{ textAlign: 'center', py: 8 }}>+ <YouTube sx={{ fontSize: 64, color: 'text.disabled', mb: 2 }} />+ <Typography variant="h6" color="text.secondary">No videos found</Typography>+ <Typography variant="body2" color="text.disabled" sx={{ mt: 1 }}>+ {accounts?.length === 0+ ? 'Add a channel first to explore videos'+ : 'Try adjusting your filters or search query'}+ </Typography>+ </Box>+ )}+ </Box>+ );+}diff --git a/frontend/src/main.jsx b/frontend/src/main.jsxnew file mode 100644index 0000000..d76b758--- /dev/null+++ b/frontend/src/main.jsx@@ -0,0 +1,9 @@+import React from 'react';+import ReactDOM from 'react-dom/client';+import App from './App';++ReactDOM.createRoot(document.getElementById('root')).render(+ <React.StrictMode>+ <App />+ </React.StrictMode>+);diff --git a/frontend/src/services/api.js b/frontend/src/services/api.jsnew file mode 100644index 0000000..081c2d7--- /dev/null+++ b/frontend/src/services/api.js@@ -0,0 +1,64 @@+const API = 'http://localhost:3001/api';++async function request(path, options = {}) {+ const res = await fetch(`${API}${path}`, {+ headers: { 'Content-Type': 'application/json' },+ ...options,+ });+ const data = await res.json();+ if (!res.ok && !data.success) throw new Error(data.message || 'Request failed');+ return data;+}++export const api = {+ // Health+ health: () => request('/health'),++ // API Keys+ getKeys: () => request('/keys'),+ saveKey: (youtube) => request('/keys', { method: 'POST', body: JSON.stringify({ youtube }) }),+ saveKeys: (data) => request('/keys', { method: 'POST', body: JSON.stringify(data) }),++ // Accounts+ getAccounts: () => request('/accounts'),+ addAccount: (input) => request('/accounts', { method: 'POST', body: JSON.stringify({ input }) }),+ deleteAccount: (id) => request(`/accounts/${id}`, { method: 'DELETE' }),+ refreshAccount: (id) => request(`/accounts/${id}/refresh`, { method: 'POST' }),+ refreshAll: () => request('/accounts/refresh-all', { method: 'POST' }),++ // Instagram accounts+ addInstagramAccount: (accessToken) => request('/accounts/instagram', { method: 'POST', body: JSON.stringify({ accessToken }) }),+ refreshIGToken: (id) => request(`/accounts/${id}/refresh-ig-token`, { method: 'POST' }),+ getIGAnalytics: (id) => request(`/accounts/${id}/ig-analytics`),+ getIGMedia: (id) => request(`/accounts/${id}/ig-media`),++ // Channel URL/ID resolution+ resolveChannel: (input) => request('/resolve-channel', { method: 'POST', body: JSON.stringify({ input }) }),++ // Analytics (YouTube)+ getAnalytics: (id) => request(`/accounts/${id}/analytics`),+ getVideos: (id) => request(`/accounts/${id}/videos`),++ // Comparison+ getComparison: () => request('/comparison'),++ // Cloudinary config+ getCloudinaryConfig: () => request('/cloudinary-config'),++ // Instagram Publishing+ getIGPublishingLimit: (id) => request(`/accounts/${id}/ig-publishing-limit`),+ createIGContainer: (id, data) => request(`/accounts/${id}/ig-publish`, { method: 'POST', body: JSON.stringify(data) }),+ getIGContainerStatus: (containerId, accountId) => request(`/ig-container/${containerId}/status?accountId=${accountId}`),+ publishIGContainer: (id, containerId) => request(`/accounts/${id}/ig-media-publish`, { method: 'POST', body: JSON.stringify({ containerId }) }),++ // Scheduled Posts+ getScheduledPosts: () => request('/scheduled-posts'),+ createScheduledPost: (data) => request('/scheduled-posts', { method: 'POST', body: JSON.stringify(data) }),+ updateScheduledPost: (id, data) => request(`/scheduled-posts/${id}`, { method: 'PUT', body: JSON.stringify(data) }),+ deleteScheduledPost: (id) => request(`/scheduled-posts/${id}`, { method: 'DELETE' }),+ processScheduled: () => request('/process-scheduled'),++ // GitHub Sync+ syncToGitHub: () => request('/github-sync', { method: 'POST' }),+ pullFromGitHub: () => request('/github-pull', { method: 'POST' }),+};diff --git a/frontend/src/theme.js b/frontend/src/theme.jsnew file mode 100644index 0000000..46f8383--- /dev/null+++ b/frontend/src/theme.js@@ -0,0 +1,92 @@+import { createTheme } from '@mui/material/styles';++const theme = createTheme({+ palette: {+ mode: 'dark',+ primary: { main: '#FF0000', light: '#FF4444', dark: '#CC0000' },+ secondary: { main: '#3EA6FF', light: '#6EC6FF', dark: '#0078D4' },+ background: { default: '#0F0F0F', paper: '#1A1A1A' },+ success: { main: '#2E7D32', light: '#4CAF50' },+ warning: { main: '#FF9800', light: '#FFB74D' },+ error: { main: '#F44336', light: '#EF5350' },+ text: { primary: '#FFFFFF', secondary: '#AAAAAA' },+ divider: 'rgba(255,255,255,0.08)',+ youtube: { main: '#FF0000', dark: '#CC0000', contrastText: '#fff' },+ },+ typography: {+ fontFamily: '"Inter", "Roboto", "Helvetica", "Arial", sans-serif',+ h3: { fontWeight: 700, letterSpacing: '-0.02em' },+ h4: { fontWeight: 700, letterSpacing: '-0.02em' },+ h5: { fontWeight: 600, letterSpacing: '-0.01em' },+ h6: { fontWeight: 600 },+ subtitle1: { color: '#AAAAAA' },+ body2: { color: '#AAAAAA' },+ },+ shape: { borderRadius: 12 },+ components: {+ MuiCard: {+ styleOverrides: {+ root: {+ backgroundImage: 'none',+ backgroundColor: '#1A1A1A',+ border: '1px solid rgba(255,255,255,0.06)',+ transition: 'all 0.2s ease',+ '&:hover': { borderColor: 'rgba(255,255,255,0.12)' },+ },+ },+ },+ MuiPaper: {+ styleOverrides: {+ root: { backgroundImage: 'none' },+ },+ },+ MuiButton: {+ styleOverrides: {+ root: { textTransform: 'none', fontWeight: 600, borderRadius: 8 },+ },+ },+ MuiChip: {+ styleOverrides: {+ root: { fontWeight: 500 },+ },+ },+ MuiDrawer: {+ styleOverrides: {+ paper: {+ backgroundColor: '#0A0A0A',+ borderRight: '1px solid rgba(255,255,255,0.06)',+ },+ },+ },+ MuiTextField: {+ styleOverrides: {+ root: {+ '& .MuiOutlinedInput-root': {+ borderRadius: 8,+ },+ },+ },+ },+ MuiDialog: {+ styleOverrides: {+ paper: {+ backgroundColor: '#1A1A1A',+ backgroundImage: 'none',+ borderRadius: 16,+ },+ },+ },+ MuiTooltip: {+ styleOverrides: {+ tooltip: { backgroundColor: '#333', fontSize: 13 },+ },+ },+ MuiLinearProgress: {+ styleOverrides: {+ root: { borderRadius: 4, height: 6 },+ },+ },+ },+});++export default theme;diff --git a/frontend/src/utils/formatters.js b/frontend/src/utils/formatters.jsnew file mode 100644index 0000000..b236cb9--- /dev/null+++ b/frontend/src/utils/formatters.js@@ -0,0 +1,88 @@+export function fmtNum(n) {+ if (n == null) return '0';+ n = Number(n);+ if (n >= 1e9) return (n / 1e9).toFixed(1) + 'B';+ if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M';+ if (n >= 1e3) return (n / 1e3).toFixed(1) + 'K';+ return n.toLocaleString();+}++export function fmtNumFull(n) {+ if (n == null) return '0';+ return Number(n).toLocaleString();+}++export function fmtDate(d) {+ if (!d) return '';+ return new Date(d).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });+}++export function fmtDateShort(d) {+ if (!d) return '';+ return new Date(d).toLocaleDateString('en-US', { month: 'short', day: 'numeric' });+}++export function fmtDuration(seconds) {+ if (!seconds) return '0:00';+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ const s = seconds % 60;+ if (h > 0) return `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;+ return `${m}:${String(s).padStart(2, '0')}`;+}++export function fmtPercent(n) {+ if (n == null) return '0%';+ return Number(n).toFixed(1) + '%';+}++export function timeAgo(date) {+ if (!date) return 'Never';+ const diff = Date.now() - new Date(date).getTime();+ const mins = Math.floor(diff / 60000);+ if (mins < 1) return 'Just now';+ if (mins < 60) return `${mins}m ago`;+ const hrs = Math.floor(mins / 60);+ if (hrs < 24) return `${hrs}h ago`;+ const days = Math.floor(hrs / 24);+ if (days < 30) return `${days}d ago`;+ const months = Math.floor(days / 30);+ return `${months}mo ago`;+}++export const CATEGORY_MAP = {+ '1': 'Film & Animation', '2': 'Autos & Vehicles', '10': 'Music',+ '15': 'Pets & Animals', '17': 'Sports', '18': 'Short Movies',+ '19': 'Travel & Events', '20': 'Gaming', '21': 'Videoblogging',+ '22': 'People & Blogs', '23': 'Comedy', '24': 'Entertainment',+ '25': 'News & Politics', '26': 'Howto & Style', '27': 'Education',+ '28': 'Science & Technology', '29': 'Nonprofits & Activism',+ '30': 'Movies', '31': 'Anime/Animation', '32': 'Action/Adventure',+ '33': 'Classics', '34': 'Comedy', '35': 'Documentary',+ '36': 'Drama', '37': 'Family', '38': 'Foreign',+ '39': 'Horror', '40': 'Sci-Fi/Fantasy', '41': 'Thriller',+ '42': 'Shorts', '43': 'Shows', '44': 'Trailers',+};++// Normalize account data (handles both old/new backend formats and Instagram)+export function normalizeAccount(acct) {+ if (!acct) return acct;+ if (acct.platform === 'instagram') {+ return {+ ...acct,+ title: acct.title || acct.name || acct.username || acct.igUserId,+ thumbnail: acct.profilePictureUrl || '',+ followersCount: acct.followersCount || 0,+ followsCount: acct.followsCount || 0,+ mediaCount: acct.mediaCount || 0,+ };+ }+ return {+ ...acct,+ title: acct.title || acct.name || acct.channelTitle || acct.channelId,+ thumbnail: acct.thumbnails?.default || acct.thumbnails?.medium || acct.thumbnailUrl || acct.thumbnail || '',+ subscriberCount: acct.subscriberCount ?? acct.currentStats?.subscribers ?? 0,+ viewCount: acct.viewCount ?? acct.currentStats?.views ?? 0,+ videoCount: acct.videoCount ?? acct.currentStats?.videos ?? 0,+ };+}diff --git a/frontend/vite.config.js b/frontend/vite.config.jsnew file mode 100644index 0000000..8b0f57b--- /dev/null+++ b/frontend/vite.config.js@@ -0,0 +1,7 @@+import { defineConfig } from 'vite'+import react from '@vitejs/plugin-react'++// https://vite.dev/config/+export default defineConfig({+ plugins: [react()],+})diff --git a/package-lock.json b/package-lock.jsonnew file mode 100644index 0000000..aa9220c--- /dev/null+++ b/package-lock.json@@ -0,0 +1,1386 @@+{+ "name": "social-analytics-dashboard",+ "version": "1.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "social-analytics-dashboard",+ "version": "1.0.0",+ "license": "MIT",+ "dependencies": {+ "axios": "^1.6.7",+ "body-parser": "^1.20.2",+ "cors": "^2.8.5",+ "express": "^4.18.2",+ "node-fetch": "^2.7.0"+ },+ "devDependencies": {+ "nodemon": "^3.0.1"+ }+ },+ "node_modules/accepts": {+ "version": "1.3.8",+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",+ "license": "MIT",+ "dependencies": {+ "mime-types": "~2.1.34",+ "negotiator": "0.6.3"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/anymatch": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "normalize-path": "^3.0.0",+ "picomatch": "^2.0.4"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/array-flatten": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",+ "license": "MIT"+ },+ "node_modules/asynckit": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",+ "license": "MIT"+ },+ "node_modules/axios": {+ "version": "1.13.4",+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.4.tgz",+ "integrity": "sha512-1wVkUaAO6WyaYtCkcYCOx12ZgpGf9Zif+qXa4n+oYzK558YryKqiL6UWwd5DqiH3VRW0GYhTZQ/vlgJrCoNQlg==",+ "license": "MIT",+ "dependencies": {+ "follow-redirects": "^1.15.6",+ "form-data": "^4.0.4",+ "proxy-from-env": "^1.1.0"+ }+ },+ "node_modules/balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/binary-extensions": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/body-parser": {+ "version": "1.20.4",+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",+ "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "content-type": "~1.0.5",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "~1.2.0",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "on-finished": "~2.4.1",+ "qs": "~6.14.0",+ "raw-body": "~2.5.3",+ "type-is": "~1.6.18",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/brace-expansion": {+ "version": "1.1.12",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",+ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0",+ "concat-map": "0.0.1"+ }+ },+ "node_modules/braces": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fill-range": "^7.1.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/bytes": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/call-bind-apply-helpers": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/call-bound": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "get-intrinsic": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/chokidar": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "anymatch": "~3.1.2",+ "braces": "~3.0.2",+ "glob-parent": "~5.1.2",+ "is-binary-path": "~2.1.0",+ "is-glob": "~4.0.1",+ "normalize-path": "~3.0.0",+ "readdirp": "~3.6.0"+ },+ "engines": {+ "node": ">= 8.10.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/combined-stream": {+ "version": "1.0.8",+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",+ "license": "MIT",+ "dependencies": {+ "delayed-stream": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/content-disposition": {+ "version": "0.5.4",+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "5.2.1"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/content-type": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie-signature": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "license": "MIT"+ },+ "node_modules/cors": {+ "version": "2.8.6",+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",+ "license": "MIT",+ "dependencies": {+ "object-assign": "^4",+ "vary": "^1"+ },+ "engines": {+ "node": ">= 0.10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/debug": {+ "version": "2.6.9",+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "license": "MIT",+ "dependencies": {+ "ms": "2.0.0"+ }+ },+ "node_modules/delayed-stream": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",+ "license": "MIT",+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/depd": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/destroy": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/dunder-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.1",+ "es-errors": "^1.3.0",+ "gopd": "^1.2.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/ee-first": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",+ "license": "MIT"+ },+ "node_modules/encodeurl": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-set-tostringtag": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.6",+ "has-tostringtag": "^1.0.2",+ "hasown": "^2.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/escape-html": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",+ "license": "MIT"+ },+ "node_modules/etag": {+ "version": "1.8.1",+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/express": {+ "version": "4.22.1",+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",+ "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",+ "license": "MIT",+ "dependencies": {+ "accepts": "~1.3.8",+ "array-flatten": "1.1.1",+ "body-parser": "~1.20.3",+ "content-disposition": "~0.5.4",+ "content-type": "~1.0.4",+ "cookie": "~0.7.1",+ "cookie-signature": "~1.0.6",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "finalhandler": "~1.3.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.0",+ "merge-descriptors": "1.0.3",+ "methods": "~1.1.2",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "path-to-regexp": "~0.1.12",+ "proxy-addr": "~2.0.7",+ "qs": "~6.14.0",+ "range-parser": "~1.2.1",+ "safe-buffer": "5.2.1",+ "send": "~0.19.0",+ "serve-static": "~1.16.2",+ "setprototypeof": "1.2.0",+ "statuses": "~2.0.1",+ "type-is": "~1.6.18",+ "utils-merge": "1.0.1",+ "vary": "~1.1.2"+ },+ "engines": {+ "node": ">= 0.10.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/fill-range": {+ "version": "7.1.1",+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "to-regex-range": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/finalhandler": {+ "version": "1.3.2",+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "statuses": "~2.0.2",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/follow-redirects": {+ "version": "1.15.11",+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",+ "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",+ "funding": [+ {+ "type": "individual",+ "url": "https://github.com/sponsors/RubenVerborgh"+ }+ ],+ "license": "MIT",+ "engines": {+ "node": ">=4.0"+ },+ "peerDependenciesMeta": {+ "debug": {+ "optional": true+ }+ }+ },+ "node_modules/form-data": {+ "version": "4.0.5",+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",+ "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",+ "license": "MIT",+ "dependencies": {+ "asynckit": "^0.4.0",+ "combined-stream": "^1.0.8",+ "es-set-tostringtag": "^2.1.0",+ "hasown": "^2.0.2",+ "mime-types": "^2.1.12"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/forwarded": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fresh": {+ "version": "0.5.2",+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-intrinsic": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "es-define-property": "^1.0.1",+ "es-errors": "^1.3.0",+ "es-object-atoms": "^1.1.1",+ "function-bind": "^1.1.2",+ "get-proto": "^1.0.1",+ "gopd": "^1.2.0",+ "has-symbols": "^1.1.0",+ "hasown": "^2.0.2",+ "math-intrinsics": "^1.1.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",+ "license": "MIT",+ "dependencies": {+ "dunder-proto": "^1.0.1",+ "es-object-atoms": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-flag": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/has-symbols": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-tostringtag": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",+ "license": "MIT",+ "dependencies": {+ "has-symbols": "^1.0.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/http-errors": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",+ "license": "MIT",+ "dependencies": {+ "depd": "~2.0.0",+ "inherits": "~2.0.4",+ "setprototypeof": "~1.2.0",+ "statuses": "~2.0.2",+ "toidentifier": "~1.0.1"+ },+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.4.24",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/ignore-by-default": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",+ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "license": "ISC"+ },+ "node_modules/ipaddr.js": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/is-binary-path": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "binary-extensions": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-glob": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-extglob": "^2.1.1"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-number": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.12.0"+ }+ },+ "node_modules/math-intrinsics": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/media-typer": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/merge-descriptors": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/methods": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",+ "license": "MIT",+ "bin": {+ "mime": "cli.js"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/mime-db": {+ "version": "1.52.0",+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime-types": {+ "version": "2.1.35",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",+ "license": "MIT",+ "dependencies": {+ "mime-db": "1.52.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/minimatch": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^1.1.7"+ },+ "engines": {+ "node": "*"+ }+ },+ "node_modules/ms": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "license": "MIT"+ },+ "node_modules/negotiator": {+ "version": "0.6.3",+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },+ "node_modules/nodemon": {+ "version": "3.1.11",+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.11.tgz",+ "integrity": "sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chokidar": "^3.5.2",+ "debug": "^4",+ "ignore-by-default": "^1.0.1",+ "minimatch": "^3.1.2",+ "pstree.remy": "^1.1.8",+ "semver": "^7.5.3",+ "simple-update-notifier": "^2.0.0",+ "supports-color": "^5.5.0",+ "touch": "^3.1.0",+ "undefsafe": "^2.0.5"+ },+ "bin": {+ "nodemon": "bin/nodemon.js"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/nodemon"+ }+ },+ "node_modules/nodemon/node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/nodemon/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/normalize-path": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-inspect": {+ "version": "1.13.4",+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/on-finished": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",+ "license": "MIT",+ "dependencies": {+ "ee-first": "1.1.1"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/parseurl": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/path-to-regexp": {+ "version": "0.1.12",+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",+ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",+ "license": "MIT"+ },+ "node_modules/picomatch": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/proxy-addr": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",+ "license": "MIT",+ "dependencies": {+ "forwarded": "0.2.0",+ "ipaddr.js": "1.9.1"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/proxy-from-env": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",+ "license": "MIT"+ },+ "node_modules/pstree.remy": {+ "version": "1.1.8",+ "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",+ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/qs": {+ "version": "6.14.1",+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",+ "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "side-channel": "^1.1.0"+ },+ "engines": {+ "node": ">=0.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/range-parser": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/raw-body": {+ "version": "2.5.3",+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/readdirp": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "picomatch": "^2.2.1"+ },+ "engines": {+ "node": ">=8.10.0"+ }+ },+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.7.3",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",+ "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/send": {+ "version": "0.19.2",+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "1.2.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.1",+ "mime": "1.6.0",+ "ms": "2.1.3",+ "on-finished": "~2.4.1",+ "range-parser": "~1.2.1",+ "statuses": "~2.0.2"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/send/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/serve-static": {+ "version": "1.16.3",+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",+ "license": "MIT",+ "dependencies": {+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "parseurl": "~1.3.3",+ "send": "~0.19.1"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/setprototypeof": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",+ "license": "ISC"+ },+ "node_modules/side-channel": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3",+ "side-channel-list": "^1.0.0",+ "side-channel-map": "^1.0.1",+ "side-channel-weakmap": "^1.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-list": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-map": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-weakmap": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3",+ "side-channel-map": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/simple-update-notifier": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",+ "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "semver": "^7.5.3"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/statuses": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/supports-color": {+ "version": "5.5.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^3.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/to-regex-range": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-number": "^7.0.0"+ },+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/toidentifier": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.6"+ }+ },+ "node_modules/touch": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",+ "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "nodetouch": "bin/nodetouch.js"+ }+ },+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "license": "MIT"+ },+ "node_modules/type-is": {+ "version": "1.6.18",+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",+ "license": "MIT",+ "dependencies": {+ "media-typer": "0.3.0",+ "mime-types": "~2.1.24"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/undefsafe": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",+ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/unpipe": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/utils-merge": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4.0"+ }+ },+ "node_modules/vary": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "license": "BSD-2-Clause"+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ }+ }+}diff --git a/package.json b/package.jsonnew file mode 100644index 0000000..67759ee--- /dev/null+++ b/package.json@@ -0,0 +1,19 @@+{+ "name": "social-media-analytics-dashboard",+ "version": "1.0.0",+ "description": "Local-only social media analytics dashboard",+ "main": "server.js",+ "scripts": {+ "start": "node server.js",+ "dev": "nodemon server.js"+ },+ "keywords": ["analytics", "dashboard", "youtube", "social-media"],+ "author": "",+ "license": "ISC",+ "dependencies": {+ "express": "^4.18.2",+ "cors": "^2.8.5",+ "body-parser": "^1.20.2",+ "node-fetch": "^2.7.0"+ }+}diff --git a/public/css/styles.css b/public/css/styles.cssnew file mode 100644index 0000000..9c7d256--- /dev/null+++ b/public/css/styles.css@@ -0,0 +1,1256 @@+* {+ margin: 0;+ padding: 0;+ box-sizing: border-box;+}++:root {+ --color-primary: #007AFF;+ --color-primary-dark: #0051D5;+ --color-primary-light: #5AC8FA;++ --color-secondary: #5856D6;+ --color-success: #34C759;+ --color-warning: #FF9500;+ --color-error: #FF3B30;++ --color-background: #F5F5F7;+ --color-surface: #FFFFFF;+ --color-overlay: rgba(0, 0, 0, 0.4);++ --color-text-primary: #1D1D1F;+ --color-text-secondary: #86868B;+ --color-text-tertiary: #B0B0B5;++ --color-border: rgba(0, 0, 0, 0.08);+ --color-divider: rgba(0, 0, 0, 0.06);++ --sidebar-bg: #1D1D1F;++ --gradient-primary: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);+ --gradient-secondary: linear-gradient(135deg, #5856D6 0%, #AF52DE 100%);+ --gradient-surface: linear-gradient(135deg, #FAFAFA 0%, #F5F5F7 100%);++ --spacing-xs: 4px;+ --spacing-sm: 8px;+ --spacing-md: 16px;+ --spacing-lg: 24px;+ --spacing-xl: 32px;+ --spacing-2xl: 48px;+ --spacing-3xl: 64px;++ --radius-sm: 8px;+ --radius-md: 12px;+ --radius-lg: 16px;+ --radius-xl: 20px;+ --radius-2xl: 24px;+ --radius-full: 9999px;++ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);+ --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04);+ --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);++ --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);+ --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);+ --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);+ --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);+}++[data-theme="dark"] {+ --color-background: #000000;+ --color-surface: #1C1C1E;+ --color-overlay: rgba(255, 255, 255, 0.1);++ --color-text-primary: #FFFFFF;+ --color-text-secondary: #98989D;+ --color-text-tertiary: #636366;++ --color-border: rgba(255, 255, 255, 0.12);+ --color-divider: rgba(255, 255, 255, 0.08);++ --sidebar-bg: #000000;++ --gradient-surface: linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 100%);++ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);+ --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);+ --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);+}++body {+ font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;+ background: var(--gradient-surface);+ color: var(--color-text-primary);+ line-height: 1.5;+ min-height: 100vh;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ letter-spacing: -0.015em;+ transition: background 0.3s ease, color 0.3s ease;+}++.hidden {+ display: none !important;+}++.welcome-screen {+ min-height: 100vh;+ display: flex;+ align-items: center;+ justify-content: center;+ background: var(--gradient-primary);+ padding: var(--spacing-lg);+}++.welcome-content {+ text-align: center;+ color: var(--color-surface);+ max-width: 600px;+ animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);+}++.welcome-icon {+ width: 120px;+ height: 120px;+ margin: 0 auto var(--spacing-xl);+ background: rgba(255, 255, 255, 0.15);+ backdrop-filter: blur(10px);+ border-radius: var(--radius-2xl);+ display: flex;+ align-items: center;+ justify-content: center;+ animation: float 3s ease-in-out infinite;+}++.welcome-icon svg {+ color: var(--color-surface);+}++.welcome-content h1 {+ font-size: 48px;+ font-weight: 700;+ margin-bottom: var(--spacing-md);+ letter-spacing: -0.02em;+}++.welcome-content p {+ font-size: 20px;+ margin-bottom: var(--spacing-md);+ opacity: 0.95;+ font-weight: 400;+}++.welcome-subtitle {+ font-size: 16px !important;+ opacity: 0.75 !important;+ margin-bottom: var(--spacing-xl) !important;+}++.dashboard-container {+ display: flex;+ min-height: 100vh;+}++.sidebar {+ width: 280px;+ background: var(--sidebar-bg);+ color: var(--color-surface);+ display: flex;+ flex-direction: column;+ box-shadow: var(--shadow-xl);+ position: fixed;+ height: 100vh;+ overflow-y: auto;+ z-index: 100;+ transition: background 0.3s ease;+}++.logo {+ padding: var(--spacing-xl) var(--spacing-lg);+ display: flex;+ align-items: center;+ gap: var(--spacing-md);+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);+}++.logo-icon {+ width: 40px;+ height: 40px;+ background: var(--gradient-primary);+ border-radius: var(--radius-md);+ display: flex;+ align-items: center;+ justify-content: center;+}++.logo-icon svg {+ color: var(--color-surface);+}++.logo h2 {+ font-size: 22px;+ font-weight: 600;+ letter-spacing: -0.02em;+ color: #FFFFFF;+}++.nav-menu {+ flex: 1;+ padding: var(--spacing-lg) 0;+}++.nav-item {+ display: flex;+ align-items: center;+ gap: var(--spacing-md);+ padding: var(--spacing-md) var(--spacing-lg);+ color: rgba(255, 255, 255, 0.7);+ text-decoration: none;+ transition: var(--transition-base);+ border-left: 3px solid transparent;+ font-size: 15px;+ font-weight: 500;+}++.nav-item svg {+ flex-shrink: 0;+}++.nav-item:hover {+ background: rgba(255, 255, 255, 0.08);+ color: #FFFFFF;+}++.nav-item.active {+ background: rgba(255, 255, 255, 0.12);+ color: #FFFFFF;+ border-left-color: var(--color-primary);+}++.sidebar-footer {+ padding: var(--spacing-lg);+ border-top: 1px solid rgba(255, 255, 255, 0.1);+}++.theme-toggle {+ width: 100%;+ padding: var(--spacing-md);+ margin-bottom: var(--spacing-md);+ background: rgba(255, 255, 255, 0.1);+ border: none;+ border-radius: var(--radius-md);+ color: #FFFFFF;+ cursor: pointer;+ transition: var(--transition-base);+ position: relative;+ overflow: hidden;+}++.theme-toggle:hover {+ background: rgba(255, 255, 255, 0.15);+}++.theme-toggle svg {+ transition: var(--transition-smooth);+}++.theme-toggle .moon-icon {+ display: inline-block;+}++.theme-toggle .sun-icon {+ display: none;+}++[data-theme="dark"] .theme-toggle .moon-icon {+ display: none;+}++[data-theme="dark"] .theme-toggle .sun-icon {+ display: inline-block;+}++.last-update {+ display: flex;+ flex-direction: column;+ gap: var(--spacing-xs);+ font-size: 12px;+ color: rgba(255, 255, 255, 0.8);+}++.update-label {+ opacity: 0.6;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ font-size: 11px;+ font-weight: 600;+}++.update-time {+ font-weight: 500;+ opacity: 0.9;+}++.main-content {+ flex: 1;+ margin-left: 280px;+ padding: var(--spacing-xl);+ max-width: calc(100vw - 280px);+}++.content-header {+ margin-bottom: var(--spacing-xl);+ display: flex;+ justify-content: space-between;+ align-items: flex-start;+}++.content-header h1 {+ font-size: 40px;+ font-weight: 700;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-xs);+ letter-spacing: -0.025em;+}++.header-subtitle {+ color: var(--color-text-secondary);+ font-size: 16px;+ font-weight: 400;+}++.tab-content {+ display: none;+ animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);+}++.tab-content.active {+ display: block;+}++.kpi-grid {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));+ gap: var(--spacing-lg);+ margin-bottom: var(--spacing-xl);+}++.kpi-card {+ background: var(--color-surface);+ border-radius: var(--radius-xl);+ padding: var(--spacing-lg);+ box-shadow: var(--shadow-md);+ display: flex;+ gap: var(--spacing-md);+ transition: var(--transition-smooth);+ border: 1px solid var(--color-border);+}++.kpi-card:hover {+ transform: translateY(-4px);+ box-shadow: var(--shadow-xl);+}++.kpi-icon {+ width: 64px;+ height: 64px;+ border-radius: var(--radius-lg);+ display: flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+}++.kpi-icon svg {+ color: #FFFFFF;+}++.kpi-icon-views {+ background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);+}++.kpi-icon-subscribers {+ background: linear-gradient(135deg, #34C759 0%, #30D158 100%);+}++.kpi-icon-videos {+ background: linear-gradient(135deg, #FF9500 0%, #FF9F0A 100%);+}++.kpi-icon-accounts {+ background: linear-gradient(135deg, #5856D6 0%, #AF52DE 100%);+}++.yt-views {+ background: linear-gradient(135deg, #FF0000 0%, #FF4444 100%);+}++.yt-subs {+ background: linear-gradient(135deg, #34C759 0%, #30D158 100%);+}++.yt-videos {+ background: linear-gradient(135deg, #FF9500 0%, #FF9F0A 100%);+}++.yt-channels {+ background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);+}++.kpi-content {+ flex: 1;+ display: flex;+ flex-direction: column;+ justify-content: center;+}++.kpi-label {+ font-size: 14px;+ color: var(--color-text-secondary);+ font-weight: 500;+ margin-bottom: var(--spacing-xs);+}++.kpi-value {+ font-size: 32px;+ font-weight: 700;+ color: var(--color-text-primary);+ line-height: 1.2;+ letter-spacing: -0.03em;+}++.kpi-change {+ font-size: 13px;+ font-weight: 600;+ margin-top: var(--spacing-xs);+}++.kpi-change.positive {+ color: var(--color-success);+}++.kpi-change.negative {+ color: var(--color-error);+}++.section {+ margin-bottom: var(--spacing-xl);+}++.section-header {+ display: flex;+ justify-content: space-between;+ align-items: center;+ margin-bottom: var(--spacing-lg);+}++.section-title {+ font-size: 24px;+ font-weight: 700;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-lg);+ letter-spacing: -0.02em;+}++.card {+ background: var(--color-surface);+ border-radius: var(--radius-xl);+ padding: var(--spacing-xl);+ box-shadow: var(--shadow-md);+ border: 1px solid var(--color-border);+}++.card h3 {+ font-size: 18px;+ font-weight: 700;+ margin-bottom: var(--spacing-lg);+ color: var(--color-text-primary);+}++.card p {+ color: var(--color-text-secondary);+ margin-bottom: var(--spacing-lg);+ line-height: 1.6;+}++.btn-primary,+.btn-secondary {+ padding: var(--spacing-md) var(--spacing-xl);+ border: none;+ border-radius: var(--radius-md);+ font-size: 15px;+ font-weight: 600;+ cursor: pointer;+ transition: var(--transition-base);+ display: inline-flex;+ align-items: center;+ gap: var(--spacing-sm);+ letter-spacing: -0.01em;+}++.btn-primary {+ background: var(--gradient-primary);+ color: var(--color-surface);+ box-shadow: var(--shadow-sm);+}++.btn-primary:hover {+ box-shadow: var(--shadow-lg);+ transform: translateY(-2px);+}++.btn-primary:active {+ transform: translateY(0);+}++.btn-secondary {+ background: var(--color-background);+ color: var(--color-text-primary);+ border: 1px solid var(--color-border);+}++.btn-secondary:hover {+ background: var(--color-border);+}++.btn-large {+ padding: var(--spacing-lg) var(--spacing-2xl);+ font-size: 17px;+}++.btn-small {+ padding: var(--spacing-sm) var(--spacing-md);+ font-size: 14px;+}++.btn-danger {+ background: var(--color-error);+ color: var(--color-surface);+}++.btn-danger:hover {+ background: #E0352B;+}++.empty-state {+ text-align: center;+ padding: var(--spacing-3xl) var(--spacing-lg);+ color: var(--color-text-secondary);+}++.empty-icon {+ display: flex;+ align-items: center;+ justify-content: center;+ margin-bottom: var(--spacing-lg);+ color: var(--color-text-tertiary);+}++.empty-state p {+ font-size: 16px;+ font-weight: 500;+}++.top-performers-list {+ display: flex;+ flex-direction: column;+ gap: var(--spacing-md);+}++.performer-item {+ display: flex;+ align-items: center;+ gap: var(--spacing-md);+ padding: var(--spacing-md);+ background: var(--color-background);+ border-radius: var(--radius-md);+ transition: var(--transition-base);+}++.performer-item:hover {+ background: var(--color-border);+}++.performer-rank {+ width: 40px;+ height: 40px;+ background: var(--gradient-primary);+ color: var(--color-surface);+ border-radius: var(--radius-md);+ display: flex;+ align-items: center;+ justify-content: center;+ font-size: 18px;+ font-weight: 700;+ flex-shrink: 0;+}++.performer-info {+ flex: 1;+}++.performer-name {+ font-size: 16px;+ font-weight: 600;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-xs);+}++.performer-platform {+ font-size: 13px;+ color: var(--color-text-secondary);+}++.performer-stats {+ text-align: right;+}++.performer-value {+ font-size: 20px;+ font-weight: 700;+ color: var(--color-text-primary);+}++.performer-label {+ font-size: 12px;+ color: var(--color-text-secondary);+}++.channels-list,+.accounts-list {+ display: flex;+ flex-direction: column;+ gap: var(--spacing-md);+}++.channel-item,+.account-item {+ display: flex;+ align-items: center;+ gap: var(--spacing-md);+ padding: var(--spacing-md);+ background: var(--color-background);+ border-radius: var(--radius-md);+ transition: var(--transition-base);+}++.channel-item:hover,+.account-item:hover {+ background: var(--color-border);+}++.channel-thumbnail,+.account-thumbnail {+ width: 56px;+ height: 56px;+ border-radius: var(--radius-md);+ overflow: hidden;+ flex-shrink: 0;+ background: var(--color-border);+}++.channel-thumbnail img,+.account-thumbnail img {+ width: 100%;+ height: 100%;+ object-fit: cover;+}++.channel-info,+.account-info {+ flex: 1;+}++.channel-name,+.account-name {+ font-size: 16px;+ font-weight: 600;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-xs);+}++.channel-stats,+.account-stats {+ display: flex;+ gap: var(--spacing-lg);+ font-size: 13px;+ color: var(--color-text-secondary);+}++.stat {+ display: flex;+ align-items: center;+ gap: var(--spacing-xs);+}++.stat svg {+ width: 14px;+ height: 14px;+ color: var(--color-text-tertiary);+}++.channel-actions,+.account-actions {+ display: flex;+ gap: var(--spacing-sm);+}++.videos-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));+ gap: var(--spacing-lg);+ margin-top: var(--spacing-lg);+}++.video-card {+ background: var(--color-background);+ border-radius: var(--radius-md);+ overflow: hidden;+ transition: var(--transition-base);+ cursor: pointer;+}++.video-card:hover {+ transform: translateY(-4px);+ box-shadow: var(--shadow-lg);+}++.video-thumbnail {+ width: 100%;+ aspect-ratio: 16/9;+ background: var(--color-border);+ position: relative;+ overflow: hidden;+}++.video-thumbnail img {+ width: 100%;+ height: 100%;+ object-fit: cover;+}++.video-info {+ padding: var(--spacing-md);+}++.video-title {+ font-size: 14px;+ font-weight: 600;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-sm);+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+}++.video-stats {+ display: flex;+ gap: var(--spacing-md);+ font-size: 12px;+ color: var(--color-text-secondary);+}++.form-group {+ margin-bottom: var(--spacing-lg);+}++.form-group label {+ display: block;+ font-size: 14px;+ font-weight: 600;+ color: var(--color-text-primary);+ margin-bottom: var(--spacing-sm);+}++.form-input {+ width: 100%;+ padding: var(--spacing-md);+ border: 1px solid var(--color-border);+ border-radius: var(--radius-md);+ font-size: 15px;+ color: var(--color-text-primary);+ background: var(--color-surface);+ transition: var(--transition-base);+}++.form-input:focus {+ outline: none;+ border-color: var(--color-primary);+ box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);+}++.form-help {+ font-size: 13px;+ color: var(--color-text-secondary);+ margin-top: var(--spacing-sm);+}++.form-help a {+ color: var(--color-primary);+ text-decoration: none;+}++.form-help a:hover {+ text-decoration: underline;+}++.form-actions {+ display: flex;+ gap: var(--spacing-md);+ margin-top: var(--spacing-lg);+}++.filter-grid {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));+ gap: var(--spacing-lg);+}++.comparison-selector-grid {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));+ gap: var(--spacing-lg);+}++.comparison-grid {+ display: grid;+ grid-template-columns: repeat(3, 1fr);+ gap: var(--spacing-lg);+}++.comparison-card {+ background: var(--color-background);+ border-radius: var(--radius-md);+ padding: var(--spacing-lg);+}++.comparison-header {+ font-size: 14px;+ font-weight: 600;+ color: var(--color-text-secondary);+ margin-bottom: var(--spacing-md);+}++.comparison-stats,+.comparison-changes {+ display: flex;+ flex-direction: column;+ gap: var(--spacing-sm);+}++.comparison-stat,+.comparison-change {+ display: flex;+ justify-content: space-between;+ padding: var(--spacing-sm);+ background: var(--color-surface);+ border-radius: var(--radius-sm);+ font-size: 14px;+}++.comparison-stat .label,+.comparison-change .label {+ color: var(--color-text-secondary);+}++.comparison-stat .value,+.comparison-change .value {+ font-weight: 600;+ color: var(--color-text-primary);+}++.comparison-change.positive .value {+ color: var(--color-success);+}++.comparison-change.negative .value {+ color: var(--color-error);+}++.table-container {+ overflow-x: auto;+}++.data-table {+ width: 100%;+ border-collapse: collapse;+}++.data-table th {+ text-align: left;+ padding: var(--spacing-md);+ font-size: 13px;+ font-weight: 700;+ color: var(--color-text-secondary);+ text-transform: uppercase;+ letter-spacing: 0.05em;+ border-bottom: 2px solid var(--color-divider);+}++.data-table td {+ padding: var(--spacing-md);+ border-bottom: 1px solid var(--color-divider);+ color: var(--color-text-primary);+ font-size: 14px;+}++.data-table tbody tr:hover {+ background: var(--color-background);+}++.empty-cell {+ text-align: center;+ color: var(--color-text-secondary);+ padding: var(--spacing-xl) !important;+}++.modal {+ position: fixed;+ top: 0;+ left: 0;+ width: 100%;+ height: 100%;+ background: var(--color-overlay);+ backdrop-filter: blur(10px);+ display: flex;+ align-items: center;+ justify-content: center;+ z-index: 1000;+ animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);+}++.modal-content {+ background: var(--color-surface);+ border-radius: var(--radius-xl);+ max-width: 600px;+ width: 90%;+ max-height: 90vh;+ overflow-y: auto;+ box-shadow: var(--shadow-2xl);+ animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);+}++.modal-header {+ padding: var(--spacing-xl);+ border-bottom: 1px solid var(--color-divider);+ display: flex;+ justify-content: space-between;+ align-items: center;+}++.modal-header h2 {+ font-size: 24px;+ color: var(--color-text-primary);+ font-weight: 700;+ letter-spacing: -0.02em;+}++.modal-close {+ width: 40px;+ height: 40px;+ border: none;+ background: var(--color-background);+ border-radius: var(--radius-md);+ color: var(--color-text-secondary);+ cursor: pointer;+ transition: var(--transition-base);+ display: flex;+ align-items: center;+ justify-content: center;+}++.modal-close:hover {+ background: var(--color-border);+ color: var(--color-text-primary);+}++.modal-body {+ padding: var(--spacing-xl);+}++.modal-status {+ margin-top: var(--spacing-lg);+ padding: var(--spacing-md);+ border-radius: var(--radius-md);+ font-size: 14px;+ font-weight: 500;+}++.modal-status.success {+ background: rgba(52, 199, 89, 0.1);+ color: var(--color-success);+ border: 1px solid rgba(52, 199, 89, 0.3);+}++.modal-status.error {+ background: rgba(255, 59, 48, 0.1);+ color: var(--color-error);+ border: 1px solid rgba(255, 59, 48, 0.3);+}++.loading-overlay {+ position: fixed;+ top: 0;+ left: 0;+ width: 100%;+ height: 100%;+ background: rgba(0, 0, 0, 0.8);+ backdrop-filter: blur(10px);+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ z-index: 2000;+}++.loading-spinner {+ width: 60px;+ height: 60px;+ border: 4px solid rgba(255, 255, 255, 0.2);+ border-top-color: var(--color-surface);+ border-radius: 50%;+ animation: spin 0.8s linear infinite;+}++.loading-text {+ color: var(--color-surface);+ font-size: 16px;+ margin-top: var(--spacing-lg);+ font-weight: 500;+}++.toast {+ position: fixed;+ bottom: var(--spacing-xl);+ right: var(--spacing-xl);+ background: var(--color-text-primary);+ color: var(--color-surface);+ padding: var(--spacing-md) var(--spacing-xl);+ border-radius: var(--radius-lg);+ box-shadow: var(--shadow-2xl);+ z-index: 3000;+ animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);+ max-width: 400px;+ font-weight: 500;+}++.toast.success {+ background: var(--color-success);+}++.toast.error {+ background: var(--color-error);+}++.api-status {+ margin-top: var(--spacing-lg);+ display: flex;+ align-items: center;+ gap: var(--spacing-sm);+ padding: var(--spacing-md);+ background: var(--color-background);+ border-radius: var(--radius-md);+ font-size: 14px;+}++.status-indicator {+ width: 10px;+ height: 10px;+ border-radius: 50%;+}++.status-unknown {+ background: var(--color-text-tertiary);+}++.status-success {+ background: var(--color-success);+}++.status-error {+ background: var(--color-error);+}++.last-update-info {+ margin-top: var(--spacing-lg);+ padding: var(--spacing-md);+ background: var(--color-background);+ border-radius: var(--radius-md);+ font-size: 14px;+ color: var(--color-text-secondary);+}++.last-update-info strong {+ color: var(--color-text-primary);+}++.about-list {+ list-style: none;+ padding: 0;+ margin-top: var(--spacing-lg);+}++.about-list li {+ padding: var(--spacing-sm) 0;+ color: var(--color-text-primary);+ display: flex;+ align-items: center;+ gap: var(--spacing-md);+ font-size: 15px;+}++.about-list li svg {+ color: var(--color-success);+ flex-shrink: 0;+}++@keyframes fadeIn {+ from {+ opacity: 0;+ }++ to {+ opacity: 1;+ }+}++@keyframes fadeInUp {+ from {+ opacity: 0;+ transform: translateY(30px);+ }++ to {+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes slideUp {+ from {+ transform: translateY(50px);+ opacity: 0;+ }++ to {+ transform: translateY(0);+ opacity: 1;+ }+}++@keyframes slideInRight {+ from {+ transform: translateX(100%);+ }++ to {+ transform: translateX(0);+ }+}++@keyframes spin {+ to {+ transform: rotate(360deg);+ }+}++@keyframes float {++ 0%,+ 100% {+ transform: translateY(0);+ }++ 50% {+ transform: translateY(-10px);+ }+}++@media (max-width: 1024px) {+ .sidebar {+ width: 240px;+ }++ .main-content {+ margin-left: 240px;+ max-width: calc(100vw - 240px);+ }++ .kpi-grid {+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));+ }+}++@media (max-width: 768px) {+ .sidebar {+ width: 200px;+ }++ .main-content {+ margin-left: 200px;+ max-width: calc(100vw - 200px);+ padding: var(--spacing-lg);+ }++ .content-header {+ flex-direction: column;+ gap: var(--spacing-md);+ }++ .content-header h1 {+ font-size: 32px;+ }++ .kpi-grid {+ grid-template-columns: 1fr;+ }++ .filter-grid {+ grid-template-columns: 1fr;+ }++ .comparison-grid {+ grid-template-columns: 1fr;+ }++ .comparison-selector-grid {+ grid-template-columns: 1fr;+ }++ .channel-item,+ .account-item {+ flex-direction: column;+ text-align: center;+ }++ .channel-actions,+ .account-actions {+ width: 100%;+ justify-content: center;+ }+}++@media (max-width: 480px) {+ .sidebar {+ display: none;+ }++ .main-content {+ margin-left: 0;+ max-width: 100vw;+ padding: var(--spacing-md);+ }++ .welcome-content h1 {+ font-size: 36px;+ }++ .content-header h1 {+ font-size: 28px;+ }+}\ No newline at end of filediff --git a/public/index.html b/public/index.htmlnew file mode 100644index 0000000..8761398--- /dev/null+++ b/public/index.html@@ -0,0 +1,383 @@+<!DOCTYPE html>+<html lang="en" data-theme="light">++<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Social Media Analytics Dashboard</title>+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">+ <link rel="stylesheet" href="css/styles.css">+</head>++<body>+ <div id="welcomeScreen" class="welcome-screen hidden">+ <div class="welcome-content">+ <div class="welcome-icon">+ <i class="fas fa-chart-line fa-3x"></i>+ </div>+ <h1>Welcome to Your Analytics Dashboard</h1>+ <p>Track your social media performance all in one place</p>+ <p class="welcome-subtitle">Get started by adding your first account</p>+ <button class="btn-primary btn-large" onclick="showSetupWizard()">+ <i class="fas fa-plus"></i>+ <span>Add Your First Account</span>+ </button>+ </div>+ </div>++ <div id="mainDashboard" class="dashboard-container hidden">+ <aside class="sidebar">+ <div class="logo">+ <div class="logo-icon">+ <i class="fas fa-chart-line"></i>+ </div>+ <h2>Analytics</h2>+ </div>++ <nav class="nav-menu">+ <a href="#" class="nav-item active" data-tab="overview">+ <i class="fas fa-home"></i>+ <span>Overview</span>+ </a>+ <a href="#" class="nav-item" data-tab="youtube">+ <i class="fab fa-youtube"></i>+ <span>YouTube</span>+ </a>+ <a href="#" class="nav-item" data-tab="accounts">+ <i class="fas fa-users"></i>+ <span>Accounts</span>+ </a>+ <a href="#" class="nav-item" data-tab="settings">+ <i class="fas fa-cog"></i>+ <span>Settings</span>+ </a>+ </nav>++ <div class="sidebar-footer">+ <button class="theme-toggle" id="themeToggle" onclick="toggleTheme()">+ <i class="fas fa-moon moon-icon"></i>+ <i class="fas fa-sun sun-icon"></i>+ </button>+ <div class="last-update">+ <span class="update-label">Last Updated</span>+ <span class="update-time" id="lastUpdateTime">Never</span>+ </div>+ </div>+ </aside>++ <main class="main-content">+ <div id="overviewTab" class="tab-content active">+ <header class="content-header">+ <div>+ <h1>Overview</h1>+ <p class="header-subtitle">Combined analytics across all platforms</p>+ </div>+ <button class="btn-secondary" onclick="updateAllStats()">+ <i class="fas fa-sync-alt"></i>+ <span>Update All Stats</span>+ </button>+ </header>++ <div class="kpi-grid">+ <div class="kpi-card">+ <div class="kpi-icon kpi-icon-views">+ <i class="fas fa-eye fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Total Views</div>+ <div class="kpi-value" id="totalViews">0</div>+ <div class="kpi-change positive" id="viewsChange">—</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon kpi-icon-subscribers">+ <i class="fas fa-users fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Total Subscribers</div>+ <div class="kpi-value" id="totalSubscribers">0</div>+ <div class="kpi-change positive" id="subscribersChange">—</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon kpi-icon-videos">+ <i class="fas fa-video fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Total Videos</div>+ <div class="kpi-value" id="totalVideos">0</div>+ <div class="kpi-change positive" id="videosChange">—</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon kpi-icon-accounts">+ <i class="fas fa-folder fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Total Accounts</div>+ <div class="kpi-value" id="totalAccounts">0</div>+ <div class="kpi-change" id="accountsChange">—</div>+ </div>+ </div>+ </div>++ <div class="section">+ <h2 class="section-title">Platform Performance</h2>+ <div class="card">+ <canvas id="platformComparisonChart" height="80"></canvas>+ </div>+ </div>++ <div class="section">+ <h2 class="section-title">Top Performing Channels</h2>+ <div class="card">+ <div id="topPerformers" class="top-performers-list">+ <div class="empty-state">+ <div class="empty-icon">+ <i class="fas fa-chart-bar fa-3x"></i>+ </div>+ <p>No data available yet</p>+ </div>+ </div>+ </div>+ </div>+ </div>++ <div id="youtubeTab" class="tab-content">+ <header class="content-header">+ <div>+ <h1>YouTube Analytics</h1>+ <p class="header-subtitle">Detailed YouTube channel insights</p>+ </div>+ </header>++ <div class="kpi-grid" id="youtubeSummaryCards">+ <div class="kpi-card">+ <div class="kpi-icon yt-views">+ <i class="fab fa-youtube fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">YouTube Views</div>+ <div class="kpi-value" id="ytTotalViews">0</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon yt-subs">+ <i class="fas fa-bell fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Subscribers</div>+ <div class="kpi-value" id="ytTotalSubs">0</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon yt-videos">+ <i class="fas fa-play fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Total Videos</div>+ <div class="kpi-value" id="ytTotalVideos">0</div>+ </div>+ </div>++ <div class="kpi-card">+ <div class="kpi-icon yt-channels">+ <i class="fab fa-youtube fa-2x"></i>+ </div>+ <div class="kpi-content">+ <div class="kpi-label">Channels</div>+ <div class="kpi-value" id="ytChannelCount">0</div>+ </div>+ </div>+ </div>++ <div class="section">+ <div class="section-header">+ <h2 class="section-title">Channels</h2>+ <button class="btn-primary" onclick="showAddAccountModal()">+ <i class="fas fa-plus"></i>+ <span>Add Channel</span>+ </button>+ </div>+ <div class="card">+ <div id="youtubeChannels" class="channels-list"></div>+ </div>+ </div>++ <div class="section" id="channelDetailsSection" style="display: none;">+ <div class="section-header">+ <h2 class="section-title">Channel Details: <span id="selectedChannelName"></span></h2>+ <button class="btn-secondary" onclick="closeChannelDetails()">+ <i class="fas fa-times"></i>+ <span>Close</span>+ </button>+ </div>++ <div class="card">+ <h3>Recent Videos</h3>+ <div id="channelVideos" class="videos-grid"></div>+ </div>+ </div>+ </div>++ <div id="accountsTab" class="tab-content">+ <header class="content-header">+ <div>+ <h1>Accounts</h1>+ <p class="header-subtitle">Manage all connected accounts</p>+ </div>+ <button class="btn-primary" onclick="showAddAccountModal()">+ <i class="fas fa-plus"></i>+ <span>Add Account</span>+ </button>+ </header>++ <div class="card">+ <div id="accountsList" class="accounts-list"></div>+ </div>+ </div>++++ <div id="settingsTab" class="tab-content">+ <header class="content-header">+ <div>+ <h1>Settings</h1>+ <p class="header-subtitle">Configure your dashboard</p>+ </div>+ </header>++ <div class="section">+ <h2 class="section-title">API Configuration</h2>+ <div class="card">+ <div class="form-group">+ <label for="youtubeApiKey">YouTube API Key</label>+ <input type="password" id="youtubeApiKey" class="form-input"+ placeholder="Enter your YouTube Data API v3 key">+ <p class="form-help">+ Get your API key from <a href="https://console.cloud.google.com/" target="_blank">Google+ Cloud Console</a>+ </p>+ </div>++ <button class="btn-primary" onclick="saveAPIKey()">Save API Key</button>++ <div class="api-status" id="apiStatus">+ <span class="status-indicator status-unknown"></span>+ <span>API Key Status: Not configured</span>+ </div>+ </div>+ </div>++ <div class="section">+ <h2 class="section-title">Manual Updates</h2>+ <div class="card">+ <p>Manually fetch the latest statistics for all accounts</p>+ <button class="btn-primary" onclick="updateAllStats()">+ <i class="fas fa-sync-alt"></i>+ <span>Update All Stats Now</span>+ </button>++ <div class="last-update-info">+ <strong>Last Successful Update:</strong> <span id="settingsLastUpdate">Never</span>+ </div>+ </div>+ </div>++ <div class="section">+ <h2 class="section-title">About</h2>+ <div class="card">+ <h3>Social Media Analytics Dashboard</h3>+ <p>Version 1.0.0 - Local-Only Analytics</p>+ <ul class="about-list">+ <li>+ <i class="fas fa-check"></i>+ <span>100% Local - No cloud storage</span>+ </li>+ <li>+ <i class="fas fa-check"></i>+ <span>Privacy-focused - Your data stays on your computer</span>+ </li>+ <li>+ <i class="fas fa-check"></i>+ <span>YouTube Analytics - Track channel performance</span>+ </li>++ </ul>+ </div>+ </div>+ </div>+ </main>+ </div>++ <div id="addAccountModal" class="modal hidden">+ <div class="modal-content">+ <div class="modal-header">+ <h2>Add New Account</h2>+ <button class="modal-close" onclick="closeAddAccountModal()">+ <i class="fas fa-times"></i>+ </button>+ </div>++ <div class="modal-body">+ <div class="form-group">+ <label for="accountName">Account Name</label>+ <input type="text" id="accountName" class="form-input" placeholder="e.g., My YouTube Channel">+ </div>++ <div class="form-group">+ <label for="accountPlatform">Platform</label>+ <select id="accountPlatform" class="form-input">+ <option value="youtube">YouTube</option>+ </select>+ </div>++ <div class="form-group">+ <label for="accountChannelId">Channel ID</label>+ <input type="text" id="accountChannelId" class="form-input" placeholder="UCxxxxxxxxxxxxxxxxxxxxx">+ <p class="form-help">+ Find your Channel ID in YouTube Studio → Settings → Channel → Advanced settings+ </p>+ </div>++ <div class="form-actions">+ <button class="btn-secondary" onclick="testConnection()">Test Connection</button>+ <button class="btn-primary" onclick="addAccount()">Add Account</button>+ </div>++ <div id="modalStatus" class="modal-status hidden"></div>+ </div>+ </div>+ </div>++ <div id="loadingOverlay" class="loading-overlay hidden">+ <div class="loading-spinner"></div>+ <p class="loading-text">Loading...</p>+ </div>++ <div id="toast" class="toast hidden"></div>++ <script src="js/chart.min.js"></script>+ <script src="js/app.js"></script>+ <script>+ function toggleTheme() {+ const html = document.documentElement;+ const currentTheme = html.getAttribute('data-theme');+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';+ html.setAttribute('data-theme', newTheme);+ localStorage.setItem('theme', newTheme);+ }++ document.addEventListener('DOMContentLoaded', () => {+ const savedTheme = localStorage.getItem('theme') || 'light';+ document.documentElement.setAttribute('data-theme', savedTheme);+ });+ </script>+</body>++</html>\ No newline at end of filediff --git a/public/js/app.js b/public/js/app.jsnew file mode 100644index 0000000..b5d9dad--- /dev/null+++ b/public/js/app.js@@ -0,0 +1,871 @@+const API_BASE = 'http://localhost:3000/api';++let accounts = [];+let currentChannelId = null;+let charts = {};++document.addEventListener('DOMContentLoaded', async () => {+ await checkServerConnection();+ await loadInitialData();+ setupEventListeners();+ checkFirstRun();+});++async function checkServerConnection() {+ try {+ const controller = new AbortController();+ const timeoutId = setTimeout(() => controller.abort(), 5000);++ const response = await fetch(`${API_BASE}/accounts`, {+ signal: controller.signal+ });++ clearTimeout(timeoutId);++ if (!response.ok) {+ throw new Error(`Server returned ${response.status}`);+ }++ console.log('✓ Server connection successful');+ } catch (error) {+ console.error('✗ Server connection failed:', error);++ const errorBox = document.createElement('div');+ errorBox.style.cssText = 'position:fixed;top:0;left:0;right:0;background:#f44336;color:#fff;padding:20px;text-align:center;z-index:10001;font-size:16px;';+ errorBox.innerHTML = `+ <strong>⚠️ Cannot Connect to Server</strong><br>+ <span style="font-size:14px;">+ ${error.name === 'AbortError' ? 'Connection timeout - Server not responding' : error.message}+ <br>Make sure the backend server is running: <code style="background:rgba(0,0,0,0.2);padding:2px 8px;border-radius:3px;">node server.js</code>+ </span>+ `;+ document.body.insertBefore(errorBox, document.body.firstChild);++ throw error;+ }+}++async function loadInitialData() {+ console.log('🔵 START loadInitialData');+ try {+ console.log('📡 Step 1: Fetching accounts from', `${API_BASE}/accounts`);+ const accountsRes = await fetch(`${API_BASE}/accounts`);+ console.log('📡 Accounts response status:', accountsRes.status);+ if (!accountsRes.ok) throw new Error(`HTTP error! status: ${accountsRes.status}`);+ accounts = await accountsRes.json();+ console.log('✅ Accounts loaded:', accounts);++ console.log('📡 Step 2: Fetching API keys from', `${API_BASE}/keys`);+ const keysRes = await fetch(`${API_BASE}/keys`);+ console.log('📡 Keys response status:', keysRes.status);+ if (!keysRes.ok) throw new Error(`HTTP error! status: ${keysRes.status}`);+ const keys = await keysRes.json();+ console.log('✅ Keys loaded:', keys);++ console.log('📝 Step 3: Updating API key input');+ const apiKeyInput = document.getElementById('youtubeApiKey');+ console.log(' - API key input element:', apiKeyInput);+ if (apiKeyInput) {+ apiKeyInput.value = keys.youtube || '';+ console.log(' ✅ API key input updated');+ } else {+ console.log(' ⚠️ API key input not found');+ }++ console.log('📝 Step 4: Updating API status');+ updateAPIStatus(keys.youtube);+ console.log(' ✅ API status updated');++ console.log(' Step 6: Checking dashboard visibility');+ const mainDashboard = document.getElementById('mainDashboard');+ console.log(' - Main dashboard element:', mainDashboard);+ console.log(' - Has "hidden" class:', mainDashboard?.classList.contains('hidden'));++ if (mainDashboard && !mainDashboard.classList.contains('hidden')) {+ console.log(' 📊 Dashboard visible - updating UI...');+ updateOverviewTab();+ updateYouTubeTab();+ updateAccountsTab();+ console.log(' ✅ Dashboard UI updated');+ } else {+ console.log(' ⚠️ Dashboard hidden - skipping UI updates');+ }++ console.log('📝 Step 7: Updating last update time');+ if (accounts.length > 0) {+ const lastUpdate = accounts.reduce((latest, acc) => {+ const accTime = new Date(acc.lastUpdated);+ return accTime > latest ? accTime : latest;+ }, new Date(0));++ updateLastUpdateTime(lastUpdate);+ console.log(' ✅ Last update time set');+ } else {+ console.log(' ⚠️ No accounts, skipping last update time');+ }++ console.log('✅ loadInitialData COMPLETED');+ } catch (error) {+ console.error('❌ loadInitialData FAILED');+ console.error('Error:', error);+ console.error('Stack:', error.stack);+ const errorMsg = error.message || error.toString();+ showToast(`Failed to load data: ${errorMsg}`, 'error');++ if (document.body) {+ const detailedError = document.createElement('div');+ detailedError.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;border:3px solid #f44336;padding:30px;border-radius:8px;max-width:600px;z-index:10000;box-shadow:0 4px 20px rgba(0,0,0,0.3);font-family:monospace;';+ detailedError.innerHTML = `+ <h2 style="color:#f44336;margin-top:0;">⚠️ Error Loading Data</h2>+ <p><strong>Error Message:</strong></p>+ <pre style="background:#f5f5f5;padding:15px;border-radius:4px;overflow:auto;max-height:200px;">${errorMsg}</pre>+ <p><strong>Possible Causes:</strong></p>+ <ul style="text-align:left;line-height:1.8;">+ <li>Backend server is not running (run: node server.js)</li>+ <li>Server is running on wrong port (check: http://localhost:3000)</li>+ <li>CORS error (must use http://localhost:3000, not file:// or 127.0.0.1)</li>+ <li>Folder structure is incorrect (files must be in public/ and data/ folders)</li>+ </ul>+ <p><strong>Check Console:</strong> Press F12 → Console tab for detailed errors</p>+ <button onclick="this.parentElement.remove()" style="background:#f44336;color:#fff;border:none;padding:10px 20px;border-radius:4px;cursor:pointer;font-size:16px;">Close</button>+ `;+ document.body.appendChild(detailedError);+ }+ }+}++function checkFirstRun() {+ const welcomeScreen = document.getElementById('welcomeScreen');+ const mainDashboard = document.getElementById('mainDashboard');++ if (!welcomeScreen || !mainDashboard) {+ console.warn('Welcome screen or main dashboard elements not found');+ return;+ }++ if (accounts.length === 0) {+ welcomeScreen.classList.remove('hidden');+ mainDashboard.classList.add('hidden');+ } else {+ welcomeScreen.classList.add('hidden');+ mainDashboard.classList.remove('hidden');+ }+}+++function setupEventListeners() {+ document.querySelectorAll('.nav-item').forEach(item => {+ item.addEventListener('click', (e) => {+ e.preventDefault();+ const tab = item.dataset.tab;+ switchTab(tab);+ });+ });+}++function switchTab(tabName) {+ document.querySelectorAll('.nav-item').forEach(item => {+ item.classList.remove('active');+ });+ document.querySelector(`[data-tab="${tabName}"]`).classList.add('active');++ document.querySelectorAll('.tab-content').forEach(tab => {+ tab.classList.remove('active');+ });+ document.getElementById(`${tabName}Tab`).classList.add('active');++}++function updateOverviewTab() {+ const totalStats = accounts.reduce((acc, account) => {+ acc.views += account.currentStats.views || 0;+ acc.subscribers += account.currentStats.subscribers || 0;+ acc.videos += account.currentStats.videos || 0;+ return acc;+ }, { views: 0, subscribers: 0, videos: 0 });++ const totalViewsEl = document.getElementById('totalViews');+ const totalSubsEl = document.getElementById('totalSubscribers');+ const totalVideosEl = document.getElementById('totalVideos');+ const totalAccountsEl = document.getElementById('totalAccounts');++ if (totalViewsEl) totalViewsEl.textContent = formatNumber(totalStats.views);+ if (totalSubsEl) totalSubsEl.textContent = formatNumber(totalStats.subscribers);+ if (totalVideosEl) totalVideosEl.textContent = formatNumber(totalStats.videos);+ if (totalAccountsEl) totalAccountsEl.textContent = accounts.length;++ updateTopPerformers();+ updatePlatformChart();+}++function updateTopPerformers() {+ const container = document.getElementById('topPerformers');++ if (!container) {+ console.warn('topPerformers element not found');+ return;+ }++ if (accounts.length === 0) {+ container.innerHTML = `+ <div class="empty-state">+ <div class="empty-icon">+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <line x1="18" y1="20" x2="18" y2="10"></line>+ <line x1="12" y1="20" x2="12" y2="4"></line>+ <line x1="6" y1="20" x2="6" y2="14"></line>+ </svg>+ </div>+ <p>No data available yet</p>+ </div>+ `;+ return;+ }++ const sorted = [...accounts].sort((a, b) =>+ (b.currentStats.subscribers || 0) - (a.currentStats.subscribers || 0)+ ).slice(0, 5);++ container.innerHTML = sorted.map((account, index) => `+ <div class="performer-item">+ <div class="performer-rank">${index + 1}</div>+ <div class="performer-info">+ <div class="performer-name">${escapeHtml(account.name)}</div>+ <div class="performer-metric">${formatNumber(account.currentStats.subscribers)} subscribers</div>+ </div>+ </div>+ `).join('');+}++function updatePlatformChart() {+ const canvas = document.getElementById('platformComparisonChart');++ if (!canvas) {+ console.warn('platformComparisonChart element not found');+ return;+ }++ const ctx = canvas.getContext('2d');++ if (charts.platform) {+ charts.platform.destroy();+ }++ const platformStats = {};+ accounts.forEach(account => {+ if (!platformStats[account.platform]) {+ platformStats[account.platform] = { views: 0, subscribers: 0 };+ }+ platformStats[account.platform].views += account.currentStats.views || 0;+ platformStats[account.platform].subscribers += account.currentStats.subscribers || 0;+ });++ if (typeof Chart !== 'undefined') {+ charts.platform = new Chart(ctx, {+ type: 'bar',+ data: {+ labels: Object.keys(platformStats).map(p => p.charAt(0).toUpperCase() + p.slice(1)),+ datasets: [+ {+ label: 'Total Views',+ data: Object.values(platformStats).map(s => s.views),+ backgroundColor: '#FF6B6B',+ borderRadius: 8+ },+ {+ label: 'Total Subscribers',+ data: Object.values(platformStats).map(s => s.subscribers),+ backgroundColor: '#51CF66',+ borderRadius: 8+ }+ ]+ },+ options: {+ responsive: true,+ maintainAspectRatio: true,+ plugins: {+ legend: {+ position: 'top',+ }+ },+ scales: {+ y: {+ beginAtZero: true,+ ticks: {+ callback: function (value) {+ return formatNumber(value);+ }+ }+ }+ }+ }+ });+ }+}+++function updateYouTubeTab() {+ const youtubeAccounts = accounts.filter(acc => acc.platform === 'youtube');++ const totalStats = youtubeAccounts.reduce((acc, account) => {+ acc.views += account.currentStats.views || 0;+ acc.subscribers += account.currentStats.subscribers || 0;+ acc.videos += account.currentStats.videos || 0;+ return acc;+ }, { views: 0, subscribers: 0, videos: 0 });++ const viewsEl = document.getElementById('ytTotalViews');+ const subsEl = document.getElementById('ytTotalSubs');+ const videosEl = document.getElementById('ytTotalVideos');+ const channelCountEl = document.getElementById('ytChannelCount');++ if (viewsEl) viewsEl.textContent = formatNumber(totalStats.views);+ if (subsEl) subsEl.textContent = formatNumber(totalStats.subscribers);+ if (videosEl) videosEl.textContent = formatNumber(totalStats.videos);+ if (channelCountEl) channelCountEl.textContent = youtubeAccounts.length;++ updateYouTubeChannelsList();+}++function updateYouTubeChannelsList() {+ const container = document.getElementById('youtubeChannels');++ if (!container) {+ console.warn('youtubeChannels element not found');+ return;+ }++ const youtubeAccounts = accounts.filter(acc => acc.platform === 'youtube');++ if (youtubeAccounts.length === 0) {+ container.innerHTML = `+ <div class="empty-state">+ <div class="empty-icon">+ <svg width="48" height="48" viewBox="0 0 24 24" fill="currentColor">+ <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/>+ </svg>+ </div>+ <p>No YouTube channels added yet</p>+ <button class="btn-primary" onclick="switchTab('accounts')">Add YouTube Channel</button>+ </div>+ `;+ return;+ }++ container.innerHTML = youtubeAccounts.map(account => `+ <div class="channel-item">+ <div class="channel-thumbnail">+ <img src="${account.thumbnailUrl || 'https://via.placeholder.com/56'}"+ alt="${escapeHtml(account.name)}">+ </div>+ <div class="channel-info">+ <div class="channel-name">${escapeHtml(account.name)}</div>+ <div class="channel-stats">+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>+ <circle cx="12" cy="12" r="3"></circle>+ </svg>+ <span>${formatNumber(account.currentStats.views)}</span>+ </div>+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>+ <circle cx="9" cy="7" r="4"></circle>+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>+ </svg>+ <span>${formatNumber(account.currentStats.subscribers)}</span>+ </div>+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <polygon points="23 7 16 12 23 17 23 7"></polygon>+ <rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect>+ </svg>+ <span>${formatNumber(account.currentStats.videos)}</span>+ </div>+ </div>+ </div>+ <div class="channel-actions">+ <button class="btn-secondary btn-small" onclick="viewChannelDetails('${account.id}')">View</button>+ <button class="btn-secondary btn-small" onclick="updateSingleAccount('${account.id}')">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <polyline points="23 4 23 10 17 10"></polyline>+ <polyline points="1 20 1 14 7 14"></polyline>+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>+ </svg>+ </button>+ </div>+ </div>+ `).join('');+}++async function viewChannelDetails(accountId) {+ currentChannelId = accountId;+ const account = accounts.find(acc => acc.id === accountId);++ if (!account) return;++ const detailsSection = document.getElementById('channelDetailsSection');+ const channelNameEl = document.getElementById('selectedChannelName');+ const videosContainer = document.getElementById('channelVideos');++ if (!detailsSection) {+ console.warn('Channel details section not found');+ return;+ }++ if (channelNameEl) channelNameEl.textContent = account.name;+ detailsSection.style.display = 'block';++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/accounts/${accountId}/videos`);+ const data = await res.json();++ if (data.success && videosContainer) {+ if (data.videos.length === 0) {+ videosContainer.innerHTML = '<div class="empty-state"><p>No videos found</p></div>';+ } else {+ videosContainer.innerHTML = data.videos.slice(0, 12).map(video => `+ <div class="video-card">+ <div class="video-thumbnail">+ <img src="${video.thumbnailUrl}" alt="${escapeHtml(video.title)}">+ </div>+ <div class="video-info">+ <div class="video-title">${escapeHtml(video.title)}</div>+ <div class="video-stats">+ <span>+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>+ <circle cx="12" cy="12" r="3"></circle>+ </svg>+ ${formatNumber(video.viewCount || 0)}+ </span>+ <span>+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path>+ </svg>+ ${formatNumber(video.likeCount || 0)}+ </span>+ </div>+ </div>+ </div>+ `).join('');+ }+ }+ } catch (error) {+ console.error('Error loading channel videos:', error);+ showToast('Failed to load videos', 'error');+ } finally {+ hideLoading();+ }+}++function closeChannelDetails() {+ const detailsSection = document.getElementById('channelDetailsSection');+ if (detailsSection) {+ detailsSection.style.display = 'none';+ }+ currentChannelId = null;+}++function updateAccountsTab() {+ const container = document.getElementById('accountsList');++ if (!container) {+ console.warn('accountsList element not found');+ return;+ }++ if (accounts.length === 0) {+ container.innerHTML = `+ <div class="empty-state">+ <div class="empty-icon">+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>+ <circle cx="9" cy="7" r="4"></circle>+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>+ </svg>+ </div>+ <p>No accounts connected</p>+ </div>+ `;+ return;+ }++ container.innerHTML = accounts.map(account => `+ <div class="account-item">+ <div class="account-thumbnail">+ <img src="${account.thumbnailUrl || 'https://via.placeholder.com/56'}"+ alt="${escapeHtml(account.name)}">+ </div>+ <div class="account-info">+ <div class="account-name">${escapeHtml(account.name)}</div>+ <div class="account-stats">+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">+ <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/>+ </svg>+ <span>${account.platform.charAt(0).toUpperCase() + account.platform.slice(1)}</span>+ </div>+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>+ <circle cx="9" cy="7" r="4"></circle>+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>+ </svg>+ <span>${formatNumber(account.currentStats.subscribers)}</span>+ </div>+ <div class="stat">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>+ <line x1="16" y1="2" x2="16" y2="6"></line>+ <line x1="8" y1="2" x2="8" y2="6"></line>+ <line x1="3" y1="10" x2="21" y2="10"></line>+ </svg>+ <span>Added ${formatDate(account.addedAt)}</span>+ </div>+ </div>+ </div>+ <div class="account-actions">+ <button class="btn-secondary btn-small" onclick="updateSingleAccount('${account.id}')">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <polyline points="23 4 23 10 17 10"></polyline>+ <polyline points="1 20 1 14 7 14"></polyline>+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>+ </svg>+ </button>+ <button class="btn-danger btn-small" onclick="deleteAccount('${account.id}')">+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <polyline points="3 6 5 6 21 6"></polyline>+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>+ </svg>+ </button>+ </div>+ </div>+ `).join('');+}+++function showSetupWizard() {+ showAddAccountModal();+}++function showAddAccountModal() {+ const modal = document.getElementById('addAccountModal');+ if (modal) {+ modal.classList.remove('hidden');+ document.getElementById('accountName').value = '';+ document.getElementById('accountChannelId').value = '';+ document.getElementById('modalStatus').classList.add('hidden');+ }+}++function closeAddAccountModal() {+ const modal = document.getElementById('addAccountModal');+ if (modal) modal.classList.add('hidden');+}++async function testConnection() {+ const channelId = document.getElementById('accountChannelId').value.trim();++ if (!channelId) {+ showModalStatus('Please enter a Channel ID', 'error');+ return;+ }++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/test-youtube-connection`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ channelId })+ });++ const data = await res.json();++ if (data.success) {+ showModalStatus(`Connection successful! Found: ${data.data.title}`, 'success');+ } else {+ showModalStatus(data.message, 'error');+ }+ } catch (error) {+ showModalStatus('Connection test failed', 'error');+ } finally {+ hideLoading();+ }+}++async function addAccount() {+ const name = document.getElementById('accountName').value.trim();+ const platform = document.getElementById('accountPlatform').value;+ const channelId = document.getElementById('accountChannelId').value.trim();++ if (!name || !channelId) {+ showModalStatus('Please fill in all fields', 'error');+ return;+ }++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/accounts`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ name, platform, channelId })+ });++ const data = await res.json();++ if (data.success) {+ accounts.push(data.account);+ closeAddAccountModal();+ showToast('Account added successfully!', 'success');+ await loadInitialData();+ checkFirstRun();+ } else {+ showModalStatus(data.message, 'error');+ }+ } catch (error) {+ console.error('Failed to add account:', error);+ showModalStatus(`Failed to add account: ${error.message}`, 'error');+ } finally {+ hideLoading();+ }+}++async function deleteAccount(accountId) {+ if (!confirm('Are you sure you want to delete this account? This action cannot be undone.')) {+ return;+ }++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/accounts/${accountId}`, {+ method: 'DELETE'+ });++ const data = await res.json();++ if (data.success) {+ accounts = accounts.filter(acc => acc.id !== accountId);+ showToast('Account deleted successfully', 'success');+ await loadInitialData();+ checkFirstRun();+ } else {+ showToast(data.message, 'error');+ }+ } catch (error) {+ showToast('Failed to delete account', 'error');+ } finally {+ hideLoading();+ }+}++async function updateSingleAccount(accountId) {+ showLoading();++ try {+ const res = await fetch(`${API_BASE}/accounts/${accountId}/update`, {+ method: 'POST'+ });++ const data = await res.json();++ if (data.success) {+ const index = accounts.findIndex(acc => acc.id === accountId);+ if (index !== -1) {+ accounts[index] = data.account;+ }++ showToast('Stats updated successfully!', 'success');+ await loadInitialData();+ } else {+ showToast(data.message, 'error');+ }+ } catch (error) {+ showToast('Failed to update stats', 'error');+ } finally {+ hideLoading();+ }+}++async function updateAllStats() {+ if (accounts.length === 0) {+ showToast('No accounts to update', 'error');+ return;+ }++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/update-stats`, {+ method: 'POST'+ });++ if (!res.ok) {+ throw new Error(`HTTP ${res.status}: ${res.statusText}`);+ }++ const data = await res.json();++ if (data.success) {+ accounts = data.accounts;+ showToast('All stats updated successfully!', 'success');+ updateLastUpdateTime(new Date(data.updatedAt));+ await loadInitialData();+ } else {+ showToast(data.message, 'error');+ console.error('Update stats error:', data);+ }+ } catch (error) {+ console.error('Failed to update stats:', error);+ showToast(`Failed to update stats: ${error.message}`, 'error');+ } finally {+ hideLoading();+ }+}+++async function saveAPIKey() {+ const youtubeEl = document.getElementById('youtubeApiKey');++ if (!youtubeEl) {+ console.warn('youtubeApiKey element not found');+ showToast('API key input not found', 'error');+ return;+ }++ const youtube = youtubeEl.value.trim();++ if (!youtube) {+ showToast('Please enter an API key', 'error');+ return;+ }++ showLoading();++ try {+ const res = await fetch(`${API_BASE}/keys`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ youtube })+ });++ const data = await res.json();++ if (data.success) {+ showToast('API key saved successfully!', 'success');+ updateAPIStatus(youtube);+ } else {+ showToast(data.message, 'error');+ }+ } catch (error) {+ showToast('Failed to save API key', 'error');+ } finally {+ hideLoading();+ }+}++function updateAPIStatus(apiKey) {+ const statusContainer = document.getElementById('apiStatus');+ if (!statusContainer) return;++ const indicator = statusContainer.querySelector('.status-indicator');+ const text = statusContainer.querySelector('span:last-child');++ if (!indicator || !text) return;++ if (apiKey && apiKey.length > 0) {+ indicator.className = 'status-indicator status-success';+ text.textContent = 'API Key Status: Configured';+ } else {+ indicator.className = 'status-indicator status-unknown';+ text.textContent = 'API Key Status: Not configured';+ }+}++function formatNumber(num) {+ if (num >= 1000000) {+ return (num / 1000000).toFixed(1) + 'M';+ } else if (num >= 1000) {+ return (num / 1000).toFixed(1) + 'K';+ }+ return num.toString();+}++function formatDate(dateString) {+ const date = new Date(dateString);+ return date.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });+}++function escapeHtml(text) {+ const div = document.createElement('div');+ div.textContent = text;+ return div.innerHTML;+}++function updateLastUpdateTime(date) {+ const timeString = date.toLocaleString('en-US', {+ month: 'short',+ day: 'numeric',+ hour: '2-digit',+ minute: '2-digit'+ });++ const lastUpdateEl = document.getElementById('lastUpdateTime');+ const settingsUpdateEl = document.getElementById('settingsLastUpdate');++ if (lastUpdateEl) lastUpdateEl.textContent = timeString;+ if (settingsUpdateEl) settingsUpdateEl.textContent = timeString;+}++function showLoading() {+ document.getElementById('loadingOverlay').classList.remove('hidden');+}++function hideLoading() {+ document.getElementById('loadingOverlay').classList.add('hidden');+}++function showToast(message, type = 'success') {+ const toast = document.getElementById('toast');+ toast.textContent = message;+ toast.className = `toast ${type}`;+ toast.classList.remove('hidden');++ setTimeout(() => {+ toast.classList.add('hidden');+ }, 3000);+}++function showModalStatus(message, type) {+ const status = document.getElementById('modalStatus');+ status.textContent = message;+ status.className = `modal-status ${type}`;+ status.classList.remove('hidden');+}++document.addEventListener('click', (e) => {+ const modal = document.getElementById('addAccountModal');+ if (e.target === modal) {+ closeAddAccountModal();+ }+});++window.addEventListener('unhandledrejection', (event) => {+ console.error('Unhandled promise rejection:', event.reason);+ showToast(`Unhandled error: ${event.reason?.message || event.reason}`, 'error');+});++window.addEventListener('error', (event) => {+ console.error('Global error:', event.error);+});++console.log('Dashboard initialized. Server endpoint:', API_BASE);\ No newline at end of filediff --git a/public/js/chart.min.js b/public/js/chart.min.jsnew file mode 100644index 0000000..a61fbe1--- /dev/null+++ b/public/js/chart.min.js@@ -0,0 +1,22 @@+/**+ * Skipped minification because the original files appears to be already minified.+ * Original file: /npm/[email protected]/dist/chart.umd.js+ *+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files+ */+/*!+ * Chart.js v4.4.1+ * https://www.chartjs.org+ * (c) 2023 Chart.js Contributors+ * Released under the MIT License+ */+!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).Chart = e() }(this, (function () {+ "use strict"; var t = Object.freeze({ __proto__: null, get Colors() { return Go }, get Decimation() { return Qo }, get Filler() { return ma }, get Legend() { return ya }, get SubTitle() { return ka }, get Title() { return Ma }, get Tooltip() { return Ba } }); function e() { } const i = (() => { let t = 0; return () => t++ })(); function s(t) { return null == t } function n(t) { if (Array.isArray && Array.isArray(t)) return !0; const e = Object.prototype.toString.call(t); return "[object" === e.slice(0, 7) && "Array]" === e.slice(-6) } function o(t) { return null !== t && "[object Object]" === Object.prototype.toString.call(t) } function a(t) { return ("number" == typeof t || t instanceof Number) && isFinite(+t) } function r(t, e) { return a(t) ? t : e } function l(t, e) { return void 0 === t ? e : t } const h = (t, e) => "string" == typeof t && t.endsWith("%") ? parseFloat(t) / 100 : +t / e, c = (t, e) => "string" == typeof t && t.endsWith("%") ? parseFloat(t) / 100 * e : +t; function d(t, e, i) { if (t && "function" == typeof t.call) return t.apply(i, e) } function u(t, e, i, s) { let a, r, l; if (n(t)) if (r = t.length, s) for (a = r - 1; a >= 0; a--)e.call(i, t[a], a); else for (a = 0; a < r; a++)e.call(i, t[a], a); else if (o(t)) for (l = Object.keys(t), r = l.length, a = 0; a < r; a++)e.call(i, t[l[a]], l[a]) } function f(t, e) { let i, s, n, o; if (!t || !e || t.length !== e.length) return !1; for (i = 0, s = t.length; i < s; ++i)if (n = t[i], o = e[i], n.datasetIndex !== o.datasetIndex || n.index !== o.index) return !1; return !0 } function g(t) { if (n(t)) return t.map(g); if (o(t)) { const e = Object.create(null), i = Object.keys(t), s = i.length; let n = 0; for (; n < s; ++n)e[i[n]] = g(t[i[n]]); return e } return t } function p(t) { return -1 === ["__proto__", "prototype", "constructor"].indexOf(t) } function m(t, e, i, s) { if (!p(t)) return; const n = e[t], a = i[t]; o(n) && o(a) ? b(n, a, s) : e[t] = g(a) } function b(t, e, i) { const s = n(e) ? e : [e], a = s.length; if (!o(t)) return t; const r = (i = i || {}).merger || m; let l; for (let e = 0; e < a; ++e) { if (l = s[e], !o(l)) continue; const n = Object.keys(l); for (let e = 0, s = n.length; e < s; ++e)r(n[e], t, l, i) } return t } function x(t, e) { return b(t, e, { merger: _ }) } function _(t, e, i) { if (!p(t)) return; const s = e[t], n = i[t]; o(s) && o(n) ? x(s, n) : Object.prototype.hasOwnProperty.call(e, t) || (e[t] = g(n)) } const y = { "": t => t, x: t => t.x, y: t => t.y }; function v(t) { const e = t.split("."), i = []; let s = ""; for (const t of e) s += t, s.endsWith("\\") ? s = s.slice(0, -1) + "." : (i.push(s), s = ""); return i } function M(t, e) { const i = y[e] || (y[e] = function (t) { const e = v(t); return t => { for (const i of e) { if ("" === i) break; t = t && t[i] } return t } }(e)); return i(t) } function w(t) { return t.charAt(0).toUpperCase() + t.slice(1) } const k = t => void 0 !== t, S = t => "function" == typeof t, P = (t, e) => { if (t.size !== e.size) return !1; for (const i of t) if (!e.has(i)) return !1; return !0 }; function D(t) { return "mouseup" === t.type || "click" === t.type || "contextmenu" === t.type } const C = Math.PI, O = 2 * C, A = O + C, T = Number.POSITIVE_INFINITY, L = C / 180, E = C / 2, R = C / 4, I = 2 * C / 3, z = Math.log10, F = Math.sign; function V(t, e, i) { return Math.abs(t - e) < i } function B(t) { const e = Math.round(t); t = V(t, e, t / 1e3) ? e : t; const i = Math.pow(10, Math.floor(z(t))), s = t / i; return (s <= 1 ? 1 : s <= 2 ? 2 : s <= 5 ? 5 : 10) * i } function W(t) { const e = [], i = Math.sqrt(t); let s; for (s = 1; s < i; s++)t % s == 0 && (e.push(s), e.push(t / s)); return i === (0 | i) && e.push(i), e.sort(((t, e) => t - e)).pop(), e } function N(t) { return !isNaN(parseFloat(t)) && isFinite(t) } function H(t, e) { const i = Math.round(t); return i - e <= t && i + e >= t } function j(t, e, i) { let s, n, o; for (s = 0, n = t.length; s < n; s++)o = t[s][i], isNaN(o) || (e.min = Math.min(e.min, o), e.max = Math.max(e.max, o)) } function $(t) { return t * (C / 180) } function Y(t) { return t * (180 / C) } function U(t) { if (!a(t)) return; let e = 1, i = 0; for (; Math.round(t * e) / e !== t;)e *= 10, i++; return i } function X(t, e) { const i = e.x - t.x, s = e.y - t.y, n = Math.sqrt(i * i + s * s); let o = Math.atan2(s, i); return o < -.5 * C && (o += O), { angle: o, distance: n } } function q(t, e) { return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2)) } function K(t, e) { return (t - e + A) % O - C } function G(t) { return (t % O + O) % O } function Z(t, e, i, s) { const n = G(t), o = G(e), a = G(i), r = G(o - n), l = G(a - n), h = G(n - o), c = G(n - a); return n === o || n === a || s && o === a || r > l && h < c } function J(t, e, i) { return Math.max(e, Math.min(i, t)) } function Q(t) { return J(t, -32768, 32767) } function tt(t, e, i, s = 1e-6) { return t >= Math.min(e, i) - s && t <= Math.max(e, i) + s } function et(t, e, i) { i = i || (i => t[i] < e); let s, n = t.length - 1, o = 0; for (; n - o > 1;)s = o + n >> 1, i(s) ? o = s : n = s; return { lo: o, hi: n } } const it = (t, e, i, s) => et(t, i, s ? s => { const n = t[s][e]; return n < i || n === i && t[s + 1][e] === i } : s => t[s][e] < i), st = (t, e, i) => et(t, i, (s => t[s][e] >= i)); function nt(t, e, i) { let s = 0, n = t.length; for (; s < n && t[s] < e;)s++; for (; n > s && t[n - 1] > i;)n--; return s > 0 || n < t.length ? t.slice(s, n) : t } const ot = ["push", "pop", "shift", "splice", "unshift"]; function at(t, e) { t._chartjs ? t._chartjs.listeners.push(e) : (Object.defineProperty(t, "_chartjs", { configurable: !0, enumerable: !1, value: { listeners: [e] } }), ot.forEach((e => { const i = "_onData" + w(e), s = t[e]; Object.defineProperty(t, e, { configurable: !0, enumerable: !1, value(...e) { const n = s.apply(this, e); return t._chartjs.listeners.forEach((t => { "function" == typeof t[i] && t[i](...e) })), n } }) }))) } function rt(t, e) { const i = t._chartjs; if (!i) return; const s = i.listeners, n = s.indexOf(e); -1 !== n && s.splice(n, 1), s.length > 0 || (ot.forEach((e => { delete t[e] })), delete t._chartjs) } function lt(t) { const e = new Set(t); return e.size === t.length ? t : Array.from(e) } const ht = "undefined" == typeof window ? function (t) { return t() } : window.requestAnimationFrame; function ct(t, e) { let i = [], s = !1; return function (...n) { i = n, s || (s = !0, ht.call(window, (() => { s = !1, t.apply(e, i) }))) } } function dt(t, e) { let i; return function (...s) { return e ? (clearTimeout(i), i = setTimeout(t, e, s)) : t.apply(this, s), e } } const ut = t => "start" === t ? "left" : "end" === t ? "right" : "center", ft = (t, e, i) => "start" === t ? e : "end" === t ? i : (e + i) / 2, gt = (t, e, i, s) => t === (s ? "left" : "right") ? i : "center" === t ? (e + i) / 2 : e; function pt(t, e, i) { const s = e.length; let n = 0, o = s; if (t._sorted) { const { iScale: a, _parsed: r } = t, l = a.axis, { min: h, max: c, minDefined: d, maxDefined: u } = a.getUserBounds(); d && (n = J(Math.min(it(r, l, h).lo, i ? s : it(e, l, a.getPixelForValue(h)).lo), 0, s - 1)), o = u ? J(Math.max(it(r, a.axis, c, !0).hi + 1, i ? 0 : it(e, l, a.getPixelForValue(c), !0).hi + 1), n, s) - n : s - n } return { start: n, count: o } } function mt(t) { const { xScale: e, yScale: i, _scaleRanges: s } = t, n = { xmin: e.min, xmax: e.max, ymin: i.min, ymax: i.max }; if (!s) return t._scaleRanges = n, !0; const o = s.xmin !== e.min || s.xmax !== e.max || s.ymin !== i.min || s.ymax !== i.max; return Object.assign(s, n), o } class bt { constructor() { this._request = null, this._charts = new Map, this._running = !1, this._lastDate = void 0 } _notify(t, e, i, s) { const n = e.listeners[s], o = e.duration; n.forEach((s => s({ chart: t, initial: e.initial, numSteps: o, currentStep: Math.min(i - e.start, o) }))) } _refresh() { this._request || (this._running = !0, this._request = ht.call(window, (() => { this._update(), this._request = null, this._running && this._refresh() }))) } _update(t = Date.now()) { let e = 0; this._charts.forEach(((i, s) => { if (!i.running || !i.items.length) return; const n = i.items; let o, a = n.length - 1, r = !1; for (; a >= 0; --a)o = n[a], o._active ? (o._total > i.duration && (i.duration = o._total), o.tick(t), r = !0) : (n[a] = n[n.length - 1], n.pop()); r && (s.draw(), this._notify(s, i, t, "progress")), n.length || (i.running = !1, this._notify(s, i, t, "complete"), i.initial = !1), e += n.length })), this._lastDate = t, 0 === e && (this._running = !1) } _getAnims(t) { const e = this._charts; let i = e.get(t); return i || (i = { running: !1, initial: !0, items: [], listeners: { complete: [], progress: [] } }, e.set(t, i)), i } listen(t, e, i) { this._getAnims(t).listeners[e].push(i) } 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(((t, e) => Math.max(t, e._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 i = e.items; let s = i.length - 1; for (; s >= 0; --s)i[s].cancel(); e.items = [], this._notify(t, e, Date.now(), "complete") } remove(t) { return this._charts.delete(t) } } var xt = new bt;+/*!+ * @kurkle/color v0.3.2+ * https://github.com/kurkle/color#readme+ * (c) 2023 Jukka Kurkela+ * Released under the MIT License+ */function _t(t) { return t + .5 | 0 } const yt = (t, e, i) => Math.max(Math.min(t, i), e); function vt(t) { return yt(_t(2.55 * t), 0, 255) } function Mt(t) { return yt(_t(255 * t), 0, 255) } function wt(t) { return yt(_t(t / 2.55) / 100, 0, 1) } function kt(t) { return yt(_t(100 * t), 0, 100) } const St = { 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 }, Pt = [..."0123456789ABCDEF"], Dt = t => Pt[15 & t], Ct = t => Pt[(240 & t) >> 4] + Pt[15 & t], Ot = t => (240 & t) >> 4 == (15 & t); function At(t) { var e = (t => Ot(t.r) && Ot(t.g) && Ot(t.b) && Ot(t.a))(t) ? Dt : Ct; return t ? "#" + e(t.r) + e(t.g) + e(t.b) + ((t, e) => t < 255 ? e(t) : "")(t.a, e) : void 0 } const Tt = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/; function Lt(t, e, i) { const s = e * Math.min(i, 1 - i), n = (e, n = (e + t / 30) % 12) => i - s * Math.max(Math.min(n - 3, 9 - n, 1), -1); return [n(0), n(8), n(4)] } function Et(t, e, i) { const s = (s, n = (s + t / 60) % 6) => i - i * e * Math.max(Math.min(n, 4 - n, 1), 0); return [s(5), s(3), s(1)] } function Rt(t, e, i) { const s = Lt(t, 1, .5); let n; for (e + i > 1 && (n = 1 / (e + i), e *= n, i *= n), n = 0; n < 3; n++)s[n] *= 1 - e - i, s[n] += e; return s } function It(t) { const e = t.r / 255, i = t.g / 255, s = t.b / 255, n = Math.max(e, i, s), o = Math.min(e, i, s), a = (n + o) / 2; let r, l, h; return n !== o && (h = n - o, l = a > .5 ? h / (2 - n - o) : h / (n + o), r = function (t, e, i, s, n) { return t === n ? (e - i) / s + (e < i ? 6 : 0) : e === n ? (i - t) / s + 2 : (t - e) / s + 4 }(e, i, s, h, n), r = 60 * r + .5), [0 | r, l || 0, a] } function zt(t, e, i, s) { return (Array.isArray(e) ? t(e[0], e[1], e[2]) : t(e, i, s)).map(Mt) } function Ft(t, e, i) { return zt(Lt, t, e, i) } function Vt(t) { return (t % 360 + 360) % 360 } function Bt(t) { const e = Tt.exec(t); let i, s = 255; if (!e) return; e[5] !== i && (s = e[6] ? vt(+e[5]) : Mt(+e[5])); const n = Vt(+e[2]), o = +e[3] / 100, a = +e[4] / 100; return i = "hwb" === e[1] ? function (t, e, i) { return zt(Rt, t, e, i) }(n, o, a) : "hsv" === e[1] ? function (t, e, i) { return zt(Et, t, e, i) }(n, o, a) : Ft(n, o, a), { r: i[0], g: i[1], b: i[2], a: s } } const Wt = { 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" }, Nt = { 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" }; let Ht; function jt(t) { Ht || (Ht = function () { const t = {}, e = Object.keys(Nt), i = Object.keys(Wt); let s, n, o, a, r; for (s = 0; s < e.length; s++) { for (a = r = e[s], n = 0; n < i.length; n++)o = i[n], r = r.replace(o, Wt[o]); o = parseInt(Nt[a], 16), t[r] = [o >> 16 & 255, o >> 8 & 255, 255 & o] } return t }(), Ht.transparent = [0, 0, 0, 0]); const e = Ht[t.toLowerCase()]; return e && { r: e[0], g: e[1], b: e[2], a: 4 === e.length ? e[3] : 255 } } const $t = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/; const Yt = t => t <= .0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - .055, Ut = t => t <= .04045 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4); function Xt(t, e, i) { if (t) { let s = It(t); s[e] = Math.max(0, Math.min(s[e] + s[e] * i, 0 === e ? 360 : 1)), s = Ft(s), t.r = s[0], t.g = s[1], t.b = s[2] } } function qt(t, e) { return t ? Object.assign(e || {}, t) : t } function Kt(t) { var e = { r: 0, g: 0, b: 0, a: 255 }; return Array.isArray(t) ? t.length >= 3 && (e = { r: t[0], g: t[1], b: t[2], a: 255 }, t.length > 3 && (e.a = Mt(t[3]))) : (e = qt(t, { r: 0, g: 0, b: 0, a: 1 })).a = Mt(e.a), e } function Gt(t) { return "r" === t.charAt(0) ? function (t) { const e = $t.exec(t); let i, s, n, o = 255; if (e) { if (e[7] !== i) { const t = +e[7]; o = e[8] ? vt(t) : yt(255 * t, 0, 255) } return i = +e[1], s = +e[3], n = +e[5], i = 255 & (e[2] ? vt(i) : yt(i, 0, 255)), s = 255 & (e[4] ? vt(s) : yt(s, 0, 255)), n = 255 & (e[6] ? vt(n) : yt(n, 0, 255)), { r: i, g: s, b: n, a: o } } }(t) : Bt(t) } class Zt { constructor(t) { if (t instanceof Zt) return t; const e = typeof t; let i; var s, n, o; "object" === e ? i = Kt(t) : "string" === e && (o = (s = t).length, "#" === s[0] && (4 === o || 5 === o ? n = { r: 255 & 17 * St[s[1]], g: 255 & 17 * St[s[2]], b: 255 & 17 * St[s[3]], a: 5 === o ? 17 * St[s[4]] : 255 } : 7 !== o && 9 !== o || (n = { r: St[s[1]] << 4 | St[s[2]], g: St[s[3]] << 4 | St[s[4]], b: St[s[5]] << 4 | St[s[6]], a: 9 === o ? St[s[7]] << 4 | St[s[8]] : 255 })), i = n || jt(t) || Gt(t)), this._rgb = i, this._valid = !!i } get valid() { return this._valid } get rgb() { var t = qt(this._rgb); return t && (t.a = wt(t.a)), t } set rgb(t) { this._rgb = Kt(t) } rgbString() { return this._valid ? (t = this._rgb) && (t.a < 255 ? `rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})` : `rgb(${t.r}, ${t.g}, ${t.b})`) : void 0; var t } hexString() { return this._valid ? At(this._rgb) : void 0 } hslString() { return this._valid ? function (t) { if (!t) return; const e = It(t), i = e[0], s = kt(e[1]), n = kt(e[2]); return t.a < 255 ? `hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})` : `hsl(${i}, ${s}%, ${n}%)` }(this._rgb) : void 0 } mix(t, e) { if (t) { const i = this.rgb, s = t.rgb; let n; const o = e === n ? .5 : e, a = 2 * o - 1, r = i.a - s.a, l = ((a * r == -1 ? a : (a + r) / (1 + a * r)) + 1) / 2; n = 1 - l, i.r = 255 & l * i.r + n * s.r + .5, i.g = 255 & l * i.g + n * s.g + .5, i.b = 255 & l * i.b + n * s.b + .5, i.a = o * i.a + (1 - o) * s.a, this.rgb = i } return this } interpolate(t, e) { return t && (this._rgb = function (t, e, i) { const s = Ut(wt(t.r)), n = Ut(wt(t.g)), o = Ut(wt(t.b)); return { r: Mt(Yt(s + i * (Ut(wt(e.r)) - s))), g: Mt(Yt(n + i * (Ut(wt(e.g)) - n))), b: Mt(Yt(o + i * (Ut(wt(e.b)) - o))), a: t.a + i * (e.a - t.a) } }(this._rgb, t._rgb, e)), this } clone() { return new Zt(this.rgb) } alpha(t) { return this._rgb.a = Mt(t), this } clearer(t) { return this._rgb.a *= 1 - t, this } greyscale() { const t = this._rgb, e = _t(.3 * t.r + .59 * t.g + .11 * t.b); return t.r = t.g = t.b = e, this } opaquer(t) { return this._rgb.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 Xt(this._rgb, 2, t), this } darken(t) { return Xt(this._rgb, 2, -t), this } saturate(t) { return Xt(this._rgb, 1, t), this } desaturate(t) { return Xt(this._rgb, 1, -t), this } rotate(t) { return function (t, e) { var i = It(t); i[0] = Vt(i[0] + e), i = Ft(i), t.r = i[0], t.g = i[1], t.b = i[2] }(this._rgb, t), this } } function Jt(t) { if (t && "object" == typeof t) { const e = t.toString(); return "[object CanvasPattern]" === e || "[object CanvasGradient]" === e } return !1 } function Qt(t) { return Jt(t) ? t : new Zt(t) } function te(t) { return Jt(t) ? t : new Zt(t).saturate(.5).darken(.1).hexString() } const ee = ["x", "y", "borderWidth", "radius", "tension"], ie = ["color", "borderColor", "backgroundColor"]; const se = new Map; function ne(t, e, i) { return function (t, e) { e = e || {}; const i = t + JSON.stringify(e); let s = se.get(i); return s || (s = new Intl.NumberFormat(t, e), se.set(i, s)), s }(e, i).format(t) } const oe = { values: t => n(t) ? t : "" + t, numeric(t, e, i) { if (0 === t) return "0"; const s = this.chart.options.locale; let n, o = t; if (i.length > 1) { const e = Math.max(Math.abs(i[0].value), Math.abs(i[i.length - 1].value)); (e < 1e-4 || e > 1e15) && (n = "scientific"), o = function (t, e) { let i = e.length > 3 ? e[2].value - e[1].value : e[1].value - e[0].value; Math.abs(i) >= 1 && t !== Math.floor(t) && (i = t - Math.floor(t)); return i }(t, i) } const a = z(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), ne(t, s, l) }, logarithmic(t, e, i) { if (0 === t) return "0"; const s = i[e].significand || t / Math.pow(10, Math.floor(z(t))); return [1, 2, 3, 5, 10, 15].includes(s) || e > .8 * i.length ? oe.numeric.call(this, t, e, i) : "" } }; var ae = { formatters: oe }; const re = Object.create(null), le = Object.create(null); function he(t, e) { if (!e) return t; const i = e.split("."); for (let e = 0, s = i.length; e < s; ++e) { const s = i[e]; t = t[s] || (t[s] = Object.create(null)) } return t } function ce(t, e, i) { return "string" == typeof e ? b(he(t, e), i) : b(he(t, ""), e) } class de { constructor(t, e) { this.animation = void 0, this.backgroundColor = "rgba(0,0,0,0.1)", this.borderColor = "rgba(0,0,0,0.1)", this.color = "#666", this.datasets = {}, this.devicePixelRatio = t => t.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 = (t, e) => te(e.backgroundColor), this.hoverBorderColor = (t, e) => te(e.borderColor), this.hoverColor = (t, e) => te(e.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 ce(this, t, e) } get(t) { return he(this, t) } describe(t, e) { return ce(le, t, e) } override(t, e) { return ce(re, t, e) } route(t, e, i, s) { const n = he(this, t), a = he(this, i), r = "_" + e; Object.defineProperties(n, { [r]: { value: n[e], writable: !0 }, [e]: { enumerable: !0, get() { const t = this[r], e = a[s]; return o(t) ? Object.assign({}, e, t) : l(t, e) }, set(t) { this[r] = t } } }) } apply(t) { t.forEach((t => t(this))) } } var ue = new de({ _scriptable: t => !t.startsWith("on"), _indexable: t => "events" !== t, hover: { _fallback: "interaction" }, interaction: { _scriptable: !1, _indexable: !1 } }, [function (t) { t.set("animation", { delay: void 0, duration: 1e3, easing: "easeOutQuart", fn: void 0, from: void 0, loop: void 0, to: void 0, type: void 0 }), t.describe("animation", { _fallback: !1, _indexable: !1, _scriptable: t => "onProgress" !== t && "onComplete" !== t && "fn" !== t }), t.set("animations", { colors: { type: "color", properties: ie }, numbers: { type: "number", properties: ee } }), t.describe("animations", { _fallback: "animation" }), t.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 => 0 | t } } } }) }, function (t) { t.set("layout", { autoPadding: !0, padding: { top: 0, right: 0, bottom: 0, left: 0 } }) }, function (t) { t.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: ae.formatters.values, minor: {}, major: {}, align: "center", crossAlign: "near", showLabelBackdrop: !1, backdropColor: "rgba(255, 255, 255, 0.75)", backdropPadding: 2 } }), t.route("scale.ticks", "color", "", "color"), t.route("scale.grid", "color", "", "borderColor"), t.route("scale.border", "color", "", "borderColor"), t.route("scale.title", "color", "", "color"), t.describe("scale", { _fallback: !1, _scriptable: t => !t.startsWith("before") && !t.startsWith("after") && "callback" !== t && "parser" !== t, _indexable: t => "borderDash" !== t && "tickBorderDash" !== t && "dash" !== t }), t.describe("scales", { _fallback: "scale" }), t.describe("scale.ticks", { _scriptable: t => "backdropPadding" !== t && "callback" !== t, _indexable: t => "backdropPadding" !== t }) }]); function fe() { return "undefined" != typeof window && "undefined" != typeof document } function ge(t) { let e = t.parentNode; return e && "[object ShadowRoot]" === e.toString() && (e = e.host), e } function pe(t, e, i) { let s; return "string" == typeof t ? (s = parseInt(t, 10), -1 !== t.indexOf("%") && (s = s / 100 * e.parentNode[i])) : s = t, s } const me = t => t.ownerDocument.defaultView.getComputedStyle(t, null); function be(t, e) { return me(t).getPropertyValue(e) } const xe = ["top", "right", "bottom", "left"]; function _e(t, e, i) { const s = {}; i = i ? "-" + i : ""; for (let n = 0; n < 4; n++) { const o = xe[n]; s[o] = parseFloat(t[e + "-" + o + i]) || 0 } return s.width = s.left + s.right, s.height = s.top + s.bottom, s } const ye = (t, e, i) => (t > 0 || e > 0) && (!i || !i.shadowRoot); function ve(t, e) { if ("native" in t) return t; const { canvas: i, currentDevicePixelRatio: s } = e, n = me(i), o = "border-box" === n.boxSizing, a = _e(n, "padding"), r = _e(n, "border", "width"), { x: l, y: h, box: c } = function (t, e) { const i = t.touches, s = i && i.length ? i[0] : t, { offsetX: n, offsetY: o } = s; let a, r, l = !1; if (ye(n, o, t.target)) a = n, r = o; else { const t = e.getBoundingClientRect(); a = s.clientX - t.left, r = s.clientY - t.top, l = !0 } return { x: a, y: r, box: l } }(t, i), d = a.left + (c && r.left), u = a.top + (c && r.top); let { width: f, height: g } = e; return o && (f -= a.width + r.width, g -= a.height + r.height), { x: Math.round((l - d) / f * i.width / s), y: Math.round((h - u) / g * i.height / s) } } const Me = t => Math.round(10 * t) / 10; function we(t, e, i, s) { const n = me(t), o = _e(n, "margin"), a = pe(n.maxWidth, t, "clientWidth") || T, r = pe(n.maxHeight, t, "clientHeight") || T, l = function (t, e, i) { let s, n; if (void 0 === e || void 0 === i) { const o = ge(t); if (o) { const t = o.getBoundingClientRect(), a = me(o), r = _e(a, "border", "width"), l = _e(a, "padding"); e = t.width - l.width - r.width, i = t.height - l.height - r.height, s = pe(a.maxWidth, o, "clientWidth"), n = pe(a.maxHeight, o, "clientHeight") } else e = t.clientWidth, i = t.clientHeight } return { width: e, height: i, maxWidth: s || T, maxHeight: n || T } }(t, e, i); let { width: h, height: c } = l; if ("content-box" === n.boxSizing) { const t = _e(n, "border", "width"), e = _e(n, "padding"); h -= e.width + t.width, c -= e.height + t.height } h = Math.max(0, h - o.width), c = Math.max(0, s ? h / s : c - o.height), h = Me(Math.min(h, a, l.maxWidth)), c = Me(Math.min(c, r, l.maxHeight)), h && !c && (c = Me(h / 2)); return (void 0 !== e || void 0 !== i) && s && l.height && c > l.height && (c = l.height, h = Me(Math.floor(c * s))), { width: h, height: c } } function ke(t, e, i) { const s = e || 1, n = Math.floor(t.height * s), o = Math.floor(t.width * s); t.height = Math.floor(t.height), t.width = Math.floor(t.width); const a = t.canvas; return a.style && (i || !a.style.height && !a.style.width) && (a.style.height = `${t.height}px`, a.style.width = `${t.width}px`), (t.currentDevicePixelRatio !== s || a.height !== n || a.width !== o) && (t.currentDevicePixelRatio = s, a.height = n, a.width = o, t.ctx.setTransform(s, 0, 0, s, 0, 0), !0) } const Se = function () { let t = !1; try { const e = { get passive() { return t = !0, !1 } }; fe() && (window.addEventListener("test", null, e), window.removeEventListener("test", null, e)) } catch (t) { } return t }(); function Pe(t, e) { const i = be(t, e), s = i && i.match(/^(\d+)(\.\d+)?px$/); return s ? +s[1] : void 0 } function De(t) { return !t || s(t.size) || s(t.family) ? null : (t.style ? t.style + " " : "") + (t.weight ? t.weight + " " : "") + t.size + "px " + t.family } function Ce(t, e, i, s, n) { let o = e[n]; return o || (o = e[n] = t.measureText(n).width, i.push(n)), o > s && (s = o), s } function Oe(t, e, i, s) { let o = (s = s || {}).data = s.data || {}, a = s.garbageCollect = s.garbageCollect || []; s.font !== e && (o = s.data = {}, a = s.garbageCollect = [], s.font = e), t.save(), t.font = e; let r = 0; const l = i.length; let h, c, d, u, f; for (h = 0; h < l; h++)if (u = i[h], null == u || n(u)) { if (n(u)) for (c = 0, d = u.length; c < d; c++)f = u[c], null == f || n(f) || (r = Ce(t, o, a, r, f)) } else r = Ce(t, o, a, r, u); t.restore(); const g = a.length / 2; if (g > i.length) { for (h = 0; h < g; h++)delete o[a[h]]; a.splice(0, g) } return r } function Ae(t, e, i) { const s = t.currentDevicePixelRatio, n = 0 !== i ? Math.max(i / 2, .5) : 0; return Math.round((e - n) * s) / s + n } function Te(t, e) { (e = e || t.getContext("2d")).save(), e.resetTransform(), e.clearRect(0, 0, t.width, t.height), e.restore() } function Le(t, e, i, s) { Ee(t, e, i, s, null) } function Ee(t, e, i, s, n) { let o, a, r, l, h, c, d, u; const f = e.pointStyle, g = e.rotation, p = e.radius; let m = (g || 0) * L; if (f && "object" == typeof f && (o = f.toString(), "[object HTMLImageElement]" === o || "[object HTMLCanvasElement]" === o)) return t.save(), t.translate(i, s), t.rotate(m), t.drawImage(f, -f.width / 2, -f.height / 2, f.width, f.height), void t.restore(); if (!(isNaN(p) || p <= 0)) { switch (t.beginPath(), f) { default: n ? t.ellipse(i, s, n / 2, p, 0, 0, O) : t.arc(i, s, p, 0, O), t.closePath(); break; case "triangle": c = n ? n / 2 : p, t.moveTo(i + Math.sin(m) * c, s - Math.cos(m) * p), m += I, t.lineTo(i + Math.sin(m) * c, s - Math.cos(m) * p), m += I, t.lineTo(i + Math.sin(m) * c, s - Math.cos(m) * p), t.closePath(); break; case "rectRounded": h = .516 * p, l = p - h, a = Math.cos(m + R) * l, d = Math.cos(m + R) * (n ? n / 2 - h : l), r = Math.sin(m + R) * l, u = Math.sin(m + R) * (n ? n / 2 - h : l), t.arc(i - d, s - r, h, m - C, m - E), t.arc(i + u, s - a, h, m - E, m), t.arc(i + d, s + r, h, m, m + E), t.arc(i - u, s + a, h, m + E, m + C), t.closePath(); break; case "rect": if (!g) { l = Math.SQRT1_2 * p, c = n ? n / 2 : l, t.rect(i - c, s - l, 2 * c, 2 * l); break } m += R; case "rectRot": d = Math.cos(m) * (n ? n / 2 : p), a = Math.cos(m) * p, r = Math.sin(m) * p, u = Math.sin(m) * (n ? n / 2 : p), t.moveTo(i - d, s - r), t.lineTo(i + u, s - a), t.lineTo(i + d, s + r), t.lineTo(i - u, s + a), t.closePath(); break; case "crossRot": m += R; case "cross": d = Math.cos(m) * (n ? n / 2 : p), a = Math.cos(m) * p, r = Math.sin(m) * p, u = Math.sin(m) * (n ? n / 2 : p), t.moveTo(i - d, s - r), t.lineTo(i + d, s + r), t.moveTo(i + u, s - a), t.lineTo(i - u, s + a); break; case "star": d = Math.cos(m) * (n ? n / 2 : p), a = Math.cos(m) * p, r = Math.sin(m) * p, u = Math.sin(m) * (n ? n / 2 : p), t.moveTo(i - d, s - r), t.lineTo(i + d, s + r), t.moveTo(i + u, s - a), t.lineTo(i - u, s + a), m += R, d = Math.cos(m) * (n ? n / 2 : p), a = Math.cos(m) * p, r = Math.sin(m) * p, u = Math.sin(m) * (n ? n / 2 : p), t.moveTo(i - d, s - r), t.lineTo(i + d, s + r), t.moveTo(i + u, s - a), t.lineTo(i - u, s + a); break; case "line": a = n ? n / 2 : Math.cos(m) * p, r = Math.sin(m) * p, t.moveTo(i - a, s - r), t.lineTo(i + a, s + r); break; case "dash": t.moveTo(i, s), t.lineTo(i + Math.cos(m) * (n ? n / 2 : p), s + Math.sin(m) * p); break; case !1: t.closePath() }t.fill(), e.borderWidth > 0 && t.stroke() } } function Re(t, e, i) { return i = i || .5, !e || t && t.x > e.left - i && t.x < e.right + i && t.y > e.top - i && t.y < e.bottom + i } function Ie(t, e) { t.save(), t.beginPath(), t.rect(e.left, e.top, e.right - e.left, e.bottom - e.top), t.clip() } function ze(t) { t.restore() } function Fe(t, e, i, s, n) { if (!e) return t.lineTo(i.x, i.y); if ("middle" === n) { const s = (e.x + i.x) / 2; t.lineTo(s, e.y), t.lineTo(s, i.y) } else "after" === n != !!s ? t.lineTo(e.x, i.y) : t.lineTo(i.x, e.y); t.lineTo(i.x, i.y) } function Ve(t, e, i, s) { if (!e) return t.lineTo(i.x, i.y); t.bezierCurveTo(s ? e.cp1x : e.cp2x, s ? e.cp1y : e.cp2y, s ? i.cp2x : i.cp1x, s ? i.cp2y : i.cp1y, i.x, i.y) } function Be(t, e, i, s, n) { if (n.strikethrough || n.underline) { const o = t.measureText(s), a = e - o.actualBoundingBoxLeft, r = e + o.actualBoundingBoxRight, l = i - o.actualBoundingBoxAscent, h = i + o.actualBoundingBoxDescent, c = n.strikethrough ? (l + h) / 2 : h; t.strokeStyle = t.fillStyle, t.beginPath(), t.lineWidth = n.decorationWidth || 2, t.moveTo(a, c), t.lineTo(r, c), t.stroke() } } function We(t, e) { const i = t.fillStyle; t.fillStyle = e.color, t.fillRect(e.left, e.top, e.width, e.height), t.fillStyle = i } function Ne(t, e, i, o, a, r = {}) { const l = n(e) ? e : [e], h = r.strokeWidth > 0 && "" !== r.strokeColor; let c, d; for (t.save(), t.font = a.string, function (t, e) { e.translation && t.translate(e.translation[0], e.translation[1]), s(e.rotation) || t.rotate(e.rotation), e.color && (t.fillStyle = e.color), e.textAlign && (t.textAlign = e.textAlign), e.textBaseline && (t.textBaseline = e.textBaseline) }(t, r), c = 0; c < l.length; ++c)d = l[c], r.backdrop && We(t, r.backdrop), h && (r.strokeColor && (t.strokeStyle = r.strokeColor), s(r.strokeWidth) || (t.lineWidth = r.strokeWidth), t.strokeText(d, i, o, r.maxWidth)), t.fillText(d, i, o, r.maxWidth), Be(t, i, o, d, r), o += Number(a.lineHeight); t.restore() } function He(t, e) { const { x: i, y: s, w: n, h: o, radius: a } = e; t.arc(i + a.topLeft, s + a.topLeft, a.topLeft, 1.5 * C, C, !0), t.lineTo(i, s + o - a.bottomLeft), t.arc(i + a.bottomLeft, s + o - a.bottomLeft, a.bottomLeft, C, E, !0), t.lineTo(i + n - a.bottomRight, s + o), t.arc(i + n - a.bottomRight, s + o - a.bottomRight, a.bottomRight, E, 0, !0), t.lineTo(i + n, s + a.topRight), t.arc(i + n - a.topRight, s + a.topRight, a.topRight, 0, -E, !0), t.lineTo(i + a.topLeft, s) } function je(t, e = [""], i, s, n = (() => t[0])) { const o = i || t; void 0 === s && (s = ti("_fallback", t)); const a = { [Symbol.toStringTag]: "Object", _cacheable: !0, _scopes: t, _rootScopes: o, _fallback: s, _getTarget: n, override: i => je([i, ...t], e, o, s) }; return new Proxy(a, { deleteProperty: (e, i) => (delete e[i], delete e._keys, delete t[0][i], !0), get: (i, s) => qe(i, s, (() => function (t, e, i, s) { let n; for (const o of e) if (n = ti(Ue(o, t), i), void 0 !== n) return Xe(t, n) ? Je(i, s, t, n) : n }(s, e, t, i))), getOwnPropertyDescriptor: (t, e) => Reflect.getOwnPropertyDescriptor(t._scopes[0], e), getPrototypeOf: () => Reflect.getPrototypeOf(t[0]), has: (t, e) => ei(t).includes(e), ownKeys: t => ei(t), set(t, e, i) { const s = t._storage || (t._storage = n()); return t[e] = s[e] = i, delete t._keys, !0 } }) } function $e(t, e, i, s) { const a = { _cacheable: !1, _proxy: t, _context: e, _subProxy: i, _stack: new Set, _descriptors: Ye(t, s), setContext: e => $e(t, e, i, s), override: n => $e(t.override(n), e, i, s) }; return new Proxy(a, { deleteProperty: (e, i) => (delete e[i], delete t[i], !0), get: (t, e, i) => qe(t, e, (() => function (t, e, i) { const { _proxy: s, _context: a, _subProxy: r, _descriptors: l } = t; let h = s[e]; S(h) && l.isScriptable(e) && (h = function (t, e, i, s) { const { _proxy: n, _context: o, _subProxy: a, _stack: r } = i; if (r.has(t)) throw new Error("Recursion detected: " + Array.from(r).join("->") + "->" + t); r.add(t); let l = e(o, a || s); r.delete(t), Xe(t, l) && (l = Je(n._scopes, n, t, l)); return l }(e, h, t, i)); n(h) && h.length && (h = function (t, e, i, s) { const { _proxy: n, _context: a, _subProxy: r, _descriptors: l } = i; if (void 0 !== a.index && s(t)) return e[a.index % e.length]; if (o(e[0])) { const i = e, s = n._scopes.filter((t => t !== i)); e = []; for (const o of i) { const i = Je(s, n, t, o); e.push($e(i, a, r && r[t], l)) } } return e }(e, h, t, l.isIndexable)); Xe(e, h) && (h = $e(h, a, r && r[e], l)); return h }(t, e, i))), getOwnPropertyDescriptor: (e, i) => e._descriptors.allKeys ? Reflect.has(t, i) ? { enumerable: !0, configurable: !0 } : void 0 : Reflect.getOwnPropertyDescriptor(t, i), getPrototypeOf: () => Reflect.getPrototypeOf(t), has: (e, i) => Reflect.has(t, i), ownKeys: () => Reflect.ownKeys(t), set: (e, i, s) => (t[i] = s, delete e[i], !0) }) } function Ye(t, e = { scriptable: !0, indexable: !0 }) { const { _scriptable: i = e.scriptable, _indexable: s = e.indexable, _allKeys: n = e.allKeys } = t; return { allKeys: n, scriptable: i, indexable: s, isScriptable: S(i) ? i : () => i, isIndexable: S(s) ? s : () => s } } const Ue = (t, e) => t ? t + w(e) : e, Xe = (t, e) => o(e) && "adapters" !== t && (null === Object.getPrototypeOf(e) || e.constructor === Object); function qe(t, e, i) { if (Object.prototype.hasOwnProperty.call(t, e)) return t[e]; const s = i(); return t[e] = s, s } function Ke(t, e, i) { return S(t) ? t(e, i) : t } const Ge = (t, e) => !0 === t ? e : "string" == typeof t ? M(e, t) : void 0; function Ze(t, e, i, s, n) { for (const o of e) { const e = Ge(i, o); if (e) { t.add(e); const o = Ke(e._fallback, i, n); if (void 0 !== o && o !== i && o !== s) return o } else if (!1 === e && void 0 !== s && i !== s) return null } return !1 } function Je(t, e, i, s) { const a = e._rootScopes, r = Ke(e._fallback, i, s), l = [...t, ...a], h = new Set; h.add(s); let c = Qe(h, l, i, r || i, s); return null !== c && ((void 0 === r || r === i || (c = Qe(h, l, r, c, s), null !== c)) && je(Array.from(h), [""], a, r, (() => function (t, e, i) { const s = t._getTarget(); e in s || (s[e] = {}); const a = s[e]; if (n(a) && o(i)) return i; return a || {} }(e, i, s)))) } function Qe(t, e, i, s, n) { for (; i;)i = Ze(t, e, i, s, n); return i } function ti(t, e) { for (const i of e) { if (!i) continue; const e = i[t]; if (void 0 !== e) return e } } function ei(t) { let e = t._keys; return e || (e = t._keys = function (t) { const e = new Set; for (const i of t) for (const t of Object.keys(i).filter((t => !t.startsWith("_")))) e.add(t); return Array.from(e) }(t._scopes)), e } function ii(t, e, i, s) { const { iScale: n } = t, { key: o = "r" } = this._parsing, a = new Array(s); let r, l, h, c; for (r = 0, l = s; r < l; ++r)h = r + i, c = e[h], a[r] = { r: n.parse(M(c, o), h) }; return a } const si = Number.EPSILON || 1e-14, ni = (t, e) => e < t.length && !t[e].skip && t[e], oi = t => "x" === t ? "y" : "x"; function ai(t, e, i, s) { const n = t.skip ? e : t, o = e, a = i.skip ? e : i, r = q(o, n), l = q(a, o); let h = r / (r + l), c = l / (r + l); h = isNaN(h) ? 0 : h, c = isNaN(c) ? 0 : c; const d = s * h, u = s * c; return { previous: { x: o.x - d * (a.x - n.x), y: o.y - d * (a.y - n.y) }, next: { x: o.x + u * (a.x - n.x), y: o.y + u * (a.y - n.y) } } } function ri(t, e = "x") { const i = oi(e), s = t.length, n = Array(s).fill(0), o = Array(s); let a, r, l, h = ni(t, 0); for (a = 0; a < s; ++a)if (r = l, l = h, h = ni(t, a + 1), l) { if (h) { const t = h[e] - l[e]; n[a] = 0 !== t ? (h[i] - l[i]) / t : 0 } o[a] = r ? h ? F(n[a - 1]) !== F(n[a]) ? 0 : (n[a - 1] + n[a]) / 2 : n[a - 1] : n[a] } !function (t, e, i) { const s = t.length; let n, o, a, r, l, h = ni(t, 0); for (let c = 0; c < s - 1; ++c)l = h, h = ni(t, c + 1), l && h && (V(e[c], 0, si) ? i[c] = i[c + 1] = 0 : (n = i[c] / e[c], o = i[c + 1] / e[c], r = Math.pow(n, 2) + Math.pow(o, 2), r <= 9 || (a = 3 / Math.sqrt(r), i[c] = n * a * e[c], i[c + 1] = o * a * e[c]))) }(t, n, o), function (t, e, i = "x") { const s = oi(i), n = t.length; let o, a, r, l = ni(t, 0); for (let h = 0; h < n; ++h) { if (a = r, r = l, l = ni(t, h + 1), !r) continue; const n = r[i], c = r[s]; a && (o = (n - a[i]) / 3, r[`cp1${i}`] = n - o, r[`cp1${s}`] = c - o * e[h]), l && (o = (l[i] - n) / 3, r[`cp2${i}`] = n + o, r[`cp2${s}`] = c + o * e[h]) } }(t, o, e) } function li(t, e, i) { return Math.max(Math.min(t, i), e) } function hi(t, e, i, s, n) { let o, a, r, l; if (e.spanGaps && (t = t.filter((t => !t.skip))), "monotone" === e.cubicInterpolationMode) ri(t, n); else { let i = s ? t[t.length - 1] : t[0]; for (o = 0, a = t.length; o < a; ++o)r = t[o], l = ai(i, r, t[Math.min(o + 1, a - (s ? 0 : 1)) % a], e.tension), r.cp1x = l.previous.x, r.cp1y = l.previous.y, r.cp2x = l.next.x, r.cp2y = l.next.y, i = r } e.capBezierPoints && function (t, e) { let i, s, n, o, a, r = Re(t[0], e); for (i = 0, s = t.length; i < s; ++i)a = o, o = r, r = i < s - 1 && Re(t[i + 1], e), o && (n = t[i], a && (n.cp1x = li(n.cp1x, e.left, e.right), n.cp1y = li(n.cp1y, e.top, e.bottom)), r && (n.cp2x = li(n.cp2x, e.left, e.right), n.cp2y = li(n.cp2y, e.top, e.bottom))) }(t, i) } const ci = t => 0 === t || 1 === t, di = (t, e, i) => -Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * O / i), ui = (t, e, i) => Math.pow(2, -10 * t) * Math.sin((t - e) * O / i) + 1, fi = { linear: t => t, easeInQuad: t => t * t, easeOutQuad: t => -t * (t - 2), easeInOutQuad: t => (t /= .5) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1), easeInCubic: t => t * t * t, easeOutCubic: t => (t -= 1) * t * t + 1, easeInOutCubic: t => (t /= .5) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2), easeInQuart: t => t * t * t * t, easeOutQuart: t => -((t -= 1) * t * t * t - 1), easeInOutQuart: t => (t /= .5) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2), easeInQuint: t => t * t * t * t * t, easeOutQuint: t => (t -= 1) * t * t * t * t + 1, easeInOutQuint: t => (t /= .5) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2), easeInSine: t => 1 - Math.cos(t * E), easeOutSine: t => Math.sin(t * E), easeInOutSine: t => -.5 * (Math.cos(C * t) - 1), easeInExpo: t => 0 === t ? 0 : Math.pow(2, 10 * (t - 1)), easeOutExpo: t => 1 === t ? 1 : 1 - Math.pow(2, -10 * t), easeInOutExpo: t => ci(t) ? t : t < .5 ? .5 * Math.pow(2, 10 * (2 * t - 1)) : .5 * (2 - Math.pow(2, -10 * (2 * t - 1))), easeInCirc: t => t >= 1 ? t : -(Math.sqrt(1 - t * t) - 1), easeOutCirc: t => Math.sqrt(1 - (t -= 1) * t), easeInOutCirc: t => (t /= .5) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1), easeInElastic: t => ci(t) ? t : di(t, .075, .3), easeOutElastic: t => ci(t) ? t : ui(t, .075, .3), easeInOutElastic(t) { const e = .1125; return ci(t) ? t : t < .5 ? .5 * di(2 * t, e, .45) : .5 + .5 * ui(2 * t - 1, e, .45) }, easeInBack(t) { const e = 1.70158; return t * t * ((e + 1) * t - e) }, easeOutBack(t) { const e = 1.70158; return (t -= 1) * t * ((e + 1) * t + e) + 1 }, easeInOutBack(t) { let e = 1.70158; return (t /= .5) < 1 ? t * t * ((1 + (e *= 1.525)) * t - e) * .5 : .5 * ((t -= 2) * t * ((1 + (e *= 1.525)) * t + e) + 2) }, easeInBounce: t => 1 - fi.easeOutBounce(1 - t), easeOutBounce(t) { const e = 7.5625, i = 2.75; return t < 1 / i ? e * t * t : t < 2 / i ? e * (t -= 1.5 / i) * t + .75 : t < 2.5 / i ? e * (t -= 2.25 / i) * t + .9375 : e * (t -= 2.625 / i) * t + .984375 }, easeInOutBounce: t => t < .5 ? .5 * fi.easeInBounce(2 * t) : .5 * fi.easeOutBounce(2 * t - 1) + .5 }; function gi(t, e, i, s) { return { x: t.x + i * (e.x - t.x), y: t.y + i * (e.y - t.y) } } function pi(t, e, i, s) { return { x: t.x + i * (e.x - t.x), y: "middle" === s ? i < .5 ? t.y : e.y : "after" === s ? i < 1 ? t.y : e.y : i > 0 ? e.y : t.y } } function mi(t, e, i, s) { const n = { x: t.cp2x, y: t.cp2y }, o = { x: e.cp1x, y: e.cp1y }, a = gi(t, n, i), r = gi(n, o, i), l = gi(o, e, i), h = gi(a, r, i), c = gi(r, l, i); return gi(h, c, i) } const bi = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/, xi = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/; function _i(t, e) { const i = ("" + t).match(bi); if (!i || "normal" === i[1]) return 1.2 * e; switch (t = +i[2], i[3]) { case "px": return t; case "%": t /= 100 }return e * t } const yi = t => +t || 0; function vi(t, e) { const i = {}, s = o(e), n = s ? Object.keys(e) : e, a = o(t) ? s ? i => l(t[i], t[e[i]]) : e => t[e] : () => t; for (const t of n) i[t] = yi(a(t)); return i } function Mi(t) { return vi(t, { top: "y", right: "x", bottom: "y", left: "x" }) } function wi(t) { return vi(t, ["topLeft", "topRight", "bottomLeft", "bottomRight"]) } function ki(t) { const e = Mi(t); return e.width = e.left + e.right, e.height = e.top + e.bottom, e } function Si(t, e) { t = t || {}, e = e || ue.font; let i = l(t.size, e.size); "string" == typeof i && (i = parseInt(i, 10)); let s = l(t.style, e.style); s && !("" + s).match(xi) && (console.warn('Invalid font style specified: "' + s + '"'), s = void 0); const n = { family: l(t.family, e.family), lineHeight: _i(l(t.lineHeight, e.lineHeight), i), size: i, style: s, weight: l(t.weight, e.weight), string: "" }; return n.string = De(n), n } function Pi(t, e, i, s) { let o, a, r, l = !0; for (o = 0, a = t.length; o < a; ++o)if (r = t[o], void 0 !== r && (void 0 !== e && "function" == typeof r && (r = r(e), l = !1), void 0 !== i && n(r) && (r = r[i % r.length], l = !1), void 0 !== r)) return s && !l && (s.cacheable = !1), r } function Di(t, e, i) { const { min: s, max: n } = t, o = c(e, (n - s) / 2), a = (t, e) => i && 0 === t ? 0 : t + e; return { min: a(s, -Math.abs(o)), max: a(n, o) } } function Ci(t, e) { return Object.assign(Object.create(t), e) } function Oi(t, e, i) { return t ? function (t, e) { return { x: i => t + t + e - i, setWidth(t) { e = t }, textAlign: t => "center" === t ? t : "right" === t ? "left" : "right", xPlus: (t, e) => t - e, leftForLtr: (t, e) => t - e } }(e, i) : { x: t => t, setWidth(t) { }, textAlign: t => t, xPlus: (t, e) => t + e, leftForLtr: (t, e) => t } } function Ai(t, e) { let i, s; "ltr" !== e && "rtl" !== e || (i = t.canvas.style, s = [i.getPropertyValue("direction"), i.getPropertyPriority("direction")], i.setProperty("direction", e, "important"), t.prevTextDirection = s) } function Ti(t, e) { void 0 !== e && (delete t.prevTextDirection, t.canvas.style.setProperty("direction", e[0], e[1])) } function Li(t) { return "angle" === t ? { between: Z, compare: K, normalize: G } : { between: tt, compare: (t, e) => t - e, normalize: t => t } } function Ei({ start: t, end: e, count: i, loop: s, style: n }) { return { start: t % i, end: e % i, loop: s && (e - t + 1) % i == 0, style: n } } function Ri(t, e, i) { if (!i) return [t]; const { property: s, start: n, end: o } = i, a = e.length, { compare: r, between: l, normalize: h } = Li(s), { start: c, end: d, loop: u, style: f } = function (t, e, i) { const { property: s, start: n, end: o } = i, { between: a, normalize: r } = Li(s), l = e.length; let h, c, { start: d, end: u, loop: f } = t; if (f) { for (d += l, u += l, h = 0, c = l; h < c && a(r(e[d % l][s]), n, o); ++h)d--, u--; d %= l, u %= l } return u < d && (u += l), { start: d, end: u, loop: f, style: t.style } }(t, e, i), g = []; let p, m, b, x = !1, _ = null; const y = () => x || l(n, b, p) && 0 !== r(n, b), v = () => !x || 0 === r(o, p) || l(o, b, p); for (let t = c, i = c; t <= d; ++t)m = e[t % a], m.skip || (p = h(m[s]), p !== b && (x = l(p, n, o), null === _ && y() && (_ = 0 === r(p, n) ? t : i), null !== _ && v() && (g.push(Ei({ start: _, end: t, loop: u, count: a, style: f })), _ = null), i = t, b = p)); return null !== _ && g.push(Ei({ start: _, end: d, loop: u, count: a, style: f })), g } function Ii(t, e) { const i = [], s = t.segments; for (let n = 0; n < s.length; n++) { const o = Ri(s[n], t.points, e); o.length && i.push(...o) } return i } function zi(t, e) { const i = t.points, s = t.options.spanGaps, n = i.length; if (!n) return []; const o = !!t._loop, { start: a, end: r } = function (t, e, i, s) { let n = 0, o = e - 1; if (i && !s) for (; n < e && !t[n].skip;)n++; for (; n < e && t[n].skip;)n++; for (n %= e, i && (o += n); o > n && t[o % e].skip;)o--; return o %= e, { start: n, end: o } }(i, n, o, s); if (!0 === s) return Fi(t, [{ start: a, end: r, loop: o }], i, e); return Fi(t, function (t, e, i, s) { const n = t.length, o = []; let a, r = e, l = t[e]; for (a = e + 1; a <= i; ++a) { const i = t[a % n]; i.skip || i.stop ? l.skip || (s = !1, o.push({ start: e % n, end: (a - 1) % n, loop: s }), e = r = i.stop ? a : null) : (r = a, l.skip && (e = a)), l = i } return null !== r && o.push({ start: e % n, end: r % n, loop: s }), o }(i, a, r < a ? r + n : r, !!t._fullLoop && 0 === a && r === n - 1), i, e) } function Fi(t, e, i, s) { return s && s.setContext && i ? function (t, e, i, s) { const n = t._chart.getContext(), o = Vi(t.options), { _datasetIndex: a, options: { spanGaps: r } } = t, l = i.length, h = []; let c = o, d = e[0].start, u = d; function f(t, e, s, n) { const o = r ? -1 : 1; if (t !== e) { for (t += l; i[t % l].skip;)t -= o; for (; i[e % l].skip;)e += o; t % l != e % l && (h.push({ start: t % l, end: e % l, loop: s, style: n }), c = n, d = e % l) } } for (const t of e) { d = r ? d : t.start; let e, o = i[d % l]; for (u = d + 1; u <= t.end; u++) { const r = i[u % l]; e = Vi(s.setContext(Ci(n, { type: "segment", p0: o, p1: r, p0DataIndex: (u - 1) % l, p1DataIndex: u % l, datasetIndex: a }))), Bi(e, c) && f(d, u - 1, t.loop, c), o = r, c = e } d < u - 1 && f(d, u - 1, t.loop, c) } return h }(t, e, i, s) : e } function Vi(t) { return { backgroundColor: t.backgroundColor, borderCapStyle: t.borderCapStyle, borderDash: t.borderDash, borderDashOffset: t.borderDashOffset, borderJoinStyle: t.borderJoinStyle, borderWidth: t.borderWidth, borderColor: t.borderColor } } function Bi(t, e) { if (!e) return !1; const i = [], s = function (t, e) { return Jt(e) ? (i.includes(e) || i.push(e), i.indexOf(e)) : e }; return JSON.stringify(t, s) !== JSON.stringify(e, s) } var Wi = Object.freeze({ __proto__: null, HALF_PI: E, INFINITY: T, PI: C, PITAU: A, QUARTER_PI: R, RAD_PER_DEG: L, TAU: O, TWO_THIRDS_PI: I, _addGrace: Di, _alignPixel: Ae, _alignStartEnd: ft, _angleBetween: Z, _angleDiff: K, _arrayUnique: lt, _attachContext: $e, _bezierCurveTo: Ve, _bezierInterpolation: mi, _boundSegment: Ri, _boundSegments: Ii, _capitalize: w, _computeSegments: zi, _createResolver: je, _decimalPlaces: U, _deprecated: function (t, e, i, s) { void 0 !== e && console.warn(t + ': "' + i + '" is deprecated. Please use "' + s + '" instead') }, _descriptors: Ye, _elementsEqual: f, _factorize: W, _filterBetween: nt, _getParentNode: ge, _getStartAndCountOfVisiblePoints: pt, _int16Range: Q, _isBetween: tt, _isClickEvent: D, _isDomSupported: fe, _isPointInArea: Re, _limitValue: J, _longestText: Oe, _lookup: et, _lookupByKey: it, _measureText: Ce, _merger: m, _mergerIf: _, _normalizeAngle: G, _parseObjectDataRadialScale: ii, _pointInLine: gi, _readValueToProps: vi, _rlookupByKey: st, _scaleRangesChanged: mt, _setMinAndMaxByKey: j, _splitKey: v, _steppedInterpolation: pi, _steppedLineTo: Fe, _textX: gt, _toLeftRightCenter: ut, _updateBezierControlPoints: hi, addRoundedRectPath: He, almostEquals: V, almostWhole: H, callback: d, clearCanvas: Te, clipArea: Ie, clone: g, color: Qt, createContext: Ci, debounce: dt, defined: k, distanceBetweenPoints: q, drawPoint: Le, drawPointLegend: Ee, each: u, easingEffects: fi, finiteOrDefault: r, fontString: function (t, e, i) { return e + " " + t + "px " + i }, formatNumber: ne, getAngleFromPoint: X, getHoverColor: te, getMaximumSize: we, getRelativePosition: ve, getRtlAdapter: Oi, getStyle: be, isArray: n, isFinite: a, isFunction: S, isNullOrUndef: s, isNumber: N, isObject: o, isPatternOrGradient: Jt, listenArrayEvents: at, log10: z, merge: b, mergeIf: x, niceNum: B, noop: e, overrideTextDirection: Ai, readUsedSize: Pe, renderText: Ne, requestAnimFrame: ht, resolve: Pi, resolveObjectKey: M, restoreTextDirection: Ti, retinaScale: ke, setsEqual: P, sign: F, splineCurve: ai, splineCurveMonotone: ri, supportsEventListenerOptions: Se, throttled: ct, toDegrees: Y, toDimension: c, toFont: Si, toFontString: De, toLineHeight: _i, toPadding: ki, toPercentage: h, toRadians: $, toTRBL: Mi, toTRBLCorners: wi, uid: i, unclipArea: ze, unlistenArrayEvents: rt, valueOrDefault: l }); function Ni(t, e, i, s) { const { controller: n, data: o, _sorted: a } = t, r = n._cachedMeta.iScale; if (r && e === r.axis && "r" !== e && a && o.length) { const t = r._reversePixels ? st : it; if (!s) return t(o, e, i); if (n._sharedOptions) { const s = o[0], n = "function" == typeof s.getRange && s.getRange(e); if (n) { const s = t(o, e, i - n), a = t(o, e, i + n); return { lo: s.lo, hi: a.hi } } } } return { lo: 0, hi: o.length - 1 } } function Hi(t, e, i, s, n) { const o = t.getSortedVisibleDatasetMetas(), a = i[e]; for (let t = 0, i = o.length; t < i; ++t) { const { index: i, data: r } = o[t], { lo: l, hi: h } = Ni(o[t], e, a, n); for (let t = l; t <= h; ++t) { const e = r[t]; e.skip || s(e, i, t) } } } function ji(t, e, i, s, n) { const o = []; if (!n && !t.isPointInArea(e)) return o; return Hi(t, i, e, (function (i, a, r) { (n || Re(i, t.chartArea, 0)) && i.inRange(e.x, e.y, s) && o.push({ element: i, datasetIndex: a, index: r }) }), !0), o } function $i(t, e, i, s, n, o) { let a = []; const r = function (t) { const e = -1 !== t.indexOf("x"), i = -1 !== t.indexOf("y"); return function (t, s) { const n = e ? Math.abs(t.x - s.x) : 0, o = i ? Math.abs(t.y - s.y) : 0; return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2)) } }(i); let l = Number.POSITIVE_INFINITY; return Hi(t, i, e, (function (i, h, c) { const d = i.inRange(e.x, e.y, n); if (s && !d) return; const u = i.getCenterPoint(n); if (!(!!o || t.isPointInArea(u)) && !d) return; const f = r(e, u); f < l ? (a = [{ element: i, datasetIndex: h, index: c }], l = f) : f === l && a.push({ element: i, datasetIndex: h, index: c }) })), a } function Yi(t, e, i, s, n, o) { return o || t.isPointInArea(e) ? "r" !== i || s ? $i(t, e, i, s, n, o) : function (t, e, i, s) { let n = []; return Hi(t, i, e, (function (t, i, o) { const { startAngle: a, endAngle: r } = t.getProps(["startAngle", "endAngle"], s), { angle: l } = X(t, { x: e.x, y: e.y }); Z(l, a, r) && n.push({ element: t, datasetIndex: i, index: o }) })), n }(t, e, i, n) : [] } function Ui(t, e, i, s, n) { const o = [], a = "x" === i ? "inXRange" : "inYRange"; let r = !1; return Hi(t, i, e, ((t, s, l) => { t[a](e[i], n) && (o.push({ element: t, datasetIndex: s, index: l }), r = r || t.inRange(e.x, e.y, n)) })), s && !r ? [] : o } var Xi = { evaluateInteractionItems: Hi, modes: { index(t, e, i, s) { const n = ve(e, t), o = i.axis || "x", a = i.includeInvisible || !1, r = i.intersect ? ji(t, n, o, s, a) : Yi(t, n, o, !1, s, a), l = []; return r.length ? (t.getSortedVisibleDatasetMetas().forEach((t => { const e = r[0].index, i = t.data[e]; i && !i.skip && l.push({ element: i, datasetIndex: t.index, index: e }) })), l) : [] }, dataset(t, e, i, s) { const n = ve(e, t), o = i.axis || "xy", a = i.includeInvisible || !1; let r = i.intersect ? ji(t, n, o, s, a) : Yi(t, n, o, !1, s, a); if (r.length > 0) { const e = r[0].datasetIndex, i = t.getDatasetMeta(e).data; r = []; for (let t = 0; t < i.length; ++t)r.push({ element: i[t], datasetIndex: e, index: t }) } return r }, point: (t, e, i, s) => ji(t, ve(e, t), i.axis || "xy", s, i.includeInvisible || !1), nearest(t, e, i, s) { const n = ve(e, t), o = i.axis || "xy", a = i.includeInvisible || !1; return Yi(t, n, o, i.intersect, s, a) }, x: (t, e, i, s) => Ui(t, ve(e, t), "x", i.intersect, s), y: (t, e, i, s) => Ui(t, ve(e, t), "y", i.intersect, s) } }; const qi = ["left", "top", "right", "bottom"]; function Ki(t, e) { return t.filter((t => t.pos === e)) } function Gi(t, e) { return t.filter((t => -1 === qi.indexOf(t.pos) && t.box.axis === e)) } function Zi(t, e) { return t.sort(((t, i) => { const s = e ? i : t, n = e ? t : i; return s.weight === n.weight ? s.index - n.index : s.weight - n.weight })) } function Ji(t, e) { const i = function (t) { const e = {}; for (const i of t) { const { stack: t, pos: s, stackWeight: n } = i; if (!t || !qi.includes(s)) continue; const o = e[t] || (e[t] = { count: 0, placed: 0, weight: 0, size: 0 }); o.count++, o.weight += n } return e }(t), { vBoxMaxWidth: s, hBoxMaxHeight: n } = e; let o, a, r; for (o = 0, a = t.length; o < a; ++o) { r = t[o]; const { fullSize: a } = r.box, l = i[r.stack], h = l && r.stackWeight / l.weight; r.horizontal ? (r.width = h ? h * s : a && e.availableWidth, r.height = n) : (r.width = s, r.height = h ? h * n : a && e.availableHeight) } return i } function Qi(t, e, i, s) { return Math.max(t[i], e[i]) + Math.max(t[s], e[s]) } function ts(t, e) { t.top = Math.max(t.top, e.top), t.left = Math.max(t.left, e.left), t.bottom = Math.max(t.bottom, e.bottom), t.right = Math.max(t.right, e.right) } function es(t, e, i, s) { const { pos: n, box: a } = i, r = t.maxPadding; if (!o(n)) { i.size && (t[n] -= i.size); const e = s[i.stack] || { size: 0, count: 1 }; e.size = Math.max(e.size, i.horizontal ? a.height : a.width), i.size = e.size / e.count, t[n] += i.size } a.getPadding && ts(r, a.getPadding()); const l = Math.max(0, e.outerWidth - Qi(r, t, "left", "right")), h = Math.max(0, e.outerHeight - Qi(r, t, "top", "bottom")), c = l !== t.w, d = h !== t.h; return t.w = l, t.h = h, i.horizontal ? { same: c, other: d } : { same: d, other: c } } function is(t, e) { const i = e.maxPadding; function s(t) { const s = { left: 0, top: 0, right: 0, bottom: 0 }; return t.forEach((t => { s[t] = Math.max(e[t], i[t]) })), s } return s(t ? ["left", "right"] : ["top", "bottom"]) } function ss(t, e, i, s) { const n = []; let o, a, r, l, h, c; for (o = 0, a = t.length, h = 0; o < a; ++o) { r = t[o], l = r.box, l.update(r.width || e.w, r.height || e.h, is(r.horizontal, e)); const { same: a, other: d } = es(e, i, r, s); h |= a && n.length, c = c || d, l.fullSize || n.push(r) } return h && ss(n, e, i, s) || c } function ns(t, e, i, s, n) { t.top = i, t.left = e, t.right = e + s, t.bottom = i + n, t.width = s, t.height = n } function os(t, e, i, s) { const n = i.padding; let { x: o, y: a } = e; for (const r of t) { const t = r.box, l = s[r.stack] || { count: 1, placed: 0, weight: 1 }, h = r.stackWeight / l.weight || 1; if (r.horizontal) { const s = e.w * h, o = l.size || t.height; k(l.start) && (a = l.start), t.fullSize ? ns(t, n.left, a, i.outerWidth - n.right - n.left, o) : ns(t, e.left + l.placed, a, s, o), l.start = a, l.placed += s, a = t.bottom } else { const s = e.h * h, a = l.size || t.width; k(l.start) && (o = l.start), t.fullSize ? ns(t, o, n.top, a, i.outerHeight - n.bottom - n.top) : ns(t, o, e.top + l.placed, a, s), l.start = o, l.placed += s, o = t.right } } e.x = o, e.y = a } var as = { addBox(t, e) { t.boxes || (t.boxes = []), e.fullSize = e.fullSize || !1, e.position = e.position || "top", e.weight = e.weight || 0, e._layers = e._layers || function () { return [{ z: 0, draw(t) { e.draw(t) } }] }, t.boxes.push(e) }, removeBox(t, e) { const i = t.boxes ? t.boxes.indexOf(e) : -1; -1 !== i && t.boxes.splice(i, 1) }, configure(t, e, i) { e.fullSize = i.fullSize, e.position = i.position, e.weight = i.weight }, update(t, e, i, s) { if (!t) return; const n = ki(t.options.layout.padding), o = Math.max(e - n.width, 0), a = Math.max(i - n.height, 0), r = function (t) { const e = function (t) { const e = []; let i, s, n, o, a, r; for (i = 0, s = (t || []).length; i < s; ++i)n = t[i], ({ position: o, options: { stack: a, stackWeight: r = 1 } } = n), e.push({ index: i, box: n, pos: o, horizontal: n.isHorizontal(), weight: n.weight, stack: a && o + a, stackWeight: r }); return e }(t), i = Zi(e.filter((t => t.box.fullSize)), !0), s = Zi(Ki(e, "left"), !0), n = Zi(Ki(e, "right")), o = Zi(Ki(e, "top"), !0), a = Zi(Ki(e, "bottom")), r = Gi(e, "x"), l = Gi(e, "y"); return { fullSize: i, leftAndTop: s.concat(o), rightAndBottom: n.concat(l).concat(a).concat(r), chartArea: Ki(e, "chartArea"), vertical: s.concat(n).concat(l), horizontal: o.concat(a).concat(r) } }(t.boxes), l = r.vertical, h = r.horizontal; u(t.boxes, (t => { "function" == typeof t.beforeLayout && t.beforeLayout() })); const c = l.reduce(((t, e) => e.box.options && !1 === e.box.options.display ? t : t + 1), 0) || 1, d = Object.freeze({ outerWidth: e, outerHeight: i, padding: n, availableWidth: o, availableHeight: a, vBoxMaxWidth: o / 2 / c, hBoxMaxHeight: a / 2 }), f = Object.assign({}, n); ts(f, ki(s)); const g = Object.assign({ maxPadding: f, w: o, h: a, x: n.left, y: n.top }, n), p = Ji(l.concat(h), d); ss(r.fullSize, g, d, p), ss(l, g, d, p), ss(h, g, d, p) && ss(l, g, d, p), function (t) { const e = t.maxPadding; function i(i) { const s = Math.max(e[i] - t[i], 0); return t[i] += s, s } t.y += i("top"), t.x += i("left"), i("right"), i("bottom") }(g), os(r.leftAndTop, g, d, p), g.x += g.w, g.y += g.h, os(r.rightAndBottom, g, d, p), t.chartArea = { left: g.left, top: g.top, right: g.left + g.w, bottom: g.top + g.h, height: g.h, width: g.w }, u(r.chartArea, (e => { const i = e.box; Object.assign(i, t.chartArea), i.update(g.w, g.h, { left: 0, top: 0, right: 0, bottom: 0 }) })) } }; class rs { acquireContext(t, e) { } releaseContext(t) { return !1 } addEventListener(t, e, i) { } removeEventListener(t, e, i) { } getDevicePixelRatio() { return 1 } getMaximumSize(t, e, i, s) { return e = Math.max(0, e || t.width), i = i || t.height, { width: e, height: Math.max(0, s ? Math.floor(e / s) : i) } } isAttached(t) { return !0 } updateConfig(t) { } } class ls extends rs { acquireContext(t) { return t && t.getContext && t.getContext("2d") || null } updateConfig(t) { t.options.animation = !1 } } const hs = "$chartjs", cs = { touchstart: "mousedown", touchmove: "mousemove", touchend: "mouseup", pointerenter: "mouseenter", pointerdown: "mousedown", pointermove: "mousemove", pointerup: "mouseup", pointerleave: "mouseout", pointerout: "mouseout" }, ds = t => null === t || "" === t; const us = !!Se && { passive: !0 }; function fs(t, e, i) { t.canvas.removeEventListener(e, i, us) } function gs(t, e) { for (const i of t) if (i === e || i.contains(e)) return !0 } function ps(t, e, i) { const s = t.canvas, n = new MutationObserver((t => { let e = !1; for (const i of t) e = e || gs(i.addedNodes, s), e = e && !gs(i.removedNodes, s); e && i() })); return n.observe(document, { childList: !0, subtree: !0 }), n } function ms(t, e, i) { const s = t.canvas, n = new MutationObserver((t => { let e = !1; for (const i of t) e = e || gs(i.removedNodes, s), e = e && !gs(i.addedNodes, s); e && i() })); return n.observe(document, { childList: !0, subtree: !0 }), n } const bs = new Map; let xs = 0; function _s() { const t = window.devicePixelRatio; t !== xs && (xs = t, bs.forEach(((e, i) => { i.currentDevicePixelRatio !== t && e() }))) } function ys(t, e, i) { const s = t.canvas, n = s && ge(s); if (!n) return; const o = ct(((t, e) => { const s = n.clientWidth; i(t, e), s < n.clientWidth && i() }), window), a = new ResizeObserver((t => { const e = t[0], i = e.contentRect.width, s = e.contentRect.height; 0 === i && 0 === s || o(i, s) })); return a.observe(n), function (t, e) { bs.size || window.addEventListener("resize", _s), bs.set(t, e) }(t, o), a } function vs(t, e, i) { i && i.disconnect(), "resize" === e && function (t) { bs.delete(t), bs.size || window.removeEventListener("resize", _s) }(t) } function Ms(t, e, i) { const s = t.canvas, n = ct((e => { null !== t.ctx && i(function (t, e) { const i = cs[t.type] || t.type, { x: s, y: n } = ve(t, e); return { type: i, chart: e, native: t, x: void 0 !== s ? s : null, y: void 0 !== n ? n : null } }(e, t)) }), t); return function (t, e, i) { t.addEventListener(e, i, us) }(s, e, n), n } class ws extends rs { acquireContext(t, e) { const i = t && t.getContext && t.getContext("2d"); return i && i.canvas === t ? (function (t, e) { const i = t.style, s = t.getAttribute("height"), n = t.getAttribute("width"); if (t[hs] = { initial: { height: s, width: n, style: { display: i.display, height: i.height, width: i.width } } }, i.display = i.display || "block", i.boxSizing = i.boxSizing || "border-box", ds(n)) { const e = Pe(t, "width"); void 0 !== e && (t.width = e) } if (ds(s)) if ("" === t.style.height) t.height = t.width / (e || 2); else { const e = Pe(t, "height"); void 0 !== e && (t.height = e) } }(t, e), i) : null } releaseContext(t) { const e = t.canvas; if (!e[hs]) return !1; const i = e[hs].initial;["height", "width"].forEach((t => { const n = i[t]; s(n) ? e.removeAttribute(t) : e.setAttribute(t, n) })); const n = i.style || {}; return Object.keys(n).forEach((t => { e.style[t] = n[t] })), e.width = e.width, delete e[hs], !0 } addEventListener(t, e, i) { this.removeEventListener(t, e); const s = t.$proxies || (t.$proxies = {}), n = { attach: ps, detach: ms, resize: ys }[e] || Ms; s[e] = n(t, e, i) } removeEventListener(t, e) { const i = t.$proxies || (t.$proxies = {}), s = i[e]; if (!s) return; ({ attach: vs, detach: vs, resize: vs }[e] || fs)(t, e, s), i[e] = void 0 } getDevicePixelRatio() { return window.devicePixelRatio } getMaximumSize(t, e, i, s) { return we(t, e, i, s) } isAttached(t) { const e = ge(t); return !(!e || !e.isConnected) } } function ks(t) { return !fe() || "undefined" != typeof OffscreenCanvas && t instanceof OffscreenCanvas ? ls : ws } var Ss = Object.freeze({ __proto__: null, BasePlatform: rs, BasicPlatform: ls, DomPlatform: ws, _detectPlatform: ks }); const Ps = "transparent", Ds = { boolean: (t, e, i) => i > .5 ? e : t, color(t, e, i) { const s = Qt(t || Ps), n = s.valid && Qt(e || Ps); return n && n.valid ? n.mix(s, i).hexString() : e }, number: (t, e, i) => t + (e - t) * i }; class Cs { constructor(t, e, i, s) { const n = e[i]; s = Pi([t.to, s, n, t.from]); const o = Pi([t.from, n, s]); this._active = !0, this._fn = t.fn || Ds[t.type || typeof o], this._easing = fi[t.easing] || fi.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 = i, this._from = o, this._to = s, this._promises = void 0 } active() { return this._active } update(t, e, i) { if (this._active) { this._notify(!1); const s = this._target[this._prop], n = i - this._start, o = this._duration - n; this._start = i, this._duration = Math.floor(Math.max(o, t.duration)), this._total += n, this._loop = !!t.loop, this._to = Pi([t.to, e, s, t.from]), this._from = Pi([t.from, s, e]) } } cancel() { this._active && (this.tick(Date.now()), this._active = !1, this._notify(!1)) } tick(t) { const e = t - this._start, i = this._duration, s = this._prop, n = this._from, o = this._loop, a = this._to; let r; if (this._active = n !== a && (o || e < i), !this._active) return this._target[s] = a, void this._notify(!0); e < 0 ? this._target[s] = n : (r = e / i % 2, r = o && r > 1 ? 2 - r : r, r = this._easing(Math.min(1, Math.max(0, r))), this._target[s] = this._fn(n, a, r)) } wait() { const t = this._promises || (this._promises = []); return new Promise(((e, i) => { t.push({ res: e, rej: i }) })) } _notify(t) { const e = t ? "res" : "rej", i = this._promises || []; for (let t = 0; t < i.length; t++)i[t][e]() } } class Os { constructor(t, e) { this._chart = t, this._properties = new Map, this.configure(e) } configure(t) { if (!o(t)) return; const e = Object.keys(ue.animation), i = this._properties; Object.getOwnPropertyNames(t).forEach((s => { const a = t[s]; if (!o(a)) return; const r = {}; for (const t of e) r[t] = a[t]; (n(a.properties) && a.properties || [s]).forEach((t => { t !== s && i.has(t) || i.set(t, r) })) })) } _animateOptions(t, e) { const i = e.options, s = function (t, e) { if (!e) return; let i = t.options; if (!i) return void (t.options = e); i.$shared && (t.options = i = Object.assign({}, i, { $shared: !1, $animations: {} })); return i }(t, i); if (!s) return []; const n = this._createAnimations(s, i); return i.$shared && function (t, e) { const i = [], s = Object.keys(e); for (let e = 0; e < s.length; e++) { const n = t[s[e]]; n && n.active() && i.push(n.wait()) } return Promise.all(i) }(t.options.$animations, i).then((() => { t.options = i }), (() => { })), n } _createAnimations(t, e) { const i = this._properties, s = [], n = t.$animations || (t.$animations = {}), o = Object.keys(e), a = Date.now(); let r; for (r = o.length - 1; r >= 0; --r) { const l = o[r]; if ("$" === l.charAt(0)) continue; if ("options" === l) { s.push(...this._animateOptions(t, e)); continue } const h = e[l]; let c = n[l]; const d = i.get(l); if (c) { if (d && c.active()) { c.update(d, h, a); continue } c.cancel() } d && d.duration ? (n[l] = c = new Cs(d, t, l, h), s.push(c)) : t[l] = h } return s } update(t, e) { if (0 === this._properties.size) return void Object.assign(t, e); const i = this._createAnimations(t, e); return i.length ? (xt.add(this._chart, i), !0) : void 0 } } function As(t, e) { const i = t && t.options || {}, s = i.reverse, n = void 0 === i.min ? e : 0, o = void 0 === i.max ? e : 0; return { start: s ? o : n, end: s ? n : o } } function Ts(t, e) { const i = [], s = t._getSortedDatasetMetas(e); let n, o; for (n = 0, o = s.length; n < o; ++n)i.push(s[n].index); return i } function Ls(t, e, i, s = {}) { const n = t.keys, o = "single" === s.mode; let r, l, h, c; if (null !== e) { for (r = 0, l = n.length; r < l; ++r) { if (h = +n[r], h === i) { if (s.all) continue; break } c = t.values[h], a(c) && (o || 0 === e || F(e) === F(c)) && (e += c) } return e } } function Es(t, e) { const i = t && t.options.stacked; return i || void 0 === i && void 0 !== e.stack } function Rs(t, e, i) { const s = t[e] || (t[e] = {}); return s[i] || (s[i] = {}) } function Is(t, e, i, s) { for (const n of e.getMatchingVisibleMetas(s).reverse()) { const e = t[n.index]; if (i && e > 0 || !i && e < 0) return n.index } return null } function zs(t, e) { const { chart: i, _cachedMeta: s } = t, n = i._stacks || (i._stacks = {}), { iScale: o, vScale: a, index: r } = s, l = o.axis, h = a.axis, c = function (t, e, i) { return `${t.id}.${e.id}.${i.stack || i.type}` }(o, a, s), d = e.length; let u; for (let t = 0; t < d; ++t) { const i = e[t], { [l]: o, [h]: d } = i; u = (i._stacks || (i._stacks = {}))[h] = Rs(n, c, o), u[r] = d, u._top = Is(u, a, !0, s.type), u._bottom = Is(u, a, !1, s.type); (u._visualValues || (u._visualValues = {}))[r] = d } } function Fs(t, e) { const i = t.scales; return Object.keys(i).filter((t => i[t].axis === e)).shift() } function Vs(t, e) { const i = t.controller.index, s = t.vScale && t.vScale.axis; if (s) { e = e || t._parsed; for (const t of e) { const e = t._stacks; if (!e || void 0 === e[s] || void 0 === e[s][i]) return; delete e[s][i], void 0 !== e[s]._visualValues && void 0 !== e[s]._visualValues[i] && delete e[s]._visualValues[i] } } } const Bs = t => "reset" === t || "none" === t, Ws = (t, e) => e ? t : Object.assign({}, t); class Ns { static defaults = {}; static datasetElementType = null; static dataElementType = null; 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 = Es(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 && Vs(this._cachedMeta), this.index = t } linkScales() { const t = this.chart, e = this._cachedMeta, i = this.getDataset(), s = (t, e, i, s) => "x" === t ? e : "r" === t ? s : i, n = e.xAxisID = l(i.xAxisID, Fs(t, "x")), o = e.yAxisID = l(i.yAxisID, Fs(t, "y")), a = e.rAxisID = l(i.rAxisID, Fs(t, "r")), r = e.indexAxis, h = e.iAxisID = s(r, n, o, a), c = e.vAxisID = s(r, o, n, a); e.xScale = this.getScaleForId(n), e.yScale = this.getScaleForId(o), e.rScale = this.getScaleForId(a), e.iScale = this.getScaleForId(h), e.vScale = this.getScaleForId(c) } 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 && rt(this._data, this), t._stacked && Vs(t) } _dataCheck() { const t = this.getDataset(), e = t.data || (t.data = []), i = this._data; if (o(e)) this._data = function (t) { const e = Object.keys(t), i = new Array(e.length); let s, n, o; for (s = 0, n = e.length; s < n; ++s)o = e[s], i[s] = { x: o, y: t[o] }; return i }(e); else if (i !== e) { if (i) { rt(i, this); const t = this._cachedMeta; Vs(t), t._parsed = [] } e && Object.isExtensible(e) && at(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, i = this.getDataset(); let s = !1; this._dataCheck(); const n = e._stacked; e._stacked = Es(e.vScale, e), e.stack !== i.stack && (s = !0, Vs(e), e.stack = i.stack), this._resyncElements(t), (s || n !== e._stacked) && zs(this, e._parsed) } configure() { const t = this.chart.config, e = t.datasetScopeKeys(this._type), i = t.getOptionScopes(this.getDataset(), e, !0); this.options = t.createResolver(i, this.getContext()), this._parsing = this.options.parsing, this._cachedDataOpts = {} } parse(t, e) { const { _cachedMeta: i, _data: s } = this, { iScale: a, _stacked: r } = i, l = a.axis; let h, c, d, u = 0 === t && e === s.length || i._sorted, f = t > 0 && i._parsed[t - 1]; if (!1 === this._parsing) i._parsed = s, i._sorted = !0, d = s; else { d = n(s[t]) ? this.parseArrayData(i, s, t, e) : o(s[t]) ? this.parseObjectData(i, s, t, e) : this.parsePrimitiveData(i, s, t, e); const a = () => null === c[l] || f && c[l] < f[l]; for (h = 0; h < e; ++h)i._parsed[h + t] = c = d[h], u && (a() && (u = !1), f = c); i._sorted = u } r && zs(this, d) } parsePrimitiveData(t, e, i, s) { const { iScale: n, vScale: o } = t, a = n.axis, r = o.axis, l = n.getLabels(), h = n === o, c = new Array(s); let d, u, f; for (d = 0, u = s; d < u; ++d)f = d + i, c[d] = { [a]: h || n.parse(l[f], f), [r]: o.parse(e[f], f) }; return c } parseArrayData(t, e, i, s) { const { xScale: n, yScale: o } = t, a = new Array(s); let r, l, h, c; for (r = 0, l = s; r < l; ++r)h = r + i, c = e[h], a[r] = { x: n.parse(c[0], h), y: o.parse(c[1], h) }; return a } parseObjectData(t, e, i, s) { const { xScale: n, yScale: o } = t, { xAxisKey: a = "x", yAxisKey: r = "y" } = this._parsing, l = new Array(s); let h, c, d, u; for (h = 0, c = s; h < c; ++h)d = h + i, u = e[d], l[h] = { x: n.parse(M(u, a), d), y: o.parse(M(u, r), d) }; return l } getParsed(t) { return this._cachedMeta._parsed[t] } getDataElement(t) { return this._cachedMeta.data[t] } applyStack(t, e, i) { const s = this.chart, n = this._cachedMeta, o = e[t.axis]; return Ls({ keys: Ts(s, !0), values: e._stacks[t.axis]._visualValues }, o, n.index, { mode: i }) } updateRangeFromParsed(t, e, i, s) { const n = i[e.axis]; let o = null === n ? NaN : n; const a = s && i._stacks[e.axis]; s && a && (s.values = a, o = Ls(s, n, this._cachedMeta.index)), t.min = Math.min(t.min, o), t.max = Math.max(t.max, o) } getMinMax(t, e) { const i = this._cachedMeta, s = i._parsed, n = i._sorted && t === i.iScale, o = s.length, r = this._getOtherScale(t), l = ((t, e, i) => t && !e.hidden && e._stacked && { keys: Ts(i, !0), values: null })(e, i, this.chart), h = { min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY }, { min: c, max: d } = function (t) { const { min: e, max: i, minDefined: s, maxDefined: n } = t.getUserBounds(); return { min: s ? e : Number.NEGATIVE_INFINITY, max: n ? i : Number.POSITIVE_INFINITY } }(r); let u, f; function g() { f = s[u]; const e = f[r.axis]; return !a(f[t.axis]) || c > e || d < e } for (u = 0; u < o && (g() || (this.updateRangeFromParsed(h, t, f, l), !n)); ++u); if (n) for (u = o - 1; u >= 0; --u)if (!g()) { this.updateRangeFromParsed(h, t, f, l); break } return h } getAllParsedValues(t) { const e = this._cachedMeta._parsed, i = []; let s, n, o; for (s = 0, n = e.length; s < n; ++s)o = e[s][t.axis], a(o) && i.push(o); return i } getMaxOverflow() { return !1 } getLabelAndValue(t) { const e = this._cachedMeta, i = e.iScale, s = e.vScale, n = this.getParsed(t); return { label: i ? "" + i.getLabelForValue(n[i.axis]) : "", value: s ? "" + s.getLabelForValue(n[s.axis]) : "" } } _update(t) { const e = this._cachedMeta; this.update(t || "default"), e._clip = function (t) { let e, i, s, n; return o(t) ? (e = t.top, i = t.right, s = t.bottom, n = t.left) : e = i = s = n = t, { top: e, right: i, bottom: s, left: n, disabled: !1 === t } }(l(this.options.clip, function (t, e, i) { if (!1 === i) return !1; const s = As(t, i), n = As(e, i); return { top: n.end, right: s.end, bottom: n.start, left: s.start } }(e.xScale, e.yScale, this.getMaxOverflow()))) } update(t) { } draw() { const t = this._ctx, e = this.chart, i = this._cachedMeta, s = i.data || [], n = e.chartArea, o = [], a = this._drawStart || 0, r = this._drawCount || s.length - a, l = this.options.drawActiveElementsOnTop; let h; for (i.dataset && i.dataset.draw(t, n, a, r), h = a; h < a + r; ++h) { const e = s[h]; e.hidden || (e.active && l ? o.push(e) : e.draw(t, n)) } for (h = 0; h < o.length; ++h)o[h].draw(t, n) } getStyle(t, e) { const i = e ? "active" : "default"; return void 0 === t && this._cachedMeta.dataset ? this.resolveDatasetElementOptions(i) : this.resolveDataElementOptions(t || 0, i) } getContext(t, e, i) { const s = this.getDataset(); let n; if (t >= 0 && t < this._cachedMeta.data.length) { const e = this._cachedMeta.data[t]; n = e.$context || (e.$context = function (t, e, i) { return Ci(t, { active: !1, dataIndex: e, parsed: void 0, raw: void 0, element: i, index: e, mode: "default", type: "data" }) }(this.getContext(), t, e)), n.parsed = this.getParsed(t), n.raw = s.data[t], n.index = n.dataIndex = t } else n = this.$context || (this.$context = function (t, e) { return Ci(t, { active: !1, dataset: void 0, datasetIndex: e, index: e, mode: "default", type: "dataset" }) }(this.chart.getContext(), this.index)), n.dataset = s, n.index = n.datasetIndex = this.index; return n.active = !!e, n.mode = i, n } resolveDatasetElementOptions(t) { return this._resolveElementOptions(this.datasetElementType.id, t) } resolveDataElementOptions(t, e) { return this._resolveElementOptions(this.dataElementType.id, e, t) } _resolveElementOptions(t, e = "default", i) { const s = "active" === e, n = this._cachedDataOpts, o = t + "-" + e, a = n[o], r = this.enableOptionSharing && k(i); if (a) return Ws(a, r); const l = this.chart.config, h = l.datasetElementScopeKeys(this._type, t), c = s ? [`${t}Hover`, "hover", t, ""] : [t, ""], d = l.getOptionScopes(this.getDataset(), h), u = Object.keys(ue.elements[t]), f = l.resolveNamedOptions(d, u, (() => this.getContext(i, s, e)), c); return f.$shared && (f.$shared = r, n[o] = Object.freeze(Ws(f, r))), f } _resolveAnimations(t, e, i) { const s = this.chart, n = this._cachedDataOpts, o = `animation-${e}`, a = n[o]; if (a) return a; let r; if (!1 !== s.options.animation) { const s = this.chart.config, n = s.datasetAnimationScopeKeys(this._type, e), o = s.getOptionScopes(this.getDataset(), n); r = s.createResolver(o, this.getContext(t, i, e)) } const l = new Os(s, r && r.animations); return r && r._cacheable && (n[o] = Object.freeze(l)), l } getSharedOptions(t) { if (t.$shared) return this._sharedOptions || (this._sharedOptions = Object.assign({}, t)) } includeOptions(t, e) { return !e || Bs(t) || this.chart._animationsDisabled } _getSharedOptions(t, e) { const i = this.resolveDataElementOptions(t, e), s = this._sharedOptions, n = this.getSharedOptions(i), o = this.includeOptions(e, n) || n !== s; return this.updateSharedOptions(n, e, i), { sharedOptions: n, includeOptions: o } } updateElement(t, e, i, s) { Bs(s) ? Object.assign(t, i) : this._resolveAnimations(e, s).update(t, i) } updateSharedOptions(t, e, i) { t && !Bs(e) && this._resolveAnimations(void 0, e).update(t, i) } _setStyle(t, e, i, s) { t.active = s; const n = this.getStyle(e, s); this._resolveAnimations(e, i, s).update(t, { options: !s && this.getSharedOptions(n) || n }) } removeHoverStyle(t, e, i) { this._setStyle(t, i, "active", !1) } setHoverStyle(t, e, i) { this._setStyle(t, i, "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, i = this._cachedMeta.data; for (const [t, e, i] of this._syncList) this[t](e, i); this._syncList = []; const s = i.length, n = e.length, o = Math.min(n, s); o && this.parse(0, o), n > s ? this._insertElements(s, n - s, t) : n < s && this._removeElements(n, s - n) } _insertElements(t, e, i = !0) { const s = this._cachedMeta, n = s.data, o = t + e; let a; const r = t => { for (t.length += e, a = t.length - 1; a >= o; a--)t[a] = t[a - e] }; for (r(n), a = t; a < o; ++a)n[a] = new this.dataElementType; this._parsing && r(s._parsed), this.parse(t, e), i && this.updateElements(n, t, e, "reset") } updateElements(t, e, i, s) { } _removeElements(t, e) { const i = this._cachedMeta; if (this._parsing) { const s = i._parsed.splice(t, e); i._stacked && Vs(i, s) } i.data.splice(t, e) } _sync(t) { if (this._parsing) this._syncList.push(t); else { const [e, i, s] = t; this[e](i, s) } this.chart._dataChanges.push([this.index, ...t]) } _onDataPush() { const t = arguments.length; this._sync(["_insertElements", this.getDataset().data.length - t, t]) } _onDataPop() { this._sync(["_removeElements", this._cachedMeta.data.length - 1, 1]) } _onDataShift() { this._sync(["_removeElements", 0, 1]) } _onDataSplice(t, e) { e && this._sync(["_removeElements", t, e]); const i = arguments.length - 2; i && this._sync(["_insertElements", t, i]) } _onDataUnshift() { this._sync(["_insertElements", 0, arguments.length]) } } class Hs { static defaults = {}; static defaultRoutes = void 0; x; y; active = !1; options; $animations; tooltipPosition(t) { const { x: e, y: i } = this.getProps(["x", "y"], t); return { x: e, y: i } } hasValue() { return N(this.x) && N(this.y) } getProps(t, e) { const i = this.$animations; if (!e || !i) return this; const s = {}; return t.forEach((t => { s[t] = i[t] && i[t].active() ? i[t]._to : this[t] })), s } } function js(t, e) { const i = t.options.ticks, n = function (t) { const e = t.options.offset, i = t._tickSize(), s = t._length / i + (e ? 0 : 1), n = t._maxLength / i; return Math.floor(Math.min(s, n)) }(t), o = Math.min(i.maxTicksLimit || n, n), a = i.major.enabled ? function (t) { const e = []; let i, s; for (i = 0, s = t.length; i < s; i++)t[i].major && e.push(i); return e }(e) : [], r = a.length, l = a[0], h = a[r - 1], c = []; if (r > o) return function (t, e, i, s) { let n, o = 0, a = i[0]; for (s = Math.ceil(s), n = 0; n < t.length; n++)n === a && (e.push(t[n]), o++, a = i[o * s]) }(e, c, a, r / o), c; const d = function (t, e, i) { const s = function (t) { const e = t.length; let i, s; if (e < 2) return !1; for (s = t[0], i = 1; i < e; ++i)if (t[i] - t[i - 1] !== s) return !1; return s }(t), n = e.length / i; if (!s) return Math.max(n, 1); const o = W(s); for (let t = 0, e = o.length - 1; t < e; t++) { const e = o[t]; if (e > n) return e } return Math.max(n, 1) }(a, e, o); if (r > 0) { let t, i; const n = r > 1 ? Math.round((h - l) / (r - 1)) : null; for ($s(e, c, d, s(n) ? 0 : l - n, l), t = 0, i = r - 1; t < i; t++)$s(e, c, d, a[t], a[t + 1]); return $s(e, c, d, h, s(n) ? e.length : h + n), c } return $s(e, c, d), c } function $s(t, e, i, s, n) { const o = l(s, 0), a = Math.min(l(n, t.length), t.length); let r, h, c, d = 0; for (i = Math.ceil(i), n && (r = n - s, i = r / Math.floor(r / i)), c = o; c < 0;)d++, c = Math.round(o + d * i); for (h = Math.max(o, 0); h < a; h++)h === c && (e.push(t[h]), d++, c = Math.round(o + d * i)) } const Ys = (t, e, i) => "top" === e || "left" === e ? t[e] + i : t[e] - i, Us = (t, e) => Math.min(e || t, t); function Xs(t, e) { const i = [], s = t.length / e, n = t.length; let o = 0; for (; o < n; o += s)i.push(t[Math.floor(o)]); return i } function qs(t, e, i) { const s = t.ticks.length, n = Math.min(e, s - 1), o = t._startPixel, a = t._endPixel, r = 1e-6; let l, h = t.getPixelForTick(n); if (!(i && (l = 1 === s ? Math.max(h - o, a - h) : 0 === e ? (t.getPixelForTick(1) - h) / 2 : (h - t.getPixelForTick(n - 1)) / 2, h += n < e ? l : -l, h < o - r || h > a + r))) return h } function Ks(t) { return t.drawTicks ? t.tickLength : 0 } function Gs(t, e) { if (!t.display) return 0; const i = Si(t.font, e), s = ki(t.padding); return (n(t.text) ? t.text.length : 1) * i.lineHeight + s.height } function Zs(t, e, i) { let s = ut(t); return (i && "right" !== e || !i && "right" === e) && (s = (t => "left" === t ? "right" : "right" === t ? "left" : t)(s)), s } class Js extends Hs { constructor(t) { super(), this.id = t.id, this.type = t.type, this.options = void 0, this.ctx = t.ctx, this.chart = t.chart, 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._margins = { left: 0, right: 0, top: 0, bottom: 0 }, this.maxWidth = void 0, this.maxHeight = void 0, this.paddingTop = void 0, this.paddingBottom = void 0, this.paddingLeft = void 0, this.paddingRight = void 0, this.axis = void 0, this.labelRotation = void 0, this.min = void 0, this.max = void 0, this._range = void 0, this.ticks = [], this._gridLineItems = null, this._labelItems = null, this._labelSizes = null, this._length = 0, this._maxLength = 0, this._longestTextCache = {}, this._startPixel = void 0, this._endPixel = void 0, this._reversePixels = !1, this._userMax = void 0, this._userMin = void 0, this._suggestedMax = void 0, this._suggestedMin = void 0, this._ticksLength = 0, this._borderValue = 0, this._cache = {}, this._dataLimitsCached = !1, this.$context = void 0 } init(t) { this.options = t.setContext(this.getContext()), this.axis = t.axis, this._userMin = this.parse(t.min), this._userMax = this.parse(t.max), this._suggestedMin = this.parse(t.suggestedMin), this._suggestedMax = this.parse(t.suggestedMax) } parse(t, e) { return t } getUserBounds() { let { _userMin: t, _userMax: e, _suggestedMin: i, _suggestedMax: s } = this; return t = r(t, Number.POSITIVE_INFINITY), e = r(e, Number.NEGATIVE_INFINITY), i = r(i, Number.POSITIVE_INFINITY), s = r(s, Number.NEGATIVE_INFINITY), { min: r(t, i), max: r(e, s), minDefined: a(t), maxDefined: a(e) } } getMinMax(t) { let e, { min: i, max: s, minDefined: n, maxDefined: o } = this.getUserBounds(); if (n && o) return { min: i, max: s }; const a = this.getMatchingVisibleMetas(); for (let r = 0, l = a.length; r < l; ++r)e = a[r].controller.getMinMax(this, t), n || (i = Math.min(i, e.min)), o || (s = Math.max(s, e.max)); return i = o && i > s ? s : i, s = n && i > s ? i : s, { min: r(i, r(s, i)), max: r(s, r(i, 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() { d(this.options.beforeUpdate, [this]) } update(t, e, i) { const { beginAtZero: s, grace: n, ticks: o } = this.options, a = o.sampleSize; this.beforeUpdate(), this.maxWidth = t, this.maxHeight = e, this._margins = i = Object.assign({ left: 0, right: 0, top: 0, bottom: 0 }, i), this.ticks = null, this._labelSizes = null, this._gridLineItems = null, this._labelItems = null, this.beforeSetDimensions(), this.setDimensions(), this.afterSetDimensions(), this._maxLength = this.isHorizontal() ? this.width + i.left + i.right : this.height + i.top + i.bottom, this._dataLimitsCached || (this.beforeDataLimits(), this.determineDataLimits(), this.afterDataLimits(), this._range = Di(this, n, s), this._dataLimitsCached = !0), this.beforeBuildTicks(), this.ticks = this.buildTicks() || [], this.afterBuildTicks(); const r = a < this.ticks.length; this._convertTicksToLabels(r ? Xs(this.ticks, a) : this.ticks), this.configure(), this.beforeCalculateLabelRotation(), this.calculateLabelRotation(), this.afterCalculateLabelRotation(), o.display && (o.autoSkip || "auto" === o.source) && (this.ticks = js(this, this.ticks), this._labelSizes = null, this.afterAutoSkip()), r && this._convertTicksToLabels(this.ticks), this.beforeFit(), this.fit(), this.afterFit(), this.afterUpdate() } configure() { let t, e, i = this.options.reverse; this.isHorizontal() ? (t = this.left, e = this.right) : (t = this.top, e = this.bottom, i = !i), this._startPixel = t, this._endPixel = e, this._reversePixels = i, this._length = e - t, this._alignToPixels = this.options.alignToPixels } afterUpdate() { d(this.options.afterUpdate, [this]) } beforeSetDimensions() { d(this.options.beforeSetDimensions, [this]) } setDimensions() { this.isHorizontal() ? (this.width = this.maxWidth, this.left = 0, this.right = this.width) : (this.height = this.maxHeight, this.top = 0, this.bottom = this.height), this.paddingLeft = 0, this.paddingTop = 0, this.paddingRight = 0, this.paddingBottom = 0 } afterSetDimensions() { d(this.options.afterSetDimensions, [this]) } _callHooks(t) { this.chart.notifyPlugins(t, this.getContext()), d(this.options[t], [this]) } beforeDataLimits() { this._callHooks("beforeDataLimits") } determineDataLimits() { } afterDataLimits() { this._callHooks("afterDataLimits") } beforeBuildTicks() { this._callHooks("beforeBuildTicks") } buildTicks() { return [] } afterBuildTicks() { this._callHooks("afterBuildTicks") } beforeTickToLabelConversion() { d(this.options.beforeTickToLabelConversion, [this]) } generateTickLabels(t) { const e = this.options.ticks; let i, s, n; for (i = 0, s = t.length; i < s; i++)n = t[i], n.label = d(e.callback, [n.value, i, t], this) } afterTickToLabelConversion() { d(this.options.afterTickToLabelConversion, [this]) } beforeCalculateLabelRotation() { d(this.options.beforeCalculateLabelRotation, [this]) } calculateLabelRotation() { const t = this.options, e = t.ticks, i = Us(this.ticks.length, t.ticks.maxTicksLimit), s = e.minRotation || 0, n = e.maxRotation; let o, a, r, l = s; if (!this._isVisible() || !e.display || s >= n || i <= 1 || !this.isHorizontal()) return void (this.labelRotation = s); const h = this._getLabelSizes(), c = h.widest.width, d = h.highest.height, u = J(this.chart.width - c, 0, this.maxWidth); o = t.offset ? this.maxWidth / i : u / (i - 1), c + 6 > o && (o = u / (i - (t.offset ? .5 : 1)), a = this.maxHeight - Ks(t.grid) - e.padding - Gs(t.title, this.chart.options.font), r = Math.sqrt(c * c + d * d), l = Y(Math.min(Math.asin(J((h.highest.height + 6) / o, -1, 1)), Math.asin(J(a / r, -1, 1)) - Math.asin(J(d / r, -1, 1)))), l = Math.max(s, Math.min(n, l))), this.labelRotation = l } afterCalculateLabelRotation() { d(this.options.afterCalculateLabelRotation, [this]) } afterAutoSkip() { } beforeFit() { d(this.options.beforeFit, [this]) } fit() { const t = { width: 0, height: 0 }, { chart: e, options: { ticks: i, title: s, grid: n } } = this, o = this._isVisible(), a = this.isHorizontal(); if (o) { const o = Gs(s, e.options.font); if (a ? (t.width = this.maxWidth, t.height = Ks(n) + o) : (t.height = this.maxHeight, t.width = Ks(n) + o), i.display && this.ticks.length) { const { first: e, last: s, widest: n, highest: o } = this._getLabelSizes(), r = 2 * i.padding, l = $(this.labelRotation), h = Math.cos(l), c = Math.sin(l); if (a) { const e = i.mirror ? 0 : c * n.width + h * o.height; t.height = Math.min(this.maxHeight, t.height + e + r) } else { const e = i.mirror ? 0 : h * n.width + c * o.height; t.width = Math.min(this.maxWidth, t.width + e + r) } this._calculatePadding(e, s, c, h) } } this._handleMargins(), a ? (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, i, s) { const { ticks: { align: n, padding: o }, position: a } = this.options, r = 0 !== this.labelRotation, l = "top" !== a && "x" === this.axis; if (this.isHorizontal()) { const a = this.getPixelForTick(0) - this.left, h = this.right - this.getPixelForTick(this.ticks.length - 1); let c = 0, d = 0; r ? l ? (c = s * t.width, d = i * e.height) : (c = i * t.height, d = s * e.width) : "start" === n ? d = e.width : "end" === n ? c = t.width : "inner" !== n && (c = t.width / 2, d = e.width / 2), this.paddingLeft = Math.max((c - a + o) * this.width / (this.width - a), 0), this.paddingRight = Math.max((d - h + o) * this.width / (this.width - h), 0) } else { let i = e.height / 2, s = t.height / 2; "start" === n ? (i = 0, s = t.height) : "end" === n && (i = e.height, s = 0), this.paddingTop = i + o, this.paddingBottom = s + o } } _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() { d(this.options.afterFit, [this]) } isHorizontal() { const { axis: t, position: e } = this.options; return "top" === e || "bottom" === e || "x" === t } isFullSize() { return this.options.fullSize } _convertTicksToLabels(t) { let e, i; for (this.beforeTickToLabelConversion(), this.generateTickLabels(t), e = 0, i = t.length; e < i; e++)s(t[e].label) && (t.splice(e, 1), i--, e--); this.afterTickToLabelConversion() } _getLabelSizes() { let t = this._labelSizes; if (!t) { const e = this.options.ticks.sampleSize; let i = this.ticks; e < i.length && (i = Xs(i, e)), this._labelSizes = t = this._computeLabelSizes(i, i.length, this.options.ticks.maxTicksLimit) } return t } _computeLabelSizes(t, e, i) { const { ctx: o, _longestTextCache: a } = this, r = [], l = [], h = Math.floor(e / Us(e, i)); let c, d, f, g, p, m, b, x, _, y, v, M = 0, w = 0; for (c = 0; c < e; c += h) { if (g = t[c].label, p = this._resolveTickFontOptions(c), o.font = m = p.string, b = a[m] = a[m] || { data: {}, gc: [] }, x = p.lineHeight, _ = y = 0, s(g) || n(g)) { if (n(g)) for (d = 0, f = g.length; d < f; ++d)v = g[d], s(v) || n(v) || (_ = Ce(o, b.data, b.gc, _, v), y += x) } else _ = Ce(o, b.data, b.gc, _, g), y = x; r.push(_), l.push(y), M = Math.max(_, M), w = Math.max(y, w) } !function (t, e) { u(t, (t => { const i = t.gc, s = i.length / 2; let n; if (s > e) { for (n = 0; n < s; ++n)delete t.data[i[n]]; i.splice(0, s) } })) }(a, e); const k = r.indexOf(M), S = l.indexOf(w), P = t => ({ width: r[t] || 0, height: l[t] || 0 }); return { first: P(0), last: P(e - 1), widest: P(k), highest: P(S), widths: r, heights: l } } 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 Q(this._alignToPixels ? Ae(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 && t < e.length) { const i = e[t]; return i.$context || (i.$context = function (t, e, i) { return Ci(t, { tick: i, index: e, type: "tick" }) }(this.getContext(), t, i)) } return this.$context || (this.$context = Ci(this.chart.getContext(), { scale: this, type: "scale" })) } _tickSize() { const t = this.options.ticks, e = $(this.labelRotation), i = Math.abs(Math.cos(e)), s = Math.abs(Math.sin(e)), n = this._getLabelSizes(), o = t.autoSkipPadding || 0, a = n ? n.widest.width + o : 0, r = n ? n.highest.height + o : 0; return this.isHorizontal() ? r * i > a * s ? a / i : r / s : r * s < a * i ? r / i : a / s } _isVisible() { const t = this.options.display; return "auto" !== t ? !!t : this.getMatchingVisibleMetas().length > 0 } _computeGridLineItems(t) { const e = this.axis, i = this.chart, s = this.options, { grid: n, position: a, border: r } = s, h = n.offset, c = this.isHorizontal(), d = this.ticks.length + (h ? 1 : 0), u = Ks(n), f = [], g = r.setContext(this.getContext()), p = g.display ? g.width : 0, m = p / 2, b = function (t) { return Ae(i, t, p) }; let x, _, y, v, M, w, k, S, P, D, C, O; if ("top" === a) x = b(this.bottom), w = this.bottom - u, S = x - m, D = b(t.top) + m, O = t.bottom; else if ("bottom" === a) x = b(this.top), D = t.top, O = b(t.bottom) - m, w = x + m, S = this.top + u; else if ("left" === a) x = b(this.right), M = this.right - u, k = x - m, P = b(t.left) + m, C = t.right; else if ("right" === a) x = b(this.left), P = t.left, C = b(t.right) - m, M = x + m, k = this.left + u; else if ("x" === e) { if ("center" === a) x = b((t.top + t.bottom) / 2 + .5); else if (o(a)) { const t = Object.keys(a)[0], e = a[t]; x = b(this.chart.scales[t].getPixelForValue(e)) } D = t.top, O = t.bottom, w = x + m, S = w + u } else if ("y" === e) { if ("center" === a) x = b((t.left + t.right) / 2); else if (o(a)) { const t = Object.keys(a)[0], e = a[t]; x = b(this.chart.scales[t].getPixelForValue(e)) } M = x - m, k = M - u, P = t.left, C = t.right } const A = l(s.ticks.maxTicksLimit, d), T = Math.max(1, Math.ceil(d / A)); for (_ = 0; _ < d; _ += T) { const t = this.getContext(_), e = n.setContext(t), s = r.setContext(t), o = e.lineWidth, a = e.color, l = s.dash || [], d = s.dashOffset, u = e.tickWidth, g = e.tickColor, p = e.tickBorderDash || [], m = e.tickBorderDashOffset; y = qs(this, _, h), void 0 !== y && (v = Ae(i, y, o), c ? M = k = P = C = v : w = S = D = O = v, f.push({ tx1: M, ty1: w, tx2: k, ty2: S, x1: P, y1: D, x2: C, y2: O, width: o, color: a, borderDash: l, borderDashOffset: d, tickWidth: u, tickColor: g, tickBorderDash: p, tickBorderDashOffset: m })) } return this._ticksLength = d, this._borderValue = x, f } _computeLabelItems(t) { const e = this.axis, i = this.options, { position: s, ticks: a } = i, r = this.isHorizontal(), l = this.ticks, { align: h, crossAlign: c, padding: d, mirror: u } = a, f = Ks(i.grid), g = f + d, p = u ? -d : g, m = -$(this.labelRotation), b = []; let x, _, y, v, M, w, k, S, P, D, C, O, A = "middle"; if ("top" === s) w = this.bottom - p, k = this._getXAxisLabelAlignment(); else if ("bottom" === s) w = this.top + p, k = this._getXAxisLabelAlignment(); else if ("left" === s) { const t = this._getYAxisLabelAlignment(f); k = t.textAlign, M = t.x } else if ("right" === s) { const t = this._getYAxisLabelAlignment(f); k = t.textAlign, M = t.x } else if ("x" === e) { if ("center" === s) w = (t.top + t.bottom) / 2 + g; else if (o(s)) { const t = Object.keys(s)[0], e = s[t]; w = this.chart.scales[t].getPixelForValue(e) + g } k = this._getXAxisLabelAlignment() } else if ("y" === e) { if ("center" === s) M = (t.left + t.right) / 2 - g; else if (o(s)) { const t = Object.keys(s)[0], e = s[t]; M = this.chart.scales[t].getPixelForValue(e) } k = this._getYAxisLabelAlignment(f).textAlign } "y" === e && ("start" === h ? A = "top" : "end" === h && (A = "bottom")); const T = this._getLabelSizes(); for (x = 0, _ = l.length; x < _; ++x) { y = l[x], v = y.label; const t = a.setContext(this.getContext(x)); S = this.getPixelForTick(x) + a.labelOffset, P = this._resolveTickFontOptions(x), D = P.lineHeight, C = n(v) ? v.length : 1; const e = C / 2, i = t.color, o = t.textStrokeColor, h = t.textStrokeWidth; let d, f = k; if (r ? (M = S, "inner" === k && (f = x === _ - 1 ? this.options.reverse ? "left" : "right" : 0 === x ? this.options.reverse ? "right" : "left" : "center"), O = "top" === s ? "near" === c || 0 !== m ? -C * D + D / 2 : "center" === c ? -T.highest.height / 2 - e * D + D : -T.highest.height + D / 2 : "near" === c || 0 !== m ? D / 2 : "center" === c ? T.highest.height / 2 - e * D : T.highest.height - C * D, u && (O *= -1), 0 === m || t.showLabelBackdrop || (M += D / 2 * Math.sin(m))) : (w = S, O = (1 - C) * D / 2), t.showLabelBackdrop) { const e = ki(t.backdropPadding), i = T.heights[x], s = T.widths[x]; let n = O - e.top, o = 0 - e.left; switch (A) { case "middle": n -= i / 2; break; case "bottom": n -= i }switch (k) { case "center": o -= s / 2; break; case "right": o -= s; break; case "inner": x === _ - 1 ? o -= s : x > 0 && (o -= s / 2) }d = { left: o, top: n, width: s + e.width, height: i + e.height, color: t.backdropColor } } b.push({ label: v, font: P, textOffset: O, options: { rotation: m, color: i, strokeColor: o, strokeWidth: h, textAlign: f, textBaseline: A, translation: [M, w], backdrop: d } }) } return b } _getXAxisLabelAlignment() { const { position: t, ticks: e } = this.options; if (-$(this.labelRotation)) return "top" === t ? "left" : "right"; let i = "center"; return "start" === e.align ? i = "left" : "end" === e.align ? i = "right" : "inner" === e.align && (i = "inner"), i } _getYAxisLabelAlignment(t) { const { position: e, ticks: { crossAlign: i, mirror: s, padding: n } } = this.options, o = t + n, a = this._getLabelSizes().widest.width; let r, l; return "left" === e ? s ? (l = this.right + n, "near" === i ? r = "left" : "center" === i ? (r = "center", l += a / 2) : (r = "right", l += a)) : (l = this.right - o, "near" === i ? r = "right" : "center" === i ? (r = "center", l -= a / 2) : (r = "left", l = this.left)) : "right" === e ? s ? (l = this.left + n, "near" === i ? r = "right" : "center" === i ? (r = "center", l -= a / 2) : (r = "left", l -= a)) : (l = this.left + o, "near" === i ? r = "left" : "center" === i ? (r = "center", l += a / 2) : (r = "right", l = this.right)) : r = "right", { textAlign: r, x: l } } _computeLabelArea() { if (this.options.ticks.mirror) return; const t = this.chart, e = this.options.position; return "left" === e || "right" === e ? { top: 0, left: this.left, bottom: t.height, right: this.right } : "top" === e || "bottom" === e ? { top: this.top, left: 0, bottom: this.bottom, right: t.width } : void 0 } drawBackground() { const { ctx: t, options: { backgroundColor: e }, left: i, top: s, width: n, height: o } = this; e && (t.save(), t.fillStyle = e, t.fillRect(i, s, n, o), t.restore()) } getLineWidthForValue(t) { const e = this.options.grid; if (!this._isVisible() || !e.display) return 0; const i = this.ticks.findIndex((e => e.value === t)); if (i >= 0) { return e.setContext(this.getContext(i)).lineWidth } return 0 } drawGrid(t) { const e = this.options.grid, i = this.ctx, s = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(t)); let n, o; const a = (t, e, s) => { s.width && s.color && (i.save(), i.lineWidth = s.width, i.strokeStyle = s.color, i.setLineDash(s.borderDash || []), i.lineDashOffset = s.borderDashOffset, i.beginPath(), i.moveTo(t.x, t.y), i.lineTo(e.x, e.y), i.stroke(), i.restore()) }; if (e.display) for (n = 0, o = s.length; n < o; ++n) { const t = s[n]; e.drawOnChartArea && a({ x: t.x1, y: t.y1 }, { x: t.x2, y: t.y2 }, t), e.drawTicks && a({ x: t.tx1, y: t.ty1 }, { x: t.tx2, y: t.ty2 }, { color: t.tickColor, width: t.tickWidth, borderDash: t.tickBorderDash, borderDashOffset: t.tickBorderDashOffset }) } } drawBorder() { const { chart: t, ctx: e, options: { border: i, grid: s } } = this, n = i.setContext(this.getContext()), o = i.display ? n.width : 0; if (!o) return; const a = s.setContext(this.getContext(0)).lineWidth, r = this._borderValue; let l, h, c, d; this.isHorizontal() ? (l = Ae(t, this.left, o) - o / 2, h = Ae(t, this.right, a) + a / 2, c = d = r) : (c = Ae(t, this.top, o) - o / 2, d = Ae(t, this.bottom, a) + a / 2, l = h = r), e.save(), e.lineWidth = n.width, e.strokeStyle = n.color, e.beginPath(), e.moveTo(l, c), e.lineTo(h, d), e.stroke(), e.restore() } drawLabels(t) { if (!this.options.ticks.display) return; const e = this.ctx, i = this._computeLabelArea(); i && Ie(e, i); const s = this.getLabelItems(t); for (const t of s) { const i = t.options, s = t.font; Ne(e, t.label, 0, t.textOffset, s, i) } i && ze(e) } drawTitle() { const { ctx: t, options: { position: e, title: i, reverse: s } } = this; if (!i.display) return; const a = Si(i.font), r = ki(i.padding), l = i.align; let h = a.lineHeight / 2; "bottom" === e || "center" === e || o(e) ? (h += r.bottom, n(i.text) && (h += a.lineHeight * (i.text.length - 1))) : h += r.top; const { titleX: c, titleY: d, maxWidth: u, rotation: f } = function (t, e, i, s) { const { top: n, left: a, bottom: r, right: l, chart: h } = t, { chartArea: c, scales: d } = h; let u, f, g, p = 0; const m = r - n, b = l - a; if (t.isHorizontal()) { if (f = ft(s, a, l), o(i)) { const t = Object.keys(i)[0], s = i[t]; g = d[t].getPixelForValue(s) + m - e } else g = "center" === i ? (c.bottom + c.top) / 2 + m - e : Ys(t, i, e); u = l - a } else { if (o(i)) { const t = Object.keys(i)[0], s = i[t]; f = d[t].getPixelForValue(s) - b + e } else f = "center" === i ? (c.left + c.right) / 2 - b + e : Ys(t, i, e); g = ft(s, r, n), p = "left" === i ? -E : E } return { titleX: f, titleY: g, maxWidth: u, rotation: p } }(this, h, e, l); Ne(t, i.text, 0, 0, a, { color: i.color, maxWidth: u, rotation: f, textAlign: Zs(l, e, s), textBaseline: "middle", translation: [c, d] }) } draw(t) { this._isVisible() && (this.drawBackground(), this.drawGrid(t), this.drawBorder(), this.drawTitle(), this.drawLabels(t)) } _layers() { const t = this.options, e = t.ticks && t.ticks.z || 0, i = l(t.grid && t.grid.z, -1), s = l(t.border && t.border.z, 0); return this._isVisible() && this.draw === Js.prototype.draw ? [{ z: i, draw: t => { this.drawBackground(), this.drawGrid(t), this.drawTitle() } }, { z: s, draw: () => { this.drawBorder() } }, { z: e, draw: t => { this.drawLabels(t) } }] : [{ z: e, draw: t => { this.draw(t) } }] } getMatchingVisibleMetas(t) { const e = this.chart.getSortedVisibleDatasetMetas(), i = this.axis + "AxisID", s = []; let n, o; for (n = 0, o = e.length; n < o; ++n) { const o = e[n]; o[i] !== this.id || t && o.type !== t || s.push(o) } return s } _resolveTickFontOptions(t) { return Si(this.options.ticks.setContext(this.getContext(t)).font) } _maxDigits() { const t = this._resolveTickFontOptions(0).lineHeight; return (this.isHorizontal() ? this.width : this.height) / t } } class Qs { constructor(t, e, i) { this.type = t, this.scope = e, this.override = i, this.items = Object.create(null) } isForType(t) { return Object.prototype.isPrototypeOf.call(this.type.prototype, t.prototype) } register(t) { const e = Object.getPrototypeOf(t); let i; (function (t) { return "id" in t && "defaults" in t })(e) && (i = this.register(e)); const s = this.items, n = t.id, o = this.scope + "." + n; if (!n) throw new Error("class does not have id: " + t); return n in s || (s[n] = t, function (t, e, i) { const s = b(Object.create(null), [i ? ue.get(i) : {}, ue.get(e), t.defaults]); ue.set(e, s), t.defaultRoutes && function (t, e) { Object.keys(e).forEach((i => { const s = i.split("."), n = s.pop(), o = [t].concat(s).join("."), a = e[i].split("."), r = a.pop(), l = a.join("."); ue.route(o, n, l, r) })) }(e, t.defaultRoutes); t.descriptors && ue.describe(e, t.descriptors) }(t, o, i), this.override && ue.override(t.id, t.overrides)), o } get(t) { return this.items[t] } unregister(t) { const e = this.items, i = t.id, s = this.scope; i in e && delete e[i], s && i in ue[s] && (delete ue[s][i], this.override && delete re[i]) } } class tn { constructor() { this.controllers = new Qs(Ns, "datasets", !0), this.elements = new Qs(Hs, "elements"), this.plugins = new Qs(Object, "plugins"), this.scales = new Qs(Js, "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, i) { [...e].forEach((e => { const s = i || this._getRegistryForType(e); i || s.isForType(e) || s === this.plugins && e.id ? this._exec(t, s, e) : u(e, (e => { const s = i || this._getRegistryForType(e); this._exec(t, s, e) })) })) } _exec(t, e, i) { const s = w(t); d(i["before" + s], [], i), e[t](i), d(i["after" + s], [], i) } _getRegistryForType(t) { for (let e = 0; e < this._typedRegistries.length; e++) { const i = this._typedRegistries[e]; if (i.isForType(t)) return i } return this.plugins } _get(t, e, i) { const s = e.get(t); if (void 0 === s) throw new Error('"' + t + '" is not a registered ' + i + "."); return s } } var en = new tn; class sn { constructor() { this._init = [] } notify(t, e, i, s) { "beforeInit" === e && (this._init = this._createDescriptors(t, !0), this._notify(this._init, t, "install")); const n = s ? this._descriptors(t).filter(s) : this._descriptors(t), o = this._notify(n, t, e, i); return "afterDestroy" === e && (this._notify(n, t, "stop"), this._notify(this._init, t, "uninstall")), o } _notify(t, e, i, s) { s = s || {}; for (const n of t) { const t = n.plugin; if (!1 === d(t[i], [e, s, n.options], t) && s.cancelable) return !1 } return !0 } invalidate() { s(this._cache) || (this._oldCache = this._cache, this._cache = void 0) } _descriptors(t) { if (this._cache) return this._cache; const e = this._cache = this._createDescriptors(t); return this._notifyStateChanges(t), e } _createDescriptors(t, e) { const i = t && t.config, s = l(i.options && i.options.plugins, {}), n = function (t) { const e = {}, i = [], s = Object.keys(en.plugins.items); for (let t = 0; t < s.length; t++)i.push(en.getPlugin(s[t])); const n = t.plugins || []; for (let t = 0; t < n.length; t++) { const s = n[t]; -1 === i.indexOf(s) && (i.push(s), e[s.id] = !0) } return { plugins: i, localIds: e } }(i); return !1 !== s || e ? function (t, { plugins: e, localIds: i }, s, n) { const o = [], a = t.getContext(); for (const r of e) { const e = r.id, l = nn(s[e], n); null !== l && o.push({ plugin: r, options: on(t.config, { plugin: r, local: i[e] }, l, a) }) } return o }(t, n, s, e) : [] } _notifyStateChanges(t) { const e = this._oldCache || [], i = this._cache, s = (t, e) => t.filter((t => !e.some((e => t.plugin.id === e.plugin.id)))); this._notify(s(e, i), t, "stop"), this._notify(s(i, e), t, "start") } } function nn(t, e) { return e || !1 !== t ? !0 === t ? {} : t : null } function on(t, { plugin: e, local: i }, s, n) { const o = t.pluginScopeKeys(e), a = t.getOptionScopes(s, o); return i && e.defaults && a.push(e.defaults), t.createResolver(a, n, [""], { scriptable: !1, indexable: !1, allKeys: !0 }) } function an(t, e) { const i = ue.datasets[t] || {}; return ((e.datasets || {})[t] || {}).indexAxis || e.indexAxis || i.indexAxis || "x" } function rn(t) { if ("x" === t || "y" === t || "r" === t) return t } function ln(t, ...e) { if (rn(t)) return t; for (const s of e) { const e = s.axis || ("top" === (i = s.position) || "bottom" === i ? "x" : "left" === i || "right" === i ? "y" : void 0) || t.length > 1 && rn(t[0].toLowerCase()); if (e) return e } var i; throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`) } function hn(t, e, i) { if (i[e + "AxisID"] === t) return { axis: e } } function cn(t, e) { const i = re[t.type] || { scales: {} }, s = e.scales || {}, n = an(t.type, e), a = Object.create(null); return Object.keys(s).forEach((e => { const r = s[e]; if (!o(r)) return console.error(`Invalid scale configuration for scale: ${e}`); if (r._proxy) return console.warn(`Ignoring resolver passed as options for scale: ${e}`); const l = ln(e, r, function (t, e) { if (e.data && e.data.datasets) { const i = e.data.datasets.filter((e => e.xAxisID === t || e.yAxisID === t)); if (i.length) return hn(t, "x", i[0]) || hn(t, "y", i[0]) } return {} }(e, t), ue.scales[r.type]), h = function (t, e) { return t === e ? "_index_" : "_value_" }(l, n), c = i.scales || {}; a[e] = x(Object.create(null), [{ axis: l }, r, c[l], c[h]]) })), t.data.datasets.forEach((i => { const n = i.type || t.type, o = i.indexAxis || an(n, e), r = (re[n] || {}).scales || {}; Object.keys(r).forEach((t => { const e = function (t, e) { let i = t; return "_index_" === t ? i = e : "_value_" === t && (i = "x" === e ? "y" : "x"), i }(t, o), n = i[e + "AxisID"] || e; a[n] = a[n] || Object.create(null), x(a[n], [{ axis: e }, s[n], r[t]]) })) })), Object.keys(a).forEach((t => { const e = a[t]; x(e, [ue.scales[e.type], ue.scale]) })), a } function dn(t) { const e = t.options || (t.options = {}); e.plugins = l(e.plugins, {}), e.scales = cn(t, e) } function un(t) { return (t = t || {}).datasets = t.datasets || [], t.labels = t.labels || [], t } const fn = new Map, gn = new Set; function pn(t, e) { let i = fn.get(t); return i || (i = e(), fn.set(t, i), gn.add(i)), i } const mn = (t, e, i) => { const s = M(e, i); void 0 !== s && t.add(s) }; class bn { constructor(t) { this._config = function (t) { return (t = t || {}).data = un(t.data), dn(t), t }(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 = un(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(), dn(t) } clearCache() { this._scopeCache.clear(), this._resolverCache.clear() } datasetScopeKeys(t) { return pn(t, (() => [[`datasets.${t}`, ""]])) } datasetAnimationScopeKeys(t, e) { return pn(`${t}.transition.${e}`, (() => [[`datasets.${t}.transitions.${e}`, `transitions.${e}`], [`datasets.${t}`, ""]])) } datasetElementScopeKeys(t, e) { return pn(`${t}-${e}`, (() => [[`datasets.${t}.elements.${e}`, `datasets.${t}`, `elements.${e}`, ""]])) } pluginScopeKeys(t) { const e = t.id; return pn(`${this.type}-plugin-${e}`, (() => [[`plugins.${e}`, ...t.additionalOptionScopes || []]])) } _cachedScopes(t, e) { const i = this._scopeCache; let s = i.get(t); return s && !e || (s = new Map, i.set(t, s)), s } getOptionScopes(t, e, i) { const { options: s, type: n } = this, o = this._cachedScopes(t, i), a = o.get(e); if (a) return a; const r = new Set; e.forEach((e => { t && (r.add(t), e.forEach((e => mn(r, t, e)))), e.forEach((t => mn(r, s, t))), e.forEach((t => mn(r, re[n] || {}, t))), e.forEach((t => mn(r, ue, t))), e.forEach((t => mn(r, le, t))) })); const l = Array.from(r); return 0 === l.length && l.push(Object.create(null)), gn.has(e) && o.set(e, l), l } chartOptionScopes() { const { options: t, type: e } = this; return [t, re[e] || {}, ue.datasets[e] || {}, { type: e }, ue, le] } resolveNamedOptions(t, e, i, s = [""]) { const o = { $shared: !0 }, { resolver: a, subPrefixes: r } = xn(this._resolverCache, t, s); let l = a; if (function (t, e) { const { isScriptable: i, isIndexable: s } = Ye(t); for (const o of e) { const e = i(o), a = s(o), r = (a || e) && t[o]; if (e && (S(r) || _n(r)) || a && n(r)) return !0 } return !1 }(a, e)) { o.$shared = !1; l = $e(a, i = S(i) ? i() : i, this.createResolver(t, i, r)) } for (const t of e) o[t] = l[t]; return o } createResolver(t, e, i = [""], s) { const { resolver: n } = xn(this._resolverCache, t, i); return o(e) ? $e(n, e, void 0, s) : n } } function xn(t, e, i) { let s = t.get(e); s || (s = new Map, t.set(e, s)); const n = i.join(); let o = s.get(n); if (!o) { o = { resolver: je(e, i), subPrefixes: i.filter((t => !t.toLowerCase().includes("hover"))) }, s.set(n, o) } return o } const _n = t => o(t) && Object.getOwnPropertyNames(t).some((e => S(t[e]))); const yn = ["top", "bottom", "left", "right", "chartArea"]; function vn(t, e) { return "top" === t || "bottom" === t || -1 === yn.indexOf(t) && "x" === e } function Mn(t, e) { return function (i, s) { return i[t] === s[t] ? i[e] - s[e] : i[t] - s[t] } } function wn(t) { const e = t.chart, i = e.options.animation; e.notifyPlugins("afterRender"), d(i && i.onComplete, [t], e) } function kn(t) { const e = t.chart, i = e.options.animation; d(i && i.onProgress, [t], e) } function Sn(t) { return fe() && "string" == typeof t ? t = document.getElementById(t) : t && t.length && (t = t[0]), t && t.canvas && (t = t.canvas), t } const Pn = {}, Dn = t => { const e = Sn(t); return Object.values(Pn).filter((t => t.canvas === e)).pop() }; function Cn(t, e, i) { const s = Object.keys(t); for (const n of s) { const s = +n; if (s >= e) { const o = t[n]; delete t[n], (i > 0 || s > e) && (t[s + i] = o) } } } function On(t, e, i) { return t.options.clip ? t[i] : e[i] } class An { static defaults = ue; static instances = Pn; static overrides = re; static registry = en; static version = "4.4.1"; static getChart = Dn; static register(...t) { en.add(...t), Tn() } static unregister(...t) { en.remove(...t), Tn() } constructor(t, e) { const s = this.config = new bn(e), n = Sn(t), o = Dn(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 || ks(n)), this.platform.updateConfig(s); const r = this.platform.acquireContext(n, a.aspectRatio), l = r && r.canvas, h = l && l.height, c = l && l.width; this.id = i(), this.ctx = r, this.canvas = l, this.width = c, this.height = h, 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 sn, this.$proxies = {}, this._hiddenIndices = {}, this.attached = !1, this._animationsDisabled = void 0, this.$context = void 0, this._doResize = dt((t => this.update(t)), a.resizeDelay || 0), this._dataChanges = [], Pn[this.id] = this, r && l ? (xt.listen(this, "complete", wn), xt.listen(this, "progress", kn), this._initialize(), this.attached && this.update()) : console.error("Failed to create chart: can't acquire context from the given item") } get aspectRatio() { const { options: { aspectRatio: t, maintainAspectRatio: e }, width: i, height: n, _aspectRatio: o } = this; return s(t) ? e && o ? o : n ? i / 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 en } _initialize() { return this.notifyPlugins("beforeInit"), this.options.responsive ? this.resize() : ke(this, this.options.devicePixelRatio), this.bindEvents(), this.notifyPlugins("afterInit"), this } clear() { return Te(this.canvas, this.ctx), this } stop() { return xt.stop(this), this } resize(t, e) { xt.running(this) ? this._resizeBeforeDraw = { width: t, height: e } : this._resize(t, e) } _resize(t, e) { const i = this.options, s = this.canvas, n = i.maintainAspectRatio && this.aspectRatio, o = this.platform.getMaximumSize(s, t, e, n), a = i.devicePixelRatio || this.platform.getDevicePixelRatio(), r = this.width ? "resize" : "attach"; this.width = o.width, this.height = o.height, this._aspectRatio = this.aspectRatio, ke(this, a, !0) && (this.notifyPlugins("resize", { size: o }), d(i.onResize, [this, o], this), this.attached && this._doResize(r) && this.render()) } ensureScalesHaveIDs() { u(this.options.scales || {}, ((t, e) => { t.id = e })) } buildOrUpdateScales() { const t = this.options, e = t.scales, i = this.scales, s = Object.keys(i).reduce(((t, e) => (t[e] = !1, t)), {}); let n = []; e && (n = n.concat(Object.keys(e).map((t => { const i = e[t], s = ln(t, i), n = "r" === s, o = "x" === s; return { options: i, dposition: n ? "chartArea" : o ? "bottom" : "left", dtype: n ? "radialLinear" : o ? "category" : "linear" } })))), u(n, (e => { const n = e.options, o = n.id, a = ln(o, n), r = l(n.type, e.dtype); void 0 !== n.position && vn(n.position, a) === vn(e.dposition) || (n.position = e.dposition), s[o] = !0; let h = null; if (o in i && i[o].type === r) h = i[o]; else { h = new (en.getScale(r))({ id: o, type: r, ctx: this.ctx, chart: this }), i[h.id] = h } h.init(n, t) })), u(s, ((t, e) => { t || delete i[e] })), u(i, (t => { as.configure(this, t, t.options), as.addBox(this, t) })) } _updateMetasets() { const t = this._metasets, e = this.data.datasets.length, i = t.length; if (t.sort(((t, e) => t.index - e.index)), i > e) { for (let t = e; t < i; ++t)this._destroyDatasetMeta(t); t.splice(e, i - e) } this._sortedMetasets = t.slice(0).sort(Mn("order", "index")) } _removeUnreferencedMetasets() { const { _metasets: t, data: { datasets: e } } = this; t.length > e.length && delete this._stacks, t.forEach(((t, i) => { 0 === e.filter((e => e === t._dataset)).length && this._destroyDatasetMeta(i) })) } buildOrUpdateControllers() { const t = [], e = this.data.datasets; let i, s; for (this._removeUnreferencedMetasets(), i = 0, s = e.length; i < s; i++) { const s = e[i]; let n = this.getDatasetMeta(i); const o = s.type || this.config.type; if (n.type && n.type !== o && (this._destroyDatasetMeta(i), n = this.getDatasetMeta(i)), n.type = o, n.indexAxis = s.indexAxis || an(o, this.options), n.order = s.order || 0, n.index = i, n.label = "" + s.label, n.visible = this.isDatasetVisible(i), n.controller) n.controller.updateIndex(i), n.controller.linkScales(); else { const e = en.getController(o), { datasetElementType: s, dataElementType: a } = ue.datasets[o]; Object.assign(e, { dataElementType: en.getElement(a), datasetElementType: s && en.getElement(s) }), n.controller = new e(this, i), t.push(n.controller) } } return this._updateMetasets(), t } _resetElements() { u(this.data.datasets, ((t, e) => { this.getDatasetMeta(e).controller.reset() }), this) } reset() { this._resetElements(), this.notifyPlugins("reset") } update(t) { const e = this.config; e.update(); const i = this._options = e.createResolver(e.chartOptionScopes(), this.getContext()), s = this._animationsDisabled = !i.animation; if (this._updateScales(), this._checkEventBindings(), this._updateHiddenIndices(), this._plugins.invalidate(), !1 === this.notifyPlugins("beforeUpdate", { mode: t, cancelable: !0 })) return; const n = this.buildOrUpdateControllers(); this.notifyPlugins("beforeElementsUpdate"); let o = 0; for (let t = 0, e = this.data.datasets.length; t < e; t++) { const { controller: e } = this.getDatasetMeta(t), i = !s && -1 === n.indexOf(e); e.buildOrUpdateElements(i), o = Math.max(+e.getMaxOverflow(), o) } o = this._minPadding = i.layout.autoPadding ? o : 0, this._updateLayout(o), s || u(n, (t => { t.reset() })), this._updateDatasets(t), this.notifyPlugins("afterUpdate", { mode: t }), this._layers.sort(Mn("z", "_idx")); const { _active: a, _lastEvent: r } = this; r ? this._eventHandler(r, !0) : a.length && this._updateHoverStyles(a, a, !0), this.render() } _updateScales() { u(this.scales, (t => { as.removeBox(this, t) })), this.ensureScalesHaveIDs(), this.buildOrUpdateScales() } _checkEventBindings() { const t = this.options, e = new Set(Object.keys(this._listeners)), i = new Set(t.events); P(e, i) && !!this._responsiveListeners === t.responsive || (this.unbindEvents(), this.bindEvents()) } _updateHiddenIndices() { const { _hiddenIndices: t } = this, e = this._getUniformDataChanges() || []; for (const { method: i, start: s, count: n } of e) { Cn(t, s, "_removeElements" === i ? -n : n) } } _getUniformDataChanges() { const t = this._dataChanges; if (!t || !t.length) return; this._dataChanges = []; const e = this.data.datasets.length, i = e => new Set(t.filter((t => t[0] === e)).map(((t, e) => e + "," + t.splice(1).join(",")))), s = i(0); for (let t = 1; t < e; t++)if (!P(s, i(t))) return; return Array.from(s).map((t => t.split(","))).map((t => ({ method: t[1], start: +t[2], count: +t[3] }))) } _updateLayout(t) { if (!1 === this.notifyPlugins("beforeLayout", { cancelable: !0 })) return; as.update(this, this.width, this.height, t); const e = this.chartArea, i = e.width <= 0 || e.height <= 0; this._layers = [], u(this.boxes, (t => { i && "chartArea" === t.position || (t.configure && t.configure(), this._layers.push(...t._layers())) }), this), this._layers.forEach(((t, e) => { t._idx = e })), this.notifyPlugins("afterLayout") } _updateDatasets(t) { if (!1 !== this.notifyPlugins("beforeDatasetsUpdate", { mode: t, cancelable: !0 })) { for (let t = 0, e = this.data.datasets.length; t < e; ++t)this.getDatasetMeta(t).controller.configure(); for (let e = 0, i = this.data.datasets.length; e < i; ++e)this._updateDataset(e, S(t) ? t({ datasetIndex: e }) : t); this.notifyPlugins("afterDatasetsUpdate", { mode: t }) } } _updateDataset(t, e) { const i = this.getDatasetMeta(t), s = { meta: i, index: t, mode: e, cancelable: !0 }; !1 !== this.notifyPlugins("beforeDatasetUpdate", s) && (i.controller._update(e), s.cancelable = !1, this.notifyPlugins("afterDatasetUpdate", s)) } render() { !1 !== this.notifyPlugins("beforeRender", { cancelable: !0 }) && (xt.has(this) ? this.attached && !xt.running(this) && xt.start(this) : (this.draw(), wn({ chart: this }))) } draw() { let t; if (this._resizeBeforeDraw) { const { width: t, height: e } = this._resizeBeforeDraw; this._resize(t, e), this._resizeBeforeDraw = null } if (this.clear(), this.width <= 0 || this.height <= 0) return; if (!1 === this.notifyPlugins("beforeDraw", { cancelable: !0 })) return; const e = this._layers; for (t = 0; t < e.length && e[t].z <= 0; ++t)e[t].draw(this.chartArea); for (this._drawDatasets(); t < e.length; ++t)e[t].draw(this.chartArea); this.notifyPlugins("afterDraw") } _getSortedDatasetMetas(t) { const e = this._sortedMetasets, i = []; let s, n; for (s = 0, n = e.length; s < n; ++s) { const n = e[s]; t && !n.visible || i.push(n) } return i } getSortedVisibleDatasetMetas() { return this._getSortedDatasetMetas(!0) } _drawDatasets() { if (!1 === this.notifyPlugins("beforeDatasetsDraw", { cancelable: !0 })) return; const t = this.getSortedVisibleDatasetMetas(); for (let e = t.length - 1; e >= 0; --e)this._drawDataset(t[e]); this.notifyPlugins("afterDatasetsDraw") } _drawDataset(t) { const e = this.ctx, i = t._clip, s = !i.disabled, n = function (t, e) { const { xScale: i, yScale: s } = t; return i && s ? { left: On(i, e, "left"), right: On(i, e, "right"), top: On(s, e, "top"), bottom: On(s, e, "bottom") } : e }(t, this.chartArea), o = { meta: t, index: t.index, cancelable: !0 }; !1 !== this.notifyPlugins("beforeDatasetDraw", o) && (s && Ie(e, { left: !1 === i.left ? 0 : n.left - i.left, right: !1 === i.right ? this.width : n.right + i.right, top: !1 === i.top ? 0 : n.top - i.top, bottom: !1 === i.bottom ? this.height : n.bottom + i.bottom }), t.controller.draw(), s && ze(e), o.cancelable = !1, this.notifyPlugins("afterDatasetDraw", o)) } isPointInArea(t) { return Re(t, this.chartArea, this._minPadding) } getElementsAtEventForMode(t, e, i, s) { const n = Xi.modes[e]; return "function" == typeof n ? n(this, t, i, s) : [] } getDatasetMeta(t) { const e = this.data.datasets[t], i = this._metasets; let s = i.filter((t => t && t._dataset === e)).pop(); return s || (s = { 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 }, i.push(s)), s } getContext() { return this.$context || (this.$context = Ci(null, { chart: this, type: "chart" })) } getVisibleDatasetCount() { return this.getSortedVisibleDatasetMetas().length } isDatasetVisible(t) { const e = this.data.datasets[t]; if (!e) return !1; const i = this.getDatasetMeta(t); return "boolean" == typeof i.hidden ? !i.hidden : !e.hidden } setDatasetVisibility(t, e) { this.getDatasetMeta(t).hidden = !e } toggleDataVisibility(t) { this._hiddenIndices[t] = !this._hiddenIndices[t] } getDataVisibility(t) { return !this._hiddenIndices[t] } _updateVisibility(t, e, i) { const s = i ? "show" : "hide", n = this.getDatasetMeta(t), o = n.controller._resolveAnimations(void 0, s); k(e) ? (n.data[e].hidden = !i, this.update()) : (this.setDatasetVisibility(t, i), o.update(n, { visible: i }), this.update((e => e.datasetIndex === t ? s : 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(), xt.remove(this), t = 0, e = this.data.datasets.length; t < e; ++t)this._destroyDatasetMeta(t) } destroy() { this.notifyPlugins("beforeDestroy"); const { canvas: t, ctx: e } = this; this._stop(), this.config.clearCache(), t && (this.unbindEvents(), Te(t, e), this.platform.releaseContext(e), this.canvas = null, this.ctx = null), delete Pn[this.id], this.notifyPlugins("afterDestroy") } toBase64Image(...t) { return this.canvas.toDataURL(...t) } bindEvents() { this.bindUserEvents(), this.options.responsive ? this.bindResponsiveEvents() : this.attached = !0 } bindUserEvents() { const t = this._listeners, e = this.platform, i = (i, s) => { e.addEventListener(this, i, s), t[i] = s }, s = (t, e, i) => { t.offsetX = e, t.offsetY = i, this._eventHandler(t) }; u(this.options.events, (t => i(t, s))) } bindResponsiveEvents() { this._responsiveListeners || (this._responsiveListeners = {}); const t = this._responsiveListeners, e = this.platform, i = (i, s) => { e.addEventListener(this, i, s), t[i] = s }, s = (i, s) => { t[i] && (e.removeEventListener(this, i, s), delete t[i]) }, n = (t, e) => { this.canvas && this.resize(t, e) }; let o; const a = () => { s("attach", a), this.attached = !0, this.resize(), i("resize", n), i("detach", o) }; o = () => { this.attached = !1, s("resize", n), this._stop(), this._resize(0, 0), i("attach", a) }, e.isAttached(this.canvas) ? a() : o() } unbindEvents() { u(this._listeners, ((t, e) => { this.platform.removeEventListener(this, e, t) })), this._listeners = {}, u(this._responsiveListeners, ((t, e) => { this.platform.removeEventListener(this, e, t) })), this._responsiveListeners = void 0 } updateHoverStyle(t, e, i) { const s = i ? "set" : "remove"; let n, o, a, r; for ("dataset" === e && (n = this.getDatasetMeta(t[0].datasetIndex), n.controller["_" + s + "DatasetHoverStyle"]()), a = 0, r = t.length; a < r; ++a) { o = t[a]; const e = o && this.getDatasetMeta(o.datasetIndex).controller; e && e[s + "HoverStyle"](o.element, o.datasetIndex, o.index) } } getActiveElements() { return this._active || [] } setActiveElements(t) { const e = this._active || [], i = t.map((({ datasetIndex: t, index: e }) => { const i = this.getDatasetMeta(t); if (!i) throw new Error("No dataset found at index " + t); return { datasetIndex: t, element: i.data[e], index: e } })); !f(i, e) && (this._active = i, this._lastEvent = null, this._updateHoverStyles(i, e)) } notifyPlugins(t, e, i) { return this._plugins.notify(this, t, e, i) } isPluginEnabled(t) { return 1 === this._plugins._cache.filter((e => e.plugin.id === t)).length } _updateHoverStyles(t, e, i) { const s = this.options.hover, n = (t, e) => t.filter((t => !e.some((e => t.datasetIndex === e.datasetIndex && t.index === e.index)))), o = n(e, t), a = i ? t : n(t, e); o.length && this.updateHoverStyle(o, s.mode, !1), a.length && s.mode && this.updateHoverStyle(a, s.mode, !0) } _eventHandler(t, e) { const i = { event: t, replay: e, cancelable: !0, inChartArea: this.isPointInArea(t) }, s = e => (e.options.events || this.options.events).includes(t.native.type); if (!1 === this.notifyPlugins("beforeEvent", i, s)) return; const n = this._handleEvent(t, e, i.inChartArea); return i.cancelable = !1, this.notifyPlugins("afterEvent", i, s), (n || i.changed) && this.render(), this } _handleEvent(t, e, i) { const { _active: s = [], options: n } = this, o = e, a = this._getActiveElements(t, s, i, o), r = D(t), l = function (t, e, i, s) { return i && "mouseout" !== t.type ? s ? e : t : null }(t, this._lastEvent, i, r); i && (this._lastEvent = null, d(n.onHover, [t, a, this], this), r && d(n.onClick, [t, a, this], this)); const h = !f(a, s); return (h || e) && (this._active = a, this._updateHoverStyles(a, s, e)), this._lastEvent = l, h } _getActiveElements(t, e, i, s) { if ("mouseout" === t.type) return []; if (!i) return e; const n = this.options.hover; return this.getElementsAtEventForMode(t, n.mode, n, s) } } function Tn() { return u(An.instances, (t => t._plugins.invalidate())) } function Ln() { throw new Error("This method is not implemented: Check that a complete date adapter is provided.") } class En { static override(t) { Object.assign(En.prototype, t) } options; constructor(t) { this.options = t || {} } init() { } formats() { return Ln() } parse() { return Ln() } format() { return Ln() } add() { return Ln() } diff() { return Ln() } startOf() { return Ln() } endOf() { return Ln() } } var Rn = { _date: En }; function In(t) { const e = t.iScale, i = function (t, e) { if (!t._cache.$bar) { const i = t.getMatchingVisibleMetas(e); let s = []; for (let e = 0, n = i.length; e < n; e++)s = s.concat(i[e].controller.getAllParsedValues(t)); t._cache.$bar = lt(s.sort(((t, e) => t - e))) } return t._cache.$bar }(e, t.type); let s, n, o, a, r = e._length; const l = () => { 32767 !== o && -32768 !== o && (k(a) && (r = Math.min(r, Math.abs(o - a) || r)), a = o) }; for (s = 0, n = i.length; s < n; ++s)o = e.getPixelForValue(i[s]), l(); for (a = void 0, s = 0, n = e.ticks.length; s < n; ++s)o = e.getPixelForTick(s), l(); return r } function zn(t, e, i, s) { return n(t) ? function (t, e, i, s) { const n = i.parse(t[0], s), o = i.parse(t[1], s), a = Math.min(n, o), r = Math.max(n, o); let l = a, h = r; Math.abs(a) > Math.abs(r) && (l = r, h = a), e[i.axis] = h, e._custom = { barStart: l, barEnd: h, start: n, end: o, min: a, max: r } }(t, e, i, s) : e[i.axis] = i.parse(t, s), e } function Fn(t, e, i, s) { const n = t.iScale, o = t.vScale, a = n.getLabels(), r = n === o, l = []; let h, c, d, u; for (h = i, c = i + s; h < c; ++h)u = e[h], d = {}, d[n.axis] = r || n.parse(a[h], h), l.push(zn(u, d, o, h)); return l } function Vn(t) { return t && void 0 !== t.barStart && void 0 !== t.barEnd } function Bn(t, e, i, s) { let n = e.borderSkipped; const o = {}; if (!n) return void (t.borderSkipped = o); if (!0 === n) return void (t.borderSkipped = { top: !0, right: !0, bottom: !0, left: !0 }); const { start: a, end: r, reverse: l, top: h, bottom: c } = function (t) { let e, i, s, n, o; return t.horizontal ? (e = t.base > t.x, i = "left", s = "right") : (e = t.base < t.y, i = "bottom", s = "top"), e ? (n = "end", o = "start") : (n = "start", o = "end"), { start: i, end: s, reverse: e, top: n, bottom: o } }(t); "middle" === n && i && (t.enableBorderRadius = !0, (i._top || 0) === s ? n = h : (i._bottom || 0) === s ? n = c : (o[Wn(c, a, r, l)] = !0, n = h)), o[Wn(n, a, r, l)] = !0, t.borderSkipped = o } function Wn(t, e, i, s) { var n, o, a; return s ? (a = i, t = Nn(t = (n = t) === (o = e) ? a : n === a ? o : n, i, e)) : t = Nn(t, e, i), t } function Nn(t, e, i) { return "start" === t ? e : "end" === t ? i : t } function Hn(t, { inflateAmount: e }, i) { t.inflateAmount = "auto" === e ? 1 === i ? .33 : 0 : e } class jn extends Ns { static id = "doughnut"; static defaults = { datasetElementType: !1, dataElementType: "arc", animation: { animateRotate: !0, animateScale: !1 }, animations: { numbers: { type: "number", properties: ["circumference", "endAngle", "innerRadius", "outerRadius", "startAngle", "x", "y", "offset", "borderWidth", "spacing"] } }, cutout: "50%", rotation: 0, circumference: 360, radius: "100%", spacing: 0, indexAxis: "r" }; static descriptors = { _scriptable: t => "spacing" !== t, _indexable: t => "spacing" !== t && !t.startsWith("borderDash") && !t.startsWith("hoverBorderDash") }; static overrides = { aspectRatio: 1, plugins: { legend: { labels: { generateLabels(t) { const e = t.data; if (e.labels.length && e.datasets.length) { const { labels: { pointStyle: i, color: s } } = t.legend.options; return e.labels.map(((e, n) => { const o = t.getDatasetMeta(0).controller.getStyle(n); return { text: e, fillStyle: o.backgroundColor, strokeStyle: o.borderColor, fontColor: s, lineWidth: o.borderWidth, pointStyle: i, hidden: !t.getDataVisibility(n), index: n } })) } return [] } }, onClick(t, e, i) { i.chart.toggleDataVisibility(e.index), i.chart.update() } } } }; constructor(t, e) { super(t, e), this.enableOptionSharing = !0, this.innerRadius = void 0, this.outerRadius = void 0, this.offsetX = void 0, this.offsetY = void 0 } linkScales() { } parse(t, e) { const i = this.getDataset().data, s = this._cachedMeta; if (!1 === this._parsing) s._parsed = i; else { let n, a, r = t => +i[t]; if (o(i[t])) { const { key: t = "value" } = this._parsing; r = e => +M(i[e], t) } for (n = t, a = t + e; n < a; ++n)s._parsed[n] = r(n) } } _getRotation() { return $(this.options.rotation - 90) } _getCircumference() { return $(this.options.circumference) } _getRotationExtents() { let t = O, e = -O; for (let i = 0; i < this.chart.data.datasets.length; ++i)if (this.chart.isDatasetVisible(i) && this.chart.getDatasetMeta(i).type === this._type) { const s = this.chart.getDatasetMeta(i).controller, n = s._getRotation(), o = s._getCircumference(); t = Math.min(t, n), e = Math.max(e, n + o) } return { rotation: t, circumference: e - t } } update(t) { const e = this.chart, { chartArea: i } = e, s = this._cachedMeta, n = s.data, o = this.getMaxBorderWidth() + this.getMaxOffset(n) + this.options.spacing, a = Math.max((Math.min(i.width, i.height) - o) / 2, 0), r = Math.min(h(this.options.cutout, a), 1), l = this._getRingWeight(this.index), { circumference: d, rotation: u } = this._getRotationExtents(), { ratioX: f, ratioY: g, offsetX: p, offsetY: m } = function (t, e, i) { let s = 1, n = 1, o = 0, a = 0; if (e < O) { const r = t, l = r + e, h = Math.cos(r), c = Math.sin(r), d = Math.cos(l), u = Math.sin(l), f = (t, e, s) => Z(t, r, l, !0) ? 1 : Math.max(e, e * i, s, s * i), g = (t, e, s) => Z(t, r, l, !0) ? -1 : Math.min(e, e * i, s, s * i), p = f(0, h, d), m = f(E, c, u), b = g(C, h, d), x = g(C + E, c, u); s = (p - b) / 2, n = (m - x) / 2, o = -(p + b) / 2, a = -(m + x) / 2 } return { ratioX: s, ratioY: n, offsetX: o, offsetY: a } }(u, d, r), b = (i.width - o) / f, x = (i.height - o) / g, _ = Math.max(Math.min(b, x) / 2, 0), y = c(this.options.radius, _), v = (y - Math.max(y * r, 0)) / this._getVisibleDatasetWeightTotal(); this.offsetX = p * y, this.offsetY = m * y, s.total = this.calculateTotal(), this.outerRadius = y - v * this._getRingWeightOffset(this.index), this.innerRadius = Math.max(this.outerRadius - v * l, 0), this.updateElements(n, 0, n.length, t) } _circumference(t, e) { const i = this.options, s = this._cachedMeta, n = this._getCircumference(); return e && i.animation.animateRotate || !this.chart.getDataVisibility(t) || null === s._parsed[t] || s.data[t].hidden ? 0 : this.calculateCircumference(s._parsed[t] * n / O) } updateElements(t, e, i, s) { const n = "reset" === s, o = this.chart, a = o.chartArea, r = o.options.animation, l = (a.left + a.right) / 2, h = (a.top + a.bottom) / 2, c = n && r.animateScale, d = c ? 0 : this.innerRadius, u = c ? 0 : this.outerRadius, { sharedOptions: f, includeOptions: g } = this._getSharedOptions(e, s); let p, m = this._getRotation(); for (p = 0; p < e; ++p)m += this._circumference(p, n); for (p = e; p < e + i; ++p) { const e = this._circumference(p, n), i = t[p], o = { x: l + this.offsetX, y: h + this.offsetY, startAngle: m, endAngle: m + e, circumference: e, outerRadius: u, innerRadius: d }; g && (o.options = f || this.resolveDataElementOptions(p, i.active ? "active" : s)), m += e, this.updateElement(i, p, o, s) } } calculateTotal() { const t = this._cachedMeta, e = t.data; let i, s = 0; for (i = 0; i < e.length; i++) { const n = t._parsed[i]; null === n || isNaN(n) || !this.chart.getDataVisibility(i) || e[i].hidden || (s += Math.abs(n)) } return s } calculateCircumference(t) { const e = this._cachedMeta.total; return e > 0 && !isNaN(t) ? O * (Math.abs(t) / e) : 0 } getLabelAndValue(t) { const e = this._cachedMeta, i = this.chart, s = i.data.labels || [], n = ne(e._parsed[t], i.options.locale); return { label: s[t] || "", value: n } } getMaxBorderWidth(t) { let e = 0; const i = this.chart; let s, n, o, a, r; if (!t) for (s = 0, n = i.data.datasets.length; s < n; ++s)if (i.isDatasetVisible(s)) { o = i.getDatasetMeta(s), t = o.data, a = o.controller; break } if (!t) return 0; for (s = 0, n = t.length; s < n; ++s)r = a.resolveDataElementOptions(s), "inner" !== r.borderAlign && (e = Math.max(e, r.borderWidth || 0, r.hoverBorderWidth || 0)); return e } getMaxOffset(t) { let e = 0; for (let i = 0, s = t.length; i < s; ++i) { const t = this.resolveDataElementOptions(i); e = Math.max(e, t.offset || 0, t.hoverOffset || 0) } return e } _getRingWeightOffset(t) { let e = 0; for (let i = 0; i < t; ++i)this.chart.isDatasetVisible(i) && (e += this._getRingWeight(i)); return e } _getRingWeight(t) { return Math.max(l(this.chart.data.datasets[t].weight, 1), 0) } _getVisibleDatasetWeightTotal() { return this._getRingWeightOffset(this.chart.data.datasets.length) || 1 } } class $n extends Ns { static id = "polarArea"; static defaults = { dataElementType: "arc", animation: { animateRotate: !0, animateScale: !0 }, animations: { numbers: { type: "number", properties: ["x", "y", "startAngle", "endAngle", "innerRadius", "outerRadius"] } }, indexAxis: "r", startAngle: 0 }; static overrides = { aspectRatio: 1, plugins: { legend: { labels: { generateLabels(t) { const e = t.data; if (e.labels.length && e.datasets.length) { const { labels: { pointStyle: i, color: s } } = t.legend.options; return e.labels.map(((e, n) => { const o = t.getDatasetMeta(0).controller.getStyle(n); return { text: e, fillStyle: o.backgroundColor, strokeStyle: o.borderColor, fontColor: s, lineWidth: o.borderWidth, pointStyle: i, hidden: !t.getDataVisibility(n), index: n } })) } return [] } }, onClick(t, e, i) { i.chart.toggleDataVisibility(e.index), i.chart.update() } } }, scales: { r: { type: "radialLinear", angleLines: { display: !1 }, beginAtZero: !0, grid: { circular: !0 }, pointLabels: { display: !1 }, startAngle: 0 } } }; constructor(t, e) { super(t, e), this.innerRadius = void 0, this.outerRadius = void 0 } getLabelAndValue(t) { const e = this._cachedMeta, i = this.chart, s = i.data.labels || [], n = ne(e._parsed[t].r, i.options.locale); return { label: s[t] || "", value: n } } parseObjectData(t, e, i, s) { return ii.bind(this)(t, e, i, s) } update(t) { const e = this._cachedMeta.data; this._updateRadius(), this.updateElements(e, 0, e.length, t) } getMinMax() { const t = this._cachedMeta, e = { min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY }; return t.data.forEach(((t, i) => { const s = this.getParsed(i).r; !isNaN(s) && this.chart.getDataVisibility(i) && (s < e.min && (e.min = s), s > e.max && (e.max = s)) })), e } _updateRadius() { const t = this.chart, e = t.chartArea, i = t.options, s = Math.min(e.right - e.left, e.bottom - e.top), n = Math.max(s / 2, 0), o = (n - Math.max(i.cutoutPercentage ? n / 100 * i.cutoutPercentage : 1, 0)) / t.getVisibleDatasetCount(); this.outerRadius = n - o * this.index, this.innerRadius = this.outerRadius - o } updateElements(t, e, i, s) { const n = "reset" === s, o = this.chart, a = o.options.animation, r = this._cachedMeta.rScale, l = r.xCenter, h = r.yCenter, c = r.getIndexAngle(0) - .5 * C; let d, u = c; const f = 360 / this.countVisibleElements(); for (d = 0; d < e; ++d)u += this._computeAngle(d, s, f); for (d = e; d < e + i; d++) { const e = t[d]; let i = u, g = u + this._computeAngle(d, s, f), p = o.getDataVisibility(d) ? r.getDistanceFromCenterForValue(this.getParsed(d).r) : 0; u = g, n && (a.animateScale && (p = 0), a.animateRotate && (i = g = c)); const m = { x: l, y: h, innerRadius: 0, outerRadius: p, startAngle: i, endAngle: g, options: this.resolveDataElementOptions(d, e.active ? "active" : s) }; this.updateElement(e, d, m, s) } } countVisibleElements() { const t = this._cachedMeta; let e = 0; return t.data.forEach(((t, i) => { !isNaN(this.getParsed(i).r) && this.chart.getDataVisibility(i) && e++ })), e } _computeAngle(t, e, i) { return this.chart.getDataVisibility(t) ? $(this.resolveDataElementOptions(t, e).angle || i) : 0 } } var Yn = Object.freeze({ __proto__: null, BarController: class extends Ns { static id = "bar"; static defaults = { datasetElementType: !1, dataElementType: "bar", categoryPercentage: .8, barPercentage: .9, grouped: !0, animations: { numbers: { type: "number", properties: ["x", "y", "base", "width", "height"] } } }; static overrides = { scales: { _index_: { type: "category", offset: !0, grid: { offset: !0 } }, _value_: { type: "linear", beginAtZero: !0 } } }; parsePrimitiveData(t, e, i, s) { return Fn(t, e, i, s) } parseArrayData(t, e, i, s) { return Fn(t, e, i, s) } parseObjectData(t, e, i, s) { const { iScale: n, vScale: o } = t, { xAxisKey: a = "x", yAxisKey: r = "y" } = this._parsing, l = "x" === n.axis ? a : r, h = "x" === o.axis ? a : r, c = []; let d, u, f, g; for (d = i, u = i + s; d < u; ++d)g = e[d], f = {}, f[n.axis] = n.parse(M(g, l), d), c.push(zn(M(g, h), f, o, d)); return c } updateRangeFromParsed(t, e, i, s) { super.updateRangeFromParsed(t, e, i, s); const n = i._custom; n && e === this._cachedMeta.vScale && (t.min = Math.min(t.min, n.min), t.max = Math.max(t.max, n.max)) } getMaxOverflow() { return 0 } getLabelAndValue(t) { const e = this._cachedMeta, { iScale: i, vScale: s } = e, n = this.getParsed(t), o = n._custom, a = Vn(o) ? "[" + o.start + ", " + o.end + "]" : "" + s.getLabelForValue(n[s.axis]); return { label: "" + i.getLabelForValue(n[i.axis]), value: a } } initialize() { this.enableOptionSharing = !0, super.initialize(); this._cachedMeta.stack = this.getDataset().stack } update(t) { const e = this._cachedMeta; this.updateElements(e.data, 0, e.data.length, t) } updateElements(t, e, i, n) { const o = "reset" === n, { index: a, _cachedMeta: { vScale: r } } = this, l = r.getBasePixel(), h = r.isHorizontal(), c = this._getRuler(), { sharedOptions: d, includeOptions: u } = this._getSharedOptions(e, n); for (let f = e; f < e + i; f++) { const e = this.getParsed(f), i = o || s(e[r.axis]) ? { base: l, head: l } : this._calculateBarValuePixels(f), g = this._calculateBarIndexPixels(f, c), p = (e._stacks || {})[r.axis], m = { horizontal: h, base: i.base, enableBorderRadius: !p || Vn(e._custom) || a === p._top || a === p._bottom, x: h ? i.head : g.center, y: h ? g.center : i.head, height: h ? g.size : Math.abs(i.size), width: h ? Math.abs(i.size) : g.size }; u && (m.options = d || this.resolveDataElementOptions(f, t[f].active ? "active" : n)); const b = m.options || t[f].options; Bn(m, b, p, a), Hn(m, b, c.ratio), this.updateElement(t[f], f, m, n) } } _getStacks(t, e) { const { iScale: i } = this._cachedMeta, n = i.getMatchingVisibleMetas(this._type).filter((t => t.controller.options.grouped)), o = i.options.stacked, a = [], r = t => { const i = t.controller.getParsed(e), n = i && i[t.vScale.axis]; if (s(n) || isNaN(n)) return !0 }; for (const i of n) if ((void 0 === e || !r(i)) && ((!1 === o || -1 === a.indexOf(i.stack) || void 0 === o && void 0 === i.stack) && a.push(i.stack), i.index === t)) break; return a.length || a.push(void 0), a } _getStackCount(t) { return this._getStacks(void 0, t).length } _getStackIndex(t, e, i) { const s = this._getStacks(t, i), n = void 0 !== e ? s.indexOf(e) : -1; return -1 === n ? s.length - 1 : n } _getRuler() { const t = this.options, e = this._cachedMeta, i = e.iScale, s = []; let n, o; for (n = 0, o = e.data.length; n < o; ++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis], n)); const a = t.barThickness; return { min: a || In(e), pixels: s, start: i._startPixel, end: i._endPixel, stackCount: this._getStackCount(), scale: i, grouped: t.grouped, ratio: a ? 1 : t.categoryPercentage * t.barPercentage } } _calculateBarValuePixels(t) { const { _cachedMeta: { vScale: e, _stacked: i, index: n }, options: { base: o, minBarLength: a } } = this, r = o || 0, l = this.getParsed(t), h = l._custom, c = Vn(h); let d, u, f = l[e.axis], g = 0, p = i ? this.applyStack(e, l, i) : f; p !== f && (g = p - f, p = f), c && (f = h.barStart, p = h.barEnd - h.barStart, 0 !== f && F(f) !== F(h.barEnd) && (g = 0), g += f); const m = s(o) || c ? g : o; let b = e.getPixelForValue(m); if (d = this.chart.getDataVisibility(t) ? e.getPixelForValue(g + p) : b, u = d - b, Math.abs(u) < a) { u = function (t, e, i) { return 0 !== t ? F(t) : (e.isHorizontal() ? 1 : -1) * (e.min >= i ? 1 : -1) }(u, e, r) * a, f === r && (b -= u / 2); const t = e.getPixelForDecimal(0), s = e.getPixelForDecimal(1), o = Math.min(t, s), h = Math.max(t, s); b = Math.max(Math.min(b, h), o), d = b + u, i && !c && (l._stacks[e.axis]._visualValues[n] = e.getValueForPixel(d) - e.getValueForPixel(b)) } if (b === e.getPixelForValue(r)) { const t = F(u) * e.getLineWidthForValue(r) / 2; b += t, u -= t } return { size: u, base: b, head: d, center: d + u / 2 } } _calculateBarIndexPixels(t, e) { const i = e.scale, n = this.options, o = n.skipNull, a = l(n.maxBarThickness, 1 / 0); let r, h; if (e.grouped) { const i = o ? this._getStackCount(t) : e.stackCount, l = "flex" === n.barThickness ? function (t, e, i, s) { const n = e.pixels, o = n[t]; let a = t > 0 ? n[t - 1] : null, r = t < n.length - 1 ? n[t + 1] : null; const l = i.categoryPercentage; null === a && (a = o - (null === r ? e.end - e.start : r - o)), null === r && (r = o + o - a); const h = o - (o - Math.min(a, r)) / 2 * l; return { chunk: Math.abs(r - a) / 2 * l / s, ratio: i.barPercentage, start: h } }(t, e, n, i) : function (t, e, i, n) { const o = i.barThickness; let a, r; return s(o) ? (a = e.min * i.categoryPercentage, r = i.barPercentage) : (a = o * n, r = 1), { chunk: a / n, ratio: r, start: e.pixels[t] - a / 2 } }(t, e, n, i), c = this._getStackIndex(this.index, this._cachedMeta.stack, o ? t : void 0); r = l.start + l.chunk * c + l.chunk / 2, h = Math.min(a, l.chunk * l.ratio) } else r = i.getPixelForValue(this.getParsed(t)[i.axis], t), h = Math.min(a, e.min * e.ratio); return { base: r - h / 2, head: r + h / 2, center: r, size: h } } draw() { const t = this._cachedMeta, e = t.vScale, i = t.data, s = i.length; let n = 0; for (; n < s; ++n)null !== this.getParsed(n)[e.axis] && i[n].draw(this._ctx) } }, BubbleController: class extends Ns { static id = "bubble"; static defaults = { datasetElementType: !1, dataElementType: "point", animations: { numbers: { type: "number", properties: ["x", "y", "borderWidth", "radius"] } } }; static overrides = { scales: { x: { type: "linear" }, y: { type: "linear" } } }; initialize() { this.enableOptionSharing = !0, super.initialize() } parsePrimitiveData(t, e, i, s) { const n = super.parsePrimitiveData(t, e, i, s); for (let t = 0; t < n.length; t++)n[t]._custom = this.resolveDataElementOptions(t + i).radius; return n } parseArrayData(t, e, i, s) { const n = super.parseArrayData(t, e, i, s); for (let t = 0; t < n.length; t++) { const s = e[i + t]; n[t]._custom = l(s[2], this.resolveDataElementOptions(t + i).radius) } return n } parseObjectData(t, e, i, s) { const n = super.parseObjectData(t, e, i, s); for (let t = 0; t < n.length; t++) { const s = e[i + t]; n[t]._custom = l(s && s.r && +s.r, this.resolveDataElementOptions(t + i).radius) } return n } getMaxOverflow() { const t = this._cachedMeta.data; let e = 0; for (let i = t.length - 1; i >= 0; --i)e = Math.max(e, t[i].size(this.resolveDataElementOptions(i)) / 2); return e > 0 && e } getLabelAndValue(t) { const e = this._cachedMeta, i = this.chart.data.labels || [], { xScale: s, yScale: n } = e, o = this.getParsed(t), a = s.getLabelForValue(o.x), r = n.getLabelForValue(o.y), l = o._custom; return { label: i[t] || "", value: "(" + a + ", " + r + (l ? ", " + l : "") + ")" } } update(t) { const e = this._cachedMeta.data; this.updateElements(e, 0, e.length, t) } updateElements(t, e, i, s) { const n = "reset" === s, { iScale: o, vScale: a } = this._cachedMeta, { sharedOptions: r, includeOptions: l } = this._getSharedOptions(e, s), h = o.axis, c = a.axis; for (let d = e; d < e + i; d++) { const e = t[d], i = !n && this.getParsed(d), u = {}, f = u[h] = n ? o.getPixelForDecimal(.5) : o.getPixelForValue(i[h]), g = u[c] = n ? a.getBasePixel() : a.getPixelForValue(i[c]); u.skip = isNaN(f) || isNaN(g), l && (u.options = r || this.resolveDataElementOptions(d, e.active ? "active" : s), n && (u.options.radius = 0)), this.updateElement(e, d, u, s) } } resolveDataElementOptions(t, e) { const i = this.getParsed(t); let s = super.resolveDataElementOptions(t, e); s.$shared && (s = Object.assign({}, s, { $shared: !1 })); const n = s.radius; return "active" !== e && (s.radius = 0), s.radius += l(i && i._custom, n), s } }, DoughnutController: jn, LineController: class extends Ns { static id = "line"; static defaults = { datasetElementType: "line", dataElementType: "point", showLine: !0, spanGaps: !1 }; static overrides = { scales: { _index_: { type: "category" }, _value_: { type: "linear" } } }; initialize() { this.enableOptionSharing = !0, this.supportsDecimation = !0, super.initialize() } update(t) { const e = this._cachedMeta, { dataset: i, data: s = [], _dataset: n } = e, o = this.chart._animationsDisabled; let { start: a, count: r } = pt(e, s, o); this._drawStart = a, this._drawCount = r, mt(e) && (a = 0, r = s.length), i._chart = this.chart, i._datasetIndex = this.index, i._decimated = !!n._decimated, i.points = s; const l = this.resolveDatasetElementOptions(t); this.options.showLine || (l.borderWidth = 0), l.segment = this.options.segment, this.updateElement(i, void 0, { animated: !o, options: l }, t), this.updateElements(s, a, r, t) } updateElements(t, e, i, n) { const o = "reset" === n, { iScale: a, vScale: r, _stacked: l, _dataset: h } = this._cachedMeta, { sharedOptions: c, includeOptions: d } = this._getSharedOptions(e, n), u = a.axis, f = r.axis, { spanGaps: g, segment: p } = this.options, m = N(g) ? g : Number.POSITIVE_INFINITY, b = this.chart._animationsDisabled || o || "none" === n, x = e + i, _ = t.length; let y = e > 0 && this.getParsed(e - 1); for (let i = 0; i < _; ++i) { const g = t[i], _ = b ? g : {}; if (i < e || i >= x) { _.skip = !0; continue } const v = this.getParsed(i), M = s(v[f]), w = _[u] = a.getPixelForValue(v[u], i), k = _[f] = o || M ? r.getBasePixel() : r.getPixelForValue(l ? this.applyStack(r, v, l) : v[f], i); _.skip = isNaN(w) || isNaN(k) || M, _.stop = i > 0 && Math.abs(v[u] - y[u]) > m, p && (_.parsed = v, _.raw = h.data[i]), d && (_.options = c || this.resolveDataElementOptions(i, g.active ? "active" : n)), b || this.updateElement(g, i, _, n), y = v } } getMaxOverflow() { const t = this._cachedMeta, e = t.dataset, i = e.options && e.options.borderWidth || 0, s = t.data || []; if (!s.length) return i; const n = s[0].size(this.resolveDataElementOptions(0)), o = s[s.length - 1].size(this.resolveDataElementOptions(s.length - 1)); return Math.max(i, n, o) / 2 } draw() { const t = this._cachedMeta; t.dataset.updateControlPoints(this.chart.chartArea, t.iScale.axis), super.draw() } }, PieController: class extends jn { static id = "pie"; static defaults = { cutout: 0, rotation: 0, circumference: 360, radius: "100%" } }, PolarAreaController: $n, RadarController: class extends Ns { static id = "radar"; static defaults = { datasetElementType: "line", dataElementType: "point", indexAxis: "r", showLine: !0, elements: { line: { fill: "start" } } }; static overrides = { aspectRatio: 1, scales: { r: { type: "radialLinear" } } }; getLabelAndValue(t) { const e = this._cachedMeta.vScale, i = this.getParsed(t); return { label: e.getLabels()[t], value: "" + e.getLabelForValue(i[e.axis]) } } parseObjectData(t, e, i, s) { return ii.bind(this)(t, e, i, s) } update(t) { const e = this._cachedMeta, i = e.dataset, s = e.data || [], n = e.iScale.getLabels(); if (i.points = s, "resize" !== t) { const e = this.resolveDatasetElementOptions(t); this.options.showLine || (e.borderWidth = 0); const o = { _loop: !0, _fullLoop: n.length === s.length, options: e }; this.updateElement(i, void 0, o, t) } this.updateElements(s, 0, s.length, t) } updateElements(t, e, i, s) { const n = this._cachedMeta.rScale, o = "reset" === s; for (let a = e; a < e + i; a++) { const e = t[a], i = this.resolveDataElementOptions(a, e.active ? "active" : s), r = n.getPointPositionForValue(a, this.getParsed(a).r), l = o ? n.xCenter : r.x, h = o ? n.yCenter : r.y, c = { x: l, y: h, angle: r.angle, skip: isNaN(l) || isNaN(h), options: i }; this.updateElement(e, a, c, s) } } }, ScatterController: class extends Ns { static id = "scatter"; static defaults = { datasetElementType: !1, dataElementType: "point", showLine: !1, fill: !1 }; static overrides = { interaction: { mode: "point" }, scales: { x: { type: "linear" }, y: { type: "linear" } } }; getLabelAndValue(t) { const e = this._cachedMeta, i = this.chart.data.labels || [], { xScale: s, yScale: n } = e, o = this.getParsed(t), a = s.getLabelForValue(o.x), r = n.getLabelForValue(o.y); return { label: i[t] || "", value: "(" + a + ", " + r + ")" } } update(t) { const e = this._cachedMeta, { data: i = [] } = e, s = this.chart._animationsDisabled; let { start: n, count: o } = pt(e, i, s); if (this._drawStart = n, this._drawCount = o, mt(e) && (n = 0, o = i.length), this.options.showLine) { this.datasetElementType || this.addElements(); const { dataset: n, _dataset: o } = e; n._chart = this.chart, n._datasetIndex = this.index, n._decimated = !!o._decimated, n.points = i; const a = this.resolveDatasetElementOptions(t); a.segment = this.options.segment, this.updateElement(n, void 0, { animated: !s, options: a }, t) } else this.datasetElementType && (delete e.dataset, this.datasetElementType = !1); this.updateElements(i, n, o, t) } addElements() { const { showLine: t } = this.options; !this.datasetElementType && t && (this.datasetElementType = this.chart.registry.getElement("line")), super.addElements() } updateElements(t, e, i, n) { const o = "reset" === n, { iScale: a, vScale: r, _stacked: l, _dataset: h } = this._cachedMeta, c = this.resolveDataElementOptions(e, n), d = this.getSharedOptions(c), u = this.includeOptions(n, d), f = a.axis, g = r.axis, { spanGaps: p, segment: m } = this.options, b = N(p) ? p : Number.POSITIVE_INFINITY, x = this.chart._animationsDisabled || o || "none" === n; let _ = e > 0 && this.getParsed(e - 1); for (let c = e; c < e + i; ++c) { const e = t[c], i = this.getParsed(c), p = x ? e : {}, y = s(i[g]), v = p[f] = a.getPixelForValue(i[f], c), M = p[g] = o || y ? r.getBasePixel() : r.getPixelForValue(l ? this.applyStack(r, i, l) : i[g], c); p.skip = isNaN(v) || isNaN(M) || y, p.stop = c > 0 && Math.abs(i[f] - _[f]) > b, m && (p.parsed = i, p.raw = h.data[c]), u && (p.options = d || this.resolveDataElementOptions(c, e.active ? "active" : n)), x || this.updateElement(e, c, p, n), _ = i } this.updateSharedOptions(d, n, c) } getMaxOverflow() { const t = this._cachedMeta, e = t.data || []; if (!this.options.showLine) { let t = 0; for (let i = e.length - 1; i >= 0; --i)t = Math.max(t, e[i].size(this.resolveDataElementOptions(i)) / 2); return t > 0 && t } const i = t.dataset, s = i.options && i.options.borderWidth || 0; if (!e.length) return s; const n = e[0].size(this.resolveDataElementOptions(0)), o = e[e.length - 1].size(this.resolveDataElementOptions(e.length - 1)); return Math.max(s, n, o) / 2 } } }); function Un(t, e, i, s) { const n = vi(t.options.borderRadius, ["outerStart", "outerEnd", "innerStart", "innerEnd"]); const o = (i - e) / 2, a = Math.min(o, s * e / 2), r = t => { const e = (i - Math.min(o, t)) * s / 2; return J(t, 0, Math.min(o, e)) }; return { outerStart: r(n.outerStart), outerEnd: r(n.outerEnd), innerStart: J(n.innerStart, 0, a), innerEnd: J(n.innerEnd, 0, a) } } function Xn(t, e, i, s) { return { x: i + t * Math.cos(e), y: s + t * Math.sin(e) } } function qn(t, e, i, s, n, o) { const { x: a, y: r, startAngle: l, pixelMargin: h, innerRadius: c } = e, d = Math.max(e.outerRadius + s + i - h, 0), u = c > 0 ? c + s + i + h : 0; let f = 0; const g = n - l; if (s) { const t = ((c > 0 ? c - s : 0) + (d > 0 ? d - s : 0)) / 2; f = (g - (0 !== t ? g * t / (t + s) : g)) / 2 } const p = (g - Math.max(.001, g * d - i / C) / d) / 2, m = l + p + f, b = n - p - f, { outerStart: x, outerEnd: _, innerStart: y, innerEnd: v } = Un(e, u, d, b - m), M = d - x, w = d - _, k = m + x / M, S = b - _ / w, P = u + y, D = u + v, O = m + y / P, A = b - v / D; if (t.beginPath(), o) { const e = (k + S) / 2; if (t.arc(a, r, d, k, e), t.arc(a, r, d, e, S), _ > 0) { const e = Xn(w, S, a, r); t.arc(e.x, e.y, _, S, b + E) } const i = Xn(D, b, a, r); if (t.lineTo(i.x, i.y), v > 0) { const e = Xn(D, A, a, r); t.arc(e.x, e.y, v, b + E, A + Math.PI) } const s = (b - v / u + (m + y / u)) / 2; if (t.arc(a, r, u, b - v / u, s, !0), t.arc(a, r, u, s, m + y / u, !0), y > 0) { const e = Xn(P, O, a, r); t.arc(e.x, e.y, y, O + Math.PI, m - E) } const n = Xn(M, m, a, r); if (t.lineTo(n.x, n.y), x > 0) { const e = Xn(M, k, a, r); t.arc(e.x, e.y, x, m - E, k) } } else { t.moveTo(a, r); const e = Math.cos(k) * d + a, i = Math.sin(k) * d + r; t.lineTo(e, i); const s = Math.cos(S) * d + a, n = Math.sin(S) * d + r; t.lineTo(s, n) } t.closePath() } function Kn(t, e, i, s, n) { const { fullCircles: o, startAngle: a, circumference: r, options: l } = e, { borderWidth: h, borderJoinStyle: c, borderDash: d, borderDashOffset: u } = l, f = "inner" === l.borderAlign; if (!h) return; t.setLineDash(d || []), t.lineDashOffset = u, f ? (t.lineWidth = 2 * h, t.lineJoin = c || "round") : (t.lineWidth = h, t.lineJoin = c || "bevel"); let g = e.endAngle; if (o) { qn(t, e, i, s, g, n); for (let e = 0; e < o; ++e)t.stroke(); isNaN(r) || (g = a + (r % O || O)) } f && function (t, e, i) { const { startAngle: s, pixelMargin: n, x: o, y: a, outerRadius: r, innerRadius: l } = e; let h = n / r; t.beginPath(), t.arc(o, a, r, s - h, i + h), l > n ? (h = n / l, t.arc(o, a, l, i + h, s - h, !0)) : t.arc(o, a, n, i + E, s - E), t.closePath(), t.clip() }(t, e, g), o || (qn(t, e, i, s, g, n), t.stroke()) } function Gn(t, e, i = e) { t.lineCap = l(i.borderCapStyle, e.borderCapStyle), t.setLineDash(l(i.borderDash, e.borderDash)), t.lineDashOffset = l(i.borderDashOffset, e.borderDashOffset), t.lineJoin = l(i.borderJoinStyle, e.borderJoinStyle), t.lineWidth = l(i.borderWidth, e.borderWidth), t.strokeStyle = l(i.borderColor, e.borderColor) } function Zn(t, e, i) { t.lineTo(i.x, i.y) } function Jn(t, e, i = {}) { const s = t.length, { start: n = 0, end: o = s - 1 } = i, { start: a, end: r } = e, l = Math.max(n, a), h = Math.min(o, r), c = n < a && o < a || n > r && o > r; return { count: s, start: l, loop: e.loop, ilen: h < l && !c ? s + h - l : h - l } } function Qn(t, e, i, s) { const { points: n, options: o } = e, { count: a, start: r, loop: l, ilen: h } = Jn(n, i, s), c = function (t) { return t.stepped ? Fe : t.tension || "monotone" === t.cubicInterpolationMode ? Ve : Zn }(o); let d, u, f, { move: g = !0, reverse: p } = s || {}; for (d = 0; d <= h; ++d)u = n[(r + (p ? h - d : d)) % a], u.skip || (g ? (t.moveTo(u.x, u.y), g = !1) : c(t, f, u, p, o.stepped), f = u); return l && (u = n[(r + (p ? h : 0)) % a], c(t, f, u, p, o.stepped)), !!l } function to(t, e, i, s) { const n = e.points, { count: o, start: a, ilen: r } = Jn(n, i, s), { move: l = !0, reverse: h } = s || {}; let c, d, u, f, g, p, m = 0, b = 0; const x = t => (a + (h ? r - t : t)) % o, _ = () => { f !== g && (t.lineTo(m, g), t.lineTo(m, f), t.lineTo(m, p)) }; for (l && (d = n[x(0)], t.moveTo(d.x, d.y)), c = 0; c <= r; ++c) { if (d = n[x(c)], d.skip) continue; const e = d.x, i = d.y, s = 0 | e; s === u ? (i < f ? f = i : i > g && (g = i), m = (b * m + e) / ++b) : (_(), t.lineTo(e, i), u = s, b = 0, f = g = i), p = i } _() } function eo(t) { const e = t.options, i = e.borderDash && e.borderDash.length; return !(t._decimated || t._loop || e.tension || "monotone" === e.cubicInterpolationMode || e.stepped || i) ? to : Qn } const io = "function" == typeof Path2D; function so(t, e, i, s) { io && !e.options.segment ? function (t, e, i, s) { let n = e._path; n || (n = e._path = new Path2D, e.path(n, i, s) && n.closePath()), Gn(t, e.options), t.stroke(n) }(t, e, i, s) : function (t, e, i, s) { const { segments: n, options: o } = e, a = eo(e); for (const r of n) Gn(t, o, r.style), t.beginPath(), a(t, e, r, { start: i, end: i + s - 1 }) && t.closePath(), t.stroke() }(t, e, i, s) } class no extends Hs { static id = "line"; static defaults = { borderCapStyle: "butt", borderDash: [], borderDashOffset: 0, borderJoinStyle: "miter", borderWidth: 3, capBezierPoints: !0, cubicInterpolationMode: "default", fill: !1, spanGaps: !1, stepped: !1, tension: 0 }; static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" }; static descriptors = { _scriptable: !0, _indexable: t => "borderDash" !== t && "fill" !== t }; 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 i = this.options; if ((i.tension || "monotone" === i.cubicInterpolationMode) && !i.stepped && !this._pointsUpdated) { const s = i.spanGaps ? this._loop : this._fullLoop; hi(this._points, i, t, s, 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 = zi(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, i = t.length; return i && e[t[i - 1].end] } interpolate(t, e) { const i = this.options, s = t[e], n = this.points, o = Ii(this, { property: e, start: s, end: s }); if (!o.length) return; const a = [], r = function (t) { return t.stepped ? pi : t.tension || "monotone" === t.cubicInterpolationMode ? mi : gi }(i); let l, h; for (l = 0, h = o.length; l < h; ++l) { const { start: h, end: c } = o[l], d = n[h], u = n[c]; if (d === u) { a.push(d); continue } const f = r(d, u, Math.abs((s - d[e]) / (u[e] - d[e])), i.stepped); f[e] = t[e], a.push(f) } return 1 === a.length ? a[0] : a } pathSegment(t, e, i) { return eo(this)(t, this, e, i) } path(t, e, i) { const s = this.segments, n = eo(this); let o = this._loop; e = e || 0, i = i || this.points.length - e; for (const a of s) o &= n(t, this, a, { start: e, end: e + i - 1 }); return !!o } draw(t, e, i, s) { const n = this.options || {}; (this.points || []).length && n.borderWidth && (t.save(), so(t, this, i, s), t.restore()), this.animated && (this._pointsUpdated = !1, this._path = void 0) } } function oo(t, e, i, s) { const n = t.options, { [i]: o } = t.getProps([i], s); return Math.abs(e - o) < n.radius + n.hitRadius } function ao(t, e) { const { x: i, y: s, base: n, width: o, height: a } = t.getProps(["x", "y", "base", "width", "height"], e); let r, l, h, c, d; return t.horizontal ? (d = a / 2, r = Math.min(i, n), l = Math.max(i, n), h = s - d, c = s + d) : (d = o / 2, r = i - d, l = i + d, h = Math.min(s, n), c = Math.max(s, n)), { left: r, top: h, right: l, bottom: c } } function ro(t, e, i, s) { return t ? 0 : J(e, i, s) } function lo(t) { const e = ao(t), i = e.right - e.left, s = e.bottom - e.top, n = function (t, e, i) { const s = t.options.borderWidth, n = t.borderSkipped, o = Mi(s); return { t: ro(n.top, o.top, 0, i), r: ro(n.right, o.right, 0, e), b: ro(n.bottom, o.bottom, 0, i), l: ro(n.left, o.left, 0, e) } }(t, i / 2, s / 2), a = function (t, e, i) { const { enableBorderRadius: s } = t.getProps(["enableBorderRadius"]), n = t.options.borderRadius, a = wi(n), r = Math.min(e, i), l = t.borderSkipped, h = s || o(n); return { topLeft: ro(!h || l.top || l.left, a.topLeft, 0, r), topRight: ro(!h || l.top || l.right, a.topRight, 0, r), bottomLeft: ro(!h || l.bottom || l.left, a.bottomLeft, 0, r), bottomRight: ro(!h || l.bottom || l.right, a.bottomRight, 0, r) } }(t, i / 2, s / 2); return { outer: { x: e.left, y: e.top, w: i, h: s, radius: a }, inner: { x: e.left + n.l, y: e.top + n.t, w: i - n.l - n.r, h: s - n.t - n.b, radius: { topLeft: Math.max(0, a.topLeft - Math.max(n.t, n.l)), topRight: Math.max(0, a.topRight - Math.max(n.t, n.r)), bottomLeft: Math.max(0, a.bottomLeft - Math.max(n.b, n.l)), bottomRight: Math.max(0, a.bottomRight - Math.max(n.b, n.r)) } } } } function ho(t, e, i, s) { const n = null === e, o = null === i, a = t && !(n && o) && ao(t, s); return a && (n || tt(e, a.left, a.right)) && (o || tt(i, a.top, a.bottom)) } function co(t, e) { t.rect(e.x, e.y, e.w, e.h) } function uo(t, e, i = {}) { const s = t.x !== i.x ? -e : 0, n = t.y !== i.y ? -e : 0, o = (t.x + t.w !== i.x + i.w ? e : 0) - s, a = (t.y + t.h !== i.y + i.h ? e : 0) - n; return { x: t.x + s, y: t.y + n, w: t.w + o, h: t.h + a, radius: t.radius } } var fo = Object.freeze({ __proto__: null, ArcElement: class extends Hs { static id = "arc"; static defaults = { borderAlign: "center", borderColor: "#fff", borderDash: [], borderDashOffset: 0, borderJoinStyle: void 0, borderRadius: 0, borderWidth: 2, offset: 0, spacing: 0, angle: void 0, circular: !0 }; static defaultRoutes = { backgroundColor: "backgroundColor" }; static descriptors = { _scriptable: !0, _indexable: t => "borderDash" !== t }; circumference; endAngle; fullCircles; innerRadius; outerRadius; pixelMargin; startAngle; constructor(t) { super(), this.options = void 0, this.circumference = void 0, this.startAngle = void 0, this.endAngle = void 0, this.innerRadius = void 0, this.outerRadius = void 0, this.pixelMargin = 0, this.fullCircles = 0, t && Object.assign(this, t) } inRange(t, e, i) { const s = this.getProps(["x", "y"], i), { angle: n, distance: o } = X(s, { x: t, y: e }), { startAngle: a, endAngle: r, innerRadius: h, outerRadius: c, circumference: d } = this.getProps(["startAngle", "endAngle", "innerRadius", "outerRadius", "circumference"], i), u = (this.options.spacing + this.options.borderWidth) / 2, f = l(d, r - a) >= O || Z(n, a, r), g = tt(o, h + u, c + u); return f && g } getCenterPoint(t) { const { x: e, y: i, startAngle: s, endAngle: n, innerRadius: o, outerRadius: a } = this.getProps(["x", "y", "startAngle", "endAngle", "innerRadius", "outerRadius"], t), { offset: r, spacing: l } = this.options, h = (s + n) / 2, c = (o + a + l + r) / 2; return { x: e + Math.cos(h) * c, y: i + Math.sin(h) * c } } tooltipPosition(t) { return this.getCenterPoint(t) } draw(t) { const { options: e, circumference: i } = this, s = (e.offset || 0) / 4, n = (e.spacing || 0) / 2, o = e.circular; if (this.pixelMargin = "inner" === e.borderAlign ? .33 : 0, this.fullCircles = i > O ? Math.floor(i / O) : 0, 0 === i || this.innerRadius < 0 || this.outerRadius < 0) return; t.save(); const a = (this.startAngle + this.endAngle) / 2; t.translate(Math.cos(a) * s, Math.sin(a) * s); const r = s * (1 - Math.sin(Math.min(C, i || 0))); t.fillStyle = e.backgroundColor, t.strokeStyle = e.borderColor, function (t, e, i, s, n) { const { fullCircles: o, startAngle: a, circumference: r } = e; let l = e.endAngle; if (o) { qn(t, e, i, s, l, n); for (let e = 0; e < o; ++e)t.fill(); isNaN(r) || (l = a + (r % O || O)) } qn(t, e, i, s, l, n), t.fill() }(t, this, r, n, o), Kn(t, this, r, n, o), t.restore() } }, BarElement: class extends Hs { static id = "bar"; static defaults = { borderSkipped: "start", borderWidth: 0, borderRadius: 0, inflateAmount: "auto", pointStyle: void 0 }; static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" }; constructor(t) { super(), this.options = void 0, this.horizontal = void 0, this.base = void 0, this.width = void 0, this.height = void 0, this.inflateAmount = void 0, t && Object.assign(this, t) } draw(t) { const { inflateAmount: e, options: { borderColor: i, backgroundColor: s } } = this, { inner: n, outer: o } = lo(this), a = (r = o.radius).topLeft || r.topRight || r.bottomLeft || r.bottomRight ? He : co; var r; t.save(), o.w === n.w && o.h === n.h || (t.beginPath(), a(t, uo(o, e, n)), t.clip(), a(t, uo(n, -e, o)), t.fillStyle = i, t.fill("evenodd")), t.beginPath(), a(t, uo(n, e)), t.fillStyle = s, t.fill(), t.restore() } inRange(t, e, i) { return ho(this, t, e, i) } inXRange(t, e) { return ho(this, t, null, e) } inYRange(t, e) { return ho(this, null, t, e) } getCenterPoint(t) { const { x: e, y: i, base: s, horizontal: n } = this.getProps(["x", "y", "base", "horizontal"], t); return { x: n ? (e + s) / 2 : e, y: n ? i : (i + s) / 2 } } getRange(t) { return "x" === t ? this.width / 2 : this.height / 2 } }, LineElement: no, PointElement: class extends Hs { static id = "point"; parsed; skip; stop; static defaults = { borderWidth: 1, hitRadius: 1, hoverBorderWidth: 1, hoverRadius: 4, pointStyle: "circle", radius: 3, rotation: 0 }; static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" }; constructor(t) { super(), this.options = void 0, this.parsed = void 0, this.skip = void 0, this.stop = void 0, t && Object.assign(this, t) } inRange(t, e, i) { const s = this.options, { x: n, y: o } = this.getProps(["x", "y"], i); return Math.pow(t - n, 2) + Math.pow(e - o, 2) < Math.pow(s.hitRadius + s.radius, 2) } inXRange(t, e) { return oo(this, t, "x", e) } inYRange(t, e) { return oo(this, t, "y", e) } getCenterPoint(t) { const { x: e, y: i } = this.getProps(["x", "y"], t); return { x: e, y: i } } size(t) { let e = (t = t || this.options || {}).radius || 0; e = Math.max(e, e && t.hoverRadius || 0); return 2 * (e + (e && t.borderWidth || 0)) } draw(t, e) { const i = this.options; this.skip || i.radius < .1 || !Re(this, e, this.size(i) / 2) || (t.strokeStyle = i.borderColor, t.lineWidth = i.borderWidth, t.fillStyle = i.backgroundColor, Le(t, i, this.x, this.y)) } getRange() { const t = this.options || {}; return t.radius + t.hitRadius } } }); function go(t, e, i, s) { const n = t.indexOf(e); if (-1 === n) return ((t, e, i, s) => ("string" == typeof e ? (i = t.push(e) - 1, s.unshift({ index: i, label: e })) : isNaN(e) && (i = null), i))(t, e, i, s); return n !== t.lastIndexOf(e) ? i : n } function po(t) { const e = this.getLabels(); return t >= 0 && t < e.length ? e[t] : t } function mo(t, e, { horizontal: i, minRotation: s }) { const n = $(s), o = (i ? Math.sin(n) : Math.cos(n)) || .001, a = .75 * e * ("" + t).length; return Math.min(e / o, a) } class bo extends Js { 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 s(t) || ("number" == typeof t || t instanceof Number) && !isFinite(+t) ? null : +t } handleTickRangeOptions() { const { beginAtZero: t } = this.options, { minDefined: e, maxDefined: i } = this.getUserBounds(); let { min: s, max: n } = this; const o = t => s = e ? s : t, a = t => n = i ? n : t; if (t) { const t = F(s), e = F(n); t < 0 && e < 0 ? a(0) : t > 0 && e > 0 && o(0) } if (s === n) { let e = 0 === n ? 1 : Math.abs(.05 * n); a(n + e), t || o(s - e) } this.min = s, this.max = n } getTickLimit() { const t = this.options.ticks; let e, { maxTicksLimit: i, stepSize: s } = t; return s ? (e = Math.ceil(this.max / s) - Math.floor(this.min / s) + 1, e > 1e3 && (console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`), e = 1e3)) : (e = this.computeTickLimit(), i = i || 11), i && (e = Math.min(i, e)), e } computeTickLimit() { return Number.POSITIVE_INFINITY } buildTicks() { const t = this.options, e = t.ticks; let i = this.getTickLimit(); i = Math.max(2, i); const n = function (t, e) { const i = [], { bounds: n, step: o, min: a, max: r, precision: l, count: h, maxTicks: c, maxDigits: d, includeBounds: u } = t, f = o || 1, g = c - 1, { min: p, max: m } = e, b = !s(a), x = !s(r), _ = !s(h), y = (m - p) / (d + 1); let v, M, w, k, S = B((m - p) / g / f) * f; if (S < 1e-14 && !b && !x) return [{ value: p }, { value: m }]; k = Math.ceil(m / S) - Math.floor(p / S), k > g && (S = B(k * S / g / f) * f), s(l) || (v = Math.pow(10, l), S = Math.ceil(S * v) / v), "ticks" === n ? (M = Math.floor(p / S) * S, w = Math.ceil(m / S) * S) : (M = p, w = m), b && x && o && H((r - a) / o, S / 1e3) ? (k = Math.round(Math.min((r - a) / S, c)), S = (r - a) / k, M = a, w = r) : _ ? (M = b ? a : M, w = x ? r : w, k = h - 1, S = (w - M) / k) : (k = (w - M) / S, k = V(k, Math.round(k), S / 1e3) ? Math.round(k) : Math.ceil(k)); const P = Math.max(U(S), U(M)); v = Math.pow(10, s(l) ? P : l), M = Math.round(M * v) / v, w = Math.round(w * v) / v; let D = 0; for (b && (u && M !== a ? (i.push({ value: a }), M < a && D++, V(Math.round((M + D * S) * v) / v, a, mo(a, y, t)) && D++) : M < a && D++); D < k; ++D) { const t = Math.round((M + D * S) * v) / v; if (x && t > r) break; i.push({ value: t }) } return x && u && w !== r ? i.length && V(i[i.length - 1].value, r, mo(r, y, t)) ? i[i.length - 1].value = r : i.push({ value: r }) : x && w !== r || i.push({ value: w }), i }({ maxTicks: i, 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: !1 !== e.includeBounds }, this._range || this); return "ticks" === t.bounds && j(n, this, "value"), t.reverse ? (n.reverse(), this.start = this.max, this.end = this.min) : (this.start = this.min, this.end = this.max), n } configure() { const t = this.ticks; let e = this.min, i = this.max; if (super.configure(), this.options.offset && t.length) { const s = (i - e) / Math.max(t.length - 1, 1) / 2; e -= s, i += s } this._startValue = e, this._endValue = i, this._valueRange = i - e } getLabelForValue(t) { return ne(t, this.chart.options.locale, this.options.ticks.format) } } class xo extends bo { static id = "linear"; static defaults = { ticks: { callback: ae.formatters.numeric } }; determineDataLimits() { const { min: t, max: e } = this.getMinMax(!0); this.min = a(t) ? t : 0, this.max = a(e) ? e : 1, this.handleTickRangeOptions() } computeTickLimit() { const t = this.isHorizontal(), e = t ? this.width : this.height, i = $(this.options.ticks.minRotation), s = (t ? Math.sin(i) : Math.cos(i)) || .001, n = this._resolveTickFontOptions(0); return Math.ceil(e / Math.min(40, n.lineHeight / s)) } getPixelForValue(t) { return null === t ? NaN : this.getPixelForDecimal((t - this._startValue) / this._valueRange) } getValueForPixel(t) { return this._startValue + this.getDecimalForPixel(t) * this._valueRange } } const _o = t => Math.floor(z(t)), yo = (t, e) => Math.pow(10, _o(t) + e); function vo(t) { return 1 === t / Math.pow(10, _o(t)) } function Mo(t, e, i) { const s = Math.pow(10, i), n = Math.floor(t / s); return Math.ceil(e / s) - n } function wo(t, { min: e, max: i }) { e = r(t.min, e); const s = [], n = _o(e); let o = function (t, e) { let i = _o(e - t); for (; Mo(t, e, i) > 10;)i++; for (; Mo(t, e, i) < 10;)i--; return Math.min(i, _o(t)) }(e, i), a = o < 0 ? Math.pow(10, Math.abs(o)) : 1; const l = Math.pow(10, o), h = n > o ? Math.pow(10, n) : 0, c = Math.round((e - h) * a) / a, d = Math.floor((e - h) / l / 10) * l * 10; let u = Math.floor((c - d) / Math.pow(10, o)), f = r(t.min, Math.round((h + d + u * Math.pow(10, o)) * a) / a); for (; f < i;)s.push({ value: f, major: vo(f), significand: u }), u >= 10 ? u = u < 15 ? 15 : 20 : u++, u >= 20 && (o++, u = 2, a = o >= 0 ? 1 : a), f = Math.round((h + d + u * Math.pow(10, o)) * a) / a; const g = r(t.max, f); return s.push({ value: g, major: vo(g), significand: u }), s } class ko extends Js { static id = "logarithmic"; static defaults = { ticks: { callback: ae.formatters.logarithmic, major: { enabled: !0 } } }; constructor(t) { super(t), this.start = void 0, this.end = void 0, this._startValue = void 0, this._valueRange = 0 } parse(t, e) { const i = bo.prototype.parse.apply(this, [t, e]); if (0 !== i) return a(i) && i > 0 ? i : null; this._zero = !0 } determineDataLimits() { const { min: t, max: e } = this.getMinMax(!0); this.min = a(t) ? Math.max(0, t) : null, this.max = a(e) ? Math.max(0, e) : null, this.options.beginAtZero && (this._zero = !0), this._zero && this.min !== this._suggestedMin && !a(this._userMin) && (this.min = t === yo(this.min, 0) ? yo(this.min, -1) : yo(this.min, 0)), this.handleTickRangeOptions() } handleTickRangeOptions() { const { minDefined: t, maxDefined: e } = this.getUserBounds(); let i = this.min, s = this.max; const n = e => i = t ? i : e, o = t => s = e ? s : t; i === s && (i <= 0 ? (n(1), o(10)) : (n(yo(i, -1)), o(yo(s, 1)))), i <= 0 && n(yo(s, -1)), s <= 0 && o(yo(i, 1)), this.min = i, this.max = s } buildTicks() { const t = this.options, e = wo({ min: this._userMin, max: this._userMax }, this); return "ticks" === t.bounds && j(e, this, "value"), t.reverse ? (e.reverse(), this.start = this.max, this.end = this.min) : (this.start = this.min, this.end = this.max), e } getLabelForValue(t) { return void 0 === t ? "0" : ne(t, this.chart.options.locale, this.options.ticks.format) } configure() { const t = this.min; super.configure(), this._startValue = z(t), this._valueRange = z(this.max) - z(t) } getPixelForValue(t) { return void 0 !== t && 0 !== t || (t = this.min), null === t || isNaN(t) ? NaN : this.getPixelForDecimal(t === this.min ? 0 : (z(t) - this._startValue) / this._valueRange) } getValueForPixel(t) { const e = this.getDecimalForPixel(t); return Math.pow(10, this._startValue + e * this._valueRange) } } function So(t) { const e = t.ticks; if (e.display && t.display) { const t = ki(e.backdropPadding); return l(e.font && e.font.size, ue.font.size) + t.height } return 0 } function Po(t, e, i, s, n) { return t === s || t === n ? { start: e - i / 2, end: e + i / 2 } : t < s || t > n ? { start: e - i, end: e } : { start: e, end: e + i } } function Do(t) { const e = { l: t.left + t._padding.left, r: t.right - t._padding.right, t: t.top + t._padding.top, b: t.bottom - t._padding.bottom }, i = Object.assign({}, e), s = [], o = [], a = t._pointLabels.length, r = t.options.pointLabels, l = r.centerPointLabels ? C / a : 0; for (let u = 0; u < a; u++) { const a = r.setContext(t.getPointLabelContext(u)); o[u] = a.padding; const f = t.getPointPosition(u, t.drawingArea + o[u], l), g = Si(a.font), p = (h = t.ctx, c = g, d = n(d = t._pointLabels[u]) ? d : [d], { w: Oe(h, c.string, d), h: d.length * c.lineHeight }); s[u] = p; const m = G(t.getIndexAngle(u) + l), b = Math.round(Y(m)); Co(i, e, m, Po(b, f.x, p.w, 0, 180), Po(b, f.y, p.h, 90, 270)) } var h, c, d; t.setCenterPoint(e.l - i.l, i.r - e.r, e.t - i.t, i.b - e.b), t._pointLabelItems = function (t, e, i) { const s = [], n = t._pointLabels.length, o = t.options, { centerPointLabels: a, display: r } = o.pointLabels, l = { extra: So(o) / 2, additionalAngle: a ? C / n : 0 }; let h; for (let o = 0; o < n; o++) { l.padding = i[o], l.size = e[o]; const n = Oo(t, o, l); s.push(n), "auto" === r && (n.visible = Ao(n, h), n.visible && (h = n)) } return s }(t, s, o) } function Co(t, e, i, s, n) { const o = Math.abs(Math.sin(i)), a = Math.abs(Math.cos(i)); let r = 0, l = 0; s.start < e.l ? (r = (e.l - s.start) / o, t.l = Math.min(t.l, e.l - r)) : s.end > e.r && (r = (s.end - e.r) / o, t.r = Math.max(t.r, e.r + r)), n.start < e.t ? (l = (e.t - n.start) / a, t.t = Math.min(t.t, e.t - l)) : n.end > e.b && (l = (n.end - e.b) / a, t.b = Math.max(t.b, e.b + l)) } function Oo(t, e, i) { const s = t.drawingArea, { extra: n, additionalAngle: o, padding: a, size: r } = i, l = t.getPointPosition(e, s + n + a, o), h = Math.round(Y(G(l.angle + E))), c = function (t, e, i) { 90 === i || 270 === i ? t -= e / 2 : (i > 270 || i < 90) && (t -= e); return t }(l.y, r.h, h), d = function (t) { if (0 === t || 180 === t) return "center"; if (t < 180) return "left"; return "right" }(h), u = function (t, e, i) { "right" === i ? t -= e : "center" === i && (t -= e / 2); return t }(l.x, r.w, d); return { visible: !0, x: l.x, y: c, textAlign: d, left: u, top: c, right: u + r.w, bottom: c + r.h } } function Ao(t, e) { if (!e) return !0; const { left: i, top: s, right: n, bottom: o } = t; return !(Re({ x: i, y: s }, e) || Re({ x: i, y: o }, e) || Re({ x: n, y: s }, e) || Re({ x: n, y: o }, e)) } function To(t, e, i) { const { left: n, top: o, right: a, bottom: r } = i, { backdropColor: l } = e; if (!s(l)) { const i = wi(e.borderRadius), s = ki(e.backdropPadding); t.fillStyle = l; const h = n - s.left, c = o - s.top, d = a - n + s.width, u = r - o + s.height; Object.values(i).some((t => 0 !== t)) ? (t.beginPath(), He(t, { x: h, y: c, w: d, h: u, radius: i }), t.fill()) : t.fillRect(h, c, d, u) } } function Lo(t, e, i, s) { const { ctx: n } = t; if (i) n.arc(t.xCenter, t.yCenter, e, 0, O); else { let i = t.getPointPosition(0, e); n.moveTo(i.x, i.y); for (let o = 1; o < s; o++)i = t.getPointPosition(o, e), n.lineTo(i.x, i.y) } } class Eo extends bo { static id = "radialLinear"; static defaults = { display: !0, animate: !0, position: "chartArea", angleLines: { display: !0, lineWidth: 1, borderDash: [], borderDashOffset: 0 }, grid: { circular: !1 }, startAngle: 0, ticks: { showLabelBackdrop: !0, callback: ae.formatters.numeric }, pointLabels: { backdropColor: void 0, backdropPadding: 2, display: !0, font: { size: 10 }, callback: t => t, padding: 5, centerPointLabels: !1 } }; static defaultRoutes = { "angleLines.color": "borderColor", "pointLabels.color": "color", "ticks.color": "color" }; static descriptors = { angleLines: { _fallback: "grid" } }; constructor(t) { super(t), this.xCenter = void 0, this.yCenter = void 0, this.drawingArea = void 0, this._pointLabels = [], this._pointLabelItems = [] } setDimensions() { const t = this._padding = ki(So(this.options) / 2), e = this.width = this.maxWidth - t.width, i = this.height = this.maxHeight - t.height; this.xCenter = Math.floor(this.left + e / 2 + t.left), this.yCenter = Math.floor(this.top + i / 2 + t.top), this.drawingArea = Math.floor(Math.min(e, i) / 2) } determineDataLimits() { const { min: t, max: e } = this.getMinMax(!1); this.min = a(t) && !isNaN(t) ? t : 0, this.max = a(e) && !isNaN(e) ? e : 0, this.handleTickRangeOptions() } computeTickLimit() { return Math.ceil(this.drawingArea / So(this.options)) } generateTickLabels(t) { bo.prototype.generateTickLabels.call(this, t), this._pointLabels = this.getLabels().map(((t, e) => { const i = d(this.options.pointLabels.callback, [t, e], this); return i || 0 === i ? i : "" })).filter(((t, e) => this.chart.getDataVisibility(e))) } fit() { const t = this.options; t.display && t.pointLabels.display ? Do(this) : this.setCenterPoint(0, 0, 0, 0) } setCenterPoint(t, e, i, s) { this.xCenter += Math.floor((t - e) / 2), this.yCenter += Math.floor((i - s) / 2), this.drawingArea -= Math.min(this.drawingArea / 2, Math.max(t, e, i, s)) } getIndexAngle(t) { return G(t * (O / (this._pointLabels.length || 1)) + $(this.options.startAngle || 0)) } getDistanceFromCenterForValue(t) { if (s(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 (s(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 < e.length) { const i = e[t]; return function (t, e, i) { return Ci(t, { label: i, index: e, type: "pointLabel" }) }(this.getContext(), t, i) } } getPointPosition(t, e, i = 0) { const s = this.getIndexAngle(t) - E + i; return { x: Math.cos(s) * e + this.xCenter, y: Math.sin(s) * e + this.yCenter, angle: s } } getPointPositionForValue(t, e) { return this.getPointPosition(t, this.getDistanceFromCenterForValue(e)) } getBasePosition(t) { return this.getPointPositionForValue(t || 0, this.getBaseValue()) } getPointLabelPosition(t) { const { left: e, top: i, right: s, bottom: n } = this._pointLabelItems[t]; return { left: e, top: i, right: s, bottom: n } } drawBackground() { const { backgroundColor: t, grid: { circular: e } } = this.options; if (t) { const i = this.ctx; i.save(), i.beginPath(), Lo(this, this.getDistanceFromCenterForValue(this._endValue), e, this._pointLabels.length), i.closePath(), i.fillStyle = t, i.fill(), i.restore() } } drawGrid() { const t = this.ctx, e = this.options, { angleLines: i, grid: s, border: n } = e, o = this._pointLabels.length; let a, r, l; if (e.pointLabels.display && function (t, e) { const { ctx: i, options: { pointLabels: s } } = t; for (let n = e - 1; n >= 0; n--) { const e = t._pointLabelItems[n]; if (!e.visible) continue; const o = s.setContext(t.getPointLabelContext(n)); To(i, o, e); const a = Si(o.font), { x: r, y: l, textAlign: h } = e; Ne(i, t._pointLabels[n], r, l + a.lineHeight / 2, a, { color: o.color, textAlign: h, textBaseline: "middle" }) } }(this, o), s.display && this.ticks.forEach(((t, e) => { if (0 !== e) { r = this.getDistanceFromCenterForValue(t.value); const i = this.getContext(e), a = s.setContext(i), l = n.setContext(i); !function (t, e, i, s, n) { const o = t.ctx, a = e.circular, { color: r, lineWidth: l } = e; !a && !s || !r || !l || i < 0 || (o.save(), o.strokeStyle = r, o.lineWidth = l, o.setLineDash(n.dash), o.lineDashOffset = n.dashOffset, o.beginPath(), Lo(t, i, a, s), o.closePath(), o.stroke(), o.restore()) }(this, a, r, o, l) } })), i.display) { for (t.save(), a = o - 1; a >= 0; a--) { const s = i.setContext(this.getPointLabelContext(a)), { color: n, lineWidth: o } = s; o && n && (t.lineWidth = o, t.strokeStyle = n, t.setLineDash(s.borderDash), t.lineDashOffset = s.borderDashOffset, r = this.getDistanceFromCenterForValue(e.ticks.reverse ? this.min : this.max), l = this.getPointPosition(a, r), t.beginPath(), t.moveTo(this.xCenter, this.yCenter), t.lineTo(l.x, l.y), t.stroke()) } t.restore() } } drawBorder() { } drawLabels() { const t = this.ctx, e = this.options, i = e.ticks; if (!i.display) return; const s = this.getIndexAngle(0); let n, o; t.save(), t.translate(this.xCenter, this.yCenter), t.rotate(s), t.textAlign = "center", t.textBaseline = "middle", this.ticks.forEach(((s, a) => { if (0 === a && !e.reverse) return; const r = i.setContext(this.getContext(a)), l = Si(r.font); if (n = this.getDistanceFromCenterForValue(this.ticks[a].value), r.showLabelBackdrop) { t.font = l.string, o = t.measureText(s.label).width, t.fillStyle = r.backdropColor; const e = ki(r.backdropPadding); t.fillRect(-o / 2 - e.left, -n - l.size / 2 - e.top, o + e.width, l.size + e.height) } Ne(t, s.label, 0, -n, l, { color: r.color, strokeColor: r.textStrokeColor, strokeWidth: r.textStrokeWidth }) })), t.restore() } drawTitle() { } } const Ro = { 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 } }, Io = Object.keys(Ro); function zo(t, e) { return t - e } function Fo(t, e) { if (s(e)) return null; const i = t._adapter, { parser: n, round: o, isoWeekday: r } = t._parseOpts; let l = e; return "function" == typeof n && (l = n(l)), a(l) || (l = "string" == typeof n ? i.parse(l, n) : i.parse(l)), null === l ? null : (o && (l = "week" !== o || !N(r) && !0 !== r ? i.startOf(l, o) : i.startOf(l, "isoWeek", r)), +l) } function Vo(t, e, i, s) { const n = Io.length; for (let o = Io.indexOf(t); o < n - 1; ++o) { const t = Ro[Io[o]], n = t.steps ? t.steps : Number.MAX_SAFE_INTEGER; if (t.common && Math.ceil((i - e) / (n * t.size)) <= s) return Io[o] } return Io[n - 1] } function Bo(t, e, i) { if (i) { if (i.length) { const { lo: s, hi: n } = et(i, e); t[i[s] >= e ? i[s] : i[n]] = !0 } } else t[e] = !0 } function Wo(t, e, i) { const s = [], n = {}, o = e.length; let a, r; for (a = 0; a < o; ++a)r = e[a], n[r] = a, s.push({ value: r, major: !1 }); return 0 !== o && i ? function (t, e, i, s) { const n = t._adapter, o = +n.startOf(e[0].value, s), a = e[e.length - 1].value; let r, l; for (r = o; r <= a; r = +n.add(r, 1, s))l = i[r], l >= 0 && (e[l].major = !0); return e }(t, s, n, i) : s } class No extends Js { static id = "time"; static defaults = { bounds: "data", adapters: {}, time: { parser: !1, unit: !1, round: !1, isoWeekday: !1, minUnit: "millisecond", displayFormats: {} }, ticks: { source: "auto", callback: !1, major: { enabled: !1 } } }; constructor(t) { super(t), this._cache = { data: [], labels: [], all: [] }, this._unit = "day", this._majorUnit = void 0, this._offsets = {}, this._normalized = !1, this._parseOpts = void 0 } init(t, e = {}) { const i = t.time || (t.time = {}), s = this._adapter = new Rn._date(t.adapters.date); s.init(e), x(i.displayFormats, s.formats()), this._parseOpts = { parser: i.parser, round: i.round, isoWeekday: i.isoWeekday }, super.init(t), this._normalized = e.normalized } parse(t, e) { return void 0 === t ? null : Fo(this, t) } beforeLayout() { super.beforeLayout(), this._cache = { data: [], labels: [], all: [] } } determineDataLimits() { const t = this.options, e = this._adapter, i = t.time.unit || "day"; let { min: s, max: n, minDefined: o, maxDefined: r } = this.getUserBounds(); function l(t) { o || isNaN(t.min) || (s = Math.min(s, t.min)), r || isNaN(t.max) || (n = Math.max(n, t.max)) } o && r || (l(this._getLabelBounds()), "ticks" === t.bounds && "labels" === t.ticks.source || l(this.getMinMax(!1))), s = a(s) && !isNaN(s) ? s : +e.startOf(Date.now(), i), n = a(n) && !isNaN(n) ? n : +e.endOf(Date.now(), i) + 1, this.min = Math.min(s, n - 1), this.max = Math.max(s + 1, n) } _getLabelBounds() { const t = this.getLabelTimestamps(); let e = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY; return t.length && (e = t[0], i = t[t.length - 1]), { min: e, max: i } } buildTicks() { const t = this.options, e = t.time, i = t.ticks, s = "labels" === i.source ? this.getLabelTimestamps() : this._generate(); "ticks" === t.bounds && s.length && (this.min = this._userMin || s[0], this.max = this._userMax || s[s.length - 1]); const n = this.min, o = nt(s, n, this.max); return this._unit = e.unit || (i.autoSkip ? Vo(e.minUnit, this.min, this.max, this._getLabelCapacity(n)) : function (t, e, i, s, n) { for (let o = Io.length - 1; o >= Io.indexOf(i); o--) { const i = Io[o]; if (Ro[i].common && t._adapter.diff(n, s, i) >= e - 1) return i } return Io[i ? Io.indexOf(i) : 0] }(this, o.length, e.minUnit, this.min, this.max)), this._majorUnit = i.major.enabled && "year" !== this._unit ? function (t) { for (let e = Io.indexOf(t) + 1, i = Io.length; e < i; ++e)if (Ro[Io[e]].common) return Io[e] }(this._unit) : void 0, this.initOffsets(s), t.reverse && o.reverse(), Wo(this, o, this._majorUnit) } afterAutoSkip() { this.options.offsetAfterAutoskip && this.initOffsets(this.ticks.map((t => +t.value))) } initOffsets(t = []) { let e, i, s = 0, n = 0; this.options.offset && t.length && (e = this.getDecimalForValue(t[0]), s = 1 === t.length ? 1 - e : (this.getDecimalForValue(t[1]) - e) / 2, i = this.getDecimalForValue(t[t.length - 1]), n = 1 === t.length ? i : (i - this.getDecimalForValue(t[t.length - 2])) / 2); const o = t.length < 3 ? .5 : .25; s = J(s, 0, o), n = J(n, 0, o), this._offsets = { start: s, end: n, factor: 1 / (s + 1 + n) } } _generate() { const t = this._adapter, e = this.min, i = this.max, s = this.options, n = s.time, o = n.unit || Vo(n.minUnit, e, i, this._getLabelCapacity(e)), a = l(s.ticks.stepSize, 1), r = "week" === o && n.isoWeekday, h = N(r) || !0 === r, c = {}; let d, u, f = e; if (h && (f = +t.startOf(f, "isoWeek", r)), f = +t.startOf(f, h ? "day" : o), t.diff(i, e, o) > 1e5 * a) throw new Error(e + " and " + i + " are too far apart with stepSize of " + a + " " + o); const g = "data" === s.ticks.source && this.getDataTimestamps(); for (d = f, u = 0; d < i; d = +t.add(d, a, o), u++)Bo(c, d, g); return d !== i && "ticks" !== s.bounds && 1 !== u || Bo(c, d, g), Object.keys(c).sort(zo).map((t => +t)) } getLabelForValue(t) { const e = this._adapter, i = this.options.time; return i.tooltipFormat ? e.format(t, i.tooltipFormat) : e.format(t, i.displayFormats.datetime) } format(t, e) { const i = this.options.time.displayFormats, s = this._unit, n = e || i[s]; return this._adapter.format(t, n) } _tickFormatFunction(t, e, i, s) { const n = this.options, o = n.ticks.callback; if (o) return d(o, [t, e, i], this); const a = n.time.displayFormats, r = this._unit, l = this._majorUnit, h = r && a[r], c = l && a[l], u = i[e], f = l && c && u && u.major; return this._adapter.format(t, s || (f ? c : h)) } generateTickLabels(t) { let e, i, s; for (e = 0, i = t.length; e < i; ++e)s = t[e], s.label = this._tickFormatFunction(s.value, e, t) } getDecimalForValue(t) { return null === t ? NaN : (t - this.min) / (this.max - this.min) } getPixelForValue(t) { const e = this._offsets, i = this.getDecimalForValue(t); return this.getPixelForDecimal((e.start + i) * e.factor) } getValueForPixel(t) { const e = this._offsets, i = this.getDecimalForPixel(t) / e.factor - e.end; return this.min + i * (this.max - this.min) } _getLabelSize(t) { const e = this.options.ticks, i = this.ctx.measureText(t).width, s = $(this.isHorizontal() ? e.maxRotation : e.minRotation), n = Math.cos(s), o = Math.sin(s), a = this._resolveTickFontOptions(0).size; return { w: i * n + a * o, h: i * o + a * n } } _getLabelCapacity(t) { const e = this.options.time, i = e.displayFormats, s = i[e.unit] || i.millisecond, n = this._tickFormatFunction(t, 0, Wo(this, [t], this._majorUnit), s), o = this._getLabelSize(n), a = Math.floor(this.isHorizontal() ? this.width / o.w : this.height / o.h) - 1; return a > 0 ? a : 1 } getDataTimestamps() { let t, e, i = this._cache.data || []; if (i.length) return i; const s = this.getMatchingVisibleMetas(); if (this._normalized && s.length) return this._cache.data = s[0].controller.getAllParsedValues(this); for (t = 0, e = s.length; t < e; ++t)i = i.concat(s[t].controller.getAllParsedValues(this)); return this._cache.data = this.normalize(i) } getLabelTimestamps() { const t = this._cache.labels || []; let e, i; if (t.length) return t; const s = this.getLabels(); for (e = 0, i = s.length; e < i; ++e)t.push(Fo(this, s[e])); return this._cache.labels = this._normalized ? t : this.normalize(t) } normalize(t) { return lt(t.sort(zo)) } } function Ho(t, e, i) { let s, n, o, a, r = 0, l = t.length - 1; i ? (e >= t[r].pos && e <= t[l].pos && ({ lo: r, hi: l } = it(t, "pos", e)), ({ pos: s, time: o } = t[r]), ({ pos: n, time: a } = t[l])) : (e >= t[r].time && e <= t[l].time && ({ lo: r, hi: l } = it(t, "time", e)), ({ time: s, pos: o } = t[r]), ({ time: n, pos: a } = t[l])); const h = n - s; return h ? o + (a - o) * (e - s) / h : o } var jo = Object.freeze({ __proto__: null, CategoryScale: class extends Js { static id = "category"; static defaults = { ticks: { callback: po } }; constructor(t) { super(t), this._startValue = void 0, this._valueRange = 0, this._addedLabels = [] } init(t) { const e = this._addedLabels; if (e.length) { const t = this.getLabels(); for (const { index: i, label: s } of e) t[i] === s && t.splice(i, 1); this._addedLabels = [] } super.init(t) } parse(t, e) { if (s(t)) return null; const i = this.getLabels(); return ((t, e) => null === t ? null : J(Math.round(t), 0, e))(e = isFinite(e) && i[e] === t ? e : go(i, t, l(e, t), this._addedLabels), i.length - 1) } determineDataLimits() { const { minDefined: t, maxDefined: e } = this.getUserBounds(); let { min: i, max: s } = this.getMinMax(!0); "ticks" === this.options.bounds && (t || (i = 0), e || (s = this.getLabels().length - 1)), this.min = i, this.max = s } buildTicks() { const t = this.min, e = this.max, i = this.options.offset, s = []; let n = this.getLabels(); n = 0 === t && e === n.length - 1 ? n : n.slice(t, e + 1), this._valueRange = Math.max(n.length - (i ? 0 : 1), 1), this._startValue = this.min - (i ? .5 : 0); for (let i = t; i <= e; i++)s.push({ value: i }); return s } getLabelForValue(t) { return po.call(this, t) } configure() { super.configure(), this.isHorizontal() || (this._reversePixels = !this._reversePixels) } getPixelForValue(t) { return "number" != typeof t && (t = this.parse(t)), null === t ? NaN : this.getPixelForDecimal((t - this._startValue) / this._valueRange) } getPixelForTick(t) { const e = this.ticks; return t < 0 || t > e.length - 1 ? null : this.getPixelForValue(e[t].value) } getValueForPixel(t) { return Math.round(this._startValue + this.getDecimalForPixel(t) * this._valueRange) } getBasePixel() { return this.bottom } }, LinearScale: xo, LogarithmicScale: ko, RadialLinearScale: Eo, TimeScale: No, TimeSeriesScale: class extends No { static id = "timeseries"; static defaults = No.defaults; 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 = Ho(e, this.min), this._tableRange = Ho(e, this.max) - this._minPos, super.initOffsets(t) } buildLookupTable(t) { const { min: e, max: i } = this, s = [], n = []; let o, a, r, l, h; for (o = 0, a = t.length; o < a; ++o)l = t[o], l >= e && l <= i && s.push(l); if (s.length < 2) return [{ time: e, pos: 0 }, { time: i, pos: 1 }]; for (o = 0, a = s.length; o < a; ++o)h = s[o + 1], r = s[o - 1], l = s[o], Math.round((h + r) / 2) !== l && n.push({ time: l, pos: o / (a - 1) }); return n } _generate() { const t = this.min, e = this.max; let i = super.getDataTimestamps(); return i.includes(t) && i.length || i.splice(0, 0, t), i.includes(e) && 1 !== i.length || i.push(e), i.sort(((t, e) => t - e)) } _getTimestampsForTable() { let t = this._cache.all || []; if (t.length) return t; const e = this.getDataTimestamps(), i = this.getLabelTimestamps(); return t = e.length && i.length ? this.normalize(e.concat(i)) : e.length ? e : i, t = this._cache.all = t, t } getDecimalForValue(t) { return (Ho(this._table, t) - this._minPos) / this._tableRange } getValueForPixel(t) { const e = this._offsets, i = this.getDecimalForPixel(t) / e.factor - e.end; return Ho(this._table, i * this._tableRange + this._minPos, !0) } } }); const $o = ["rgb(54, 162, 235)", "rgb(255, 99, 132)", "rgb(255, 159, 64)", "rgb(255, 205, 86)", "rgb(75, 192, 192)", "rgb(153, 102, 255)", "rgb(201, 203, 207)"], Yo = $o.map((t => t.replace("rgb(", "rgba(").replace(")", ", 0.5)"))); function Uo(t) { return $o[t % $o.length] } function Xo(t) { return Yo[t % Yo.length] } function qo(t) { let e = 0; return (i, s) => { const n = t.getDatasetMeta(s).controller; n instanceof jn ? e = function (t, e) { return t.backgroundColor = t.data.map((() => Uo(e++))), e }(i, e) : n instanceof $n ? e = function (t, e) { return t.backgroundColor = t.data.map((() => Xo(e++))), e }(i, e) : n && (e = function (t, e) { return t.borderColor = Uo(e), t.backgroundColor = Xo(e), ++e }(i, e)) } } function Ko(t) { let e; for (e in t) if (t[e].borderColor || t[e].backgroundColor) return !0; return !1 } var Go = { id: "colors", defaults: { enabled: !0, forceOverride: !1 }, beforeLayout(t, e, i) { if (!i.enabled) return; const { data: { datasets: s }, options: n } = t.config, { elements: o } = n; if (!i.forceOverride && (Ko(s) || (a = n) && (a.borderColor || a.backgroundColor) || o && Ko(o))) return; var a; const r = qo(t); s.forEach(r) } }; function Zo(t) { if (t._decimated) { const e = t._data; delete t._decimated, delete t._data, Object.defineProperty(t, "data", { configurable: !0, enumerable: !0, writable: !0, value: e }) } } function Jo(t) { t.data.datasets.forEach((t => { Zo(t) })) } var Qo = { id: "decimation", defaults: { algorithm: "min-max", enabled: !1 }, beforeElementsUpdate: (t, e, i) => { if (!i.enabled) return void Jo(t); const n = t.width; t.data.datasets.forEach(((e, o) => { const { _data: a, indexAxis: r } = e, l = t.getDatasetMeta(o), h = a || e.data; if ("y" === Pi([r, t.options.indexAxis])) return; if (!l.controller.supportsDecimation) return; const c = t.scales[l.xAxisID]; if ("linear" !== c.type && "time" !== c.type) return; if (t.options.parsing) return; let { start: d, count: u } = function (t, e) { const i = e.length; let s, n = 0; const { iScale: o } = t, { min: a, max: r, minDefined: l, maxDefined: h } = o.getUserBounds(); return l && (n = J(it(e, o.axis, a).lo, 0, i - 1)), s = h ? J(it(e, o.axis, r).hi + 1, n, i) - n : i - n, { start: n, count: s } }(l, h); if (u <= (i.threshold || 4 * n)) return void Zo(e); let f; switch (s(a) && (e._data = h, delete e.data, Object.defineProperty(e, "data", { configurable: !0, enumerable: !0, get: function () { return this._decimated }, set: function (t) { this._data = t } })), i.algorithm) { case "lttb": f = function (t, e, i, s, n) { const o = n.samples || s; if (o >= i) return t.slice(e, e + i); const a = [], r = (i - 2) / (o - 2); let l = 0; const h = e + i - 1; let c, d, u, f, g, p = e; for (a[l++] = t[p], c = 0; c < o - 2; c++) { let s, n = 0, o = 0; const h = Math.floor((c + 1) * r) + 1 + e, m = Math.min(Math.floor((c + 2) * r) + 1, i) + e, b = m - h; for (s = h; s < m; s++)n += t[s].x, o += t[s].y; n /= b, o /= b; const x = Math.floor(c * r) + 1 + e, _ = Math.min(Math.floor((c + 1) * r) + 1, i) + e, { x: y, y: v } = t[p]; for (u = f = -1, s = x; s < _; s++)f = .5 * Math.abs((y - n) * (t[s].y - v) - (y - t[s].x) * (o - v)), f > u && (u = f, d = t[s], g = s); a[l++] = d, p = g } return a[l++] = t[h], a }(h, d, u, n, i); break; case "min-max": f = function (t, e, i, n) { let o, a, r, l, h, c, d, u, f, g, p = 0, m = 0; const b = [], x = e + i - 1, _ = t[e].x, y = t[x].x - _; for (o = e; o < e + i; ++o) { a = t[o], r = (a.x - _) / y * n, l = a.y; const e = 0 | r; if (e === h) l < f ? (f = l, c = o) : l > g && (g = l, d = o), p = (m * p + a.x) / ++m; else { const i = o - 1; if (!s(c) && !s(d)) { const e = Math.min(c, d), s = Math.max(c, d); e !== u && e !== i && b.push({ ...t[e], x: p }), s !== u && s !== i && b.push({ ...t[s], x: p }) } o > 0 && i !== u && b.push(t[i]), b.push(a), h = e, m = 0, f = g = l, c = d = u = o } } return b }(h, d, u, n); break; default: throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`) }e._decimated = f })) }, destroy(t) { Jo(t) } }; function ta(t, e, i, s) { if (s) return; let n = e[t], o = i[t]; return "angle" === t && (n = G(n), o = G(o)), { property: t, start: n, end: o } } function ea(t, e, i) { for (; e > t; e--) { const t = i[e]; if (!isNaN(t.x) && !isNaN(t.y)) break } return e } function ia(t, e, i, s) { return t && e ? s(t[i], e[i]) : t ? t[i] : e ? e[i] : 0 } function sa(t, e) { let i = [], s = !1; return n(t) ? (s = !0, i = t) : i = function (t, e) { const { x: i = null, y: s = null } = t || {}, n = e.points, o = []; return e.segments.forEach((({ start: t, end: e }) => { e = ea(t, e, n); const a = n[t], r = n[e]; null !== s ? (o.push({ x: a.x, y: s }), o.push({ x: r.x, y: s })) : null !== i && (o.push({ x: i, y: a.y }), o.push({ x: i, y: r.y })) })), o }(t, e), i.length ? new no({ points: i, options: { tension: 0 }, _loop: s, _fullLoop: s }) : null } function na(t) { return t && !1 !== t.fill } function oa(t, e, i) { let s = t[e].fill; const n = [e]; let o; if (!i) return s; for (; !1 !== s && -1 === n.indexOf(s);) { if (!a(s)) return s; if (o = t[s], !o) return !1; if (o.visible) return s; n.push(s), s = o.fill } return !1 } function aa(t, e, i) { const s = function (t) { const e = t.options, i = e.fill; let s = l(i && i.target, i); void 0 === s && (s = !!e.backgroundColor); if (!1 === s || null === s) return !1; if (!0 === s) return "origin"; return s }(t); if (o(s)) return !isNaN(s.value) && s; let n = parseFloat(s); return a(n) && Math.floor(n) === n ? function (t, e, i, s) { "-" !== t && "+" !== t || (i = e + i); if (i === e || i < 0 || i >= s) return !1; return i }(s[0], e, n, i) : ["origin", "start", "end", "stack", "shape"].indexOf(s) >= 0 && s } function ra(t, e, i) { const s = []; for (let n = 0; n < i.length; n++) { const o = i[n], { first: a, last: r, point: l } = la(o, e, "x"); if (!(!l || a && r)) if (a) s.unshift(l); else if (t.push(l), !r) break } t.push(...s) } function la(t, e, i) { const s = t.interpolate(e, i); if (!s) return {}; const n = s[i], o = t.segments, a = t.points; let r = !1, l = !1; for (let t = 0; t < o.length; t++) { const e = o[t], s = a[e.start][i], h = a[e.end][i]; if (tt(n, s, h)) { r = n === s, l = n === h; break } } return { first: r, last: l, point: s } } class ha { constructor(t) { this.x = t.x, this.y = t.y, this.radius = t.radius } pathSegment(t, e, i) { const { x: s, y: n, radius: o } = this; return e = e || { start: 0, end: O }, t.arc(s, n, o, e.end, e.start, !0), !i.bounds } interpolate(t) { const { x: e, y: i, radius: s } = this, n = t.angle; return { x: e + Math.cos(n) * s, y: i + Math.sin(n) * s, angle: n } } } function ca(t) { const { chart: e, fill: i, line: s } = t; if (a(i)) return function (t, e) { const i = t.getDatasetMeta(e), s = i && t.isDatasetVisible(e); return s ? i.dataset : null }(e, i); if ("stack" === i) return function (t) { const { scale: e, index: i, line: s } = t, n = [], o = s.segments, a = s.points, r = function (t, e) { const i = [], s = t.getMatchingVisibleMetas("line"); for (let t = 0; t < s.length; t++) { const n = s[t]; if (n.index === e) break; n.hidden || i.unshift(n.dataset) } return i }(e, i); r.push(sa({ x: null, y: e.bottom }, s)); for (let t = 0; t < o.length; t++) { const e = o[t]; for (let t = e.start; t <= e.end; t++)ra(n, a[t], r) } return new no({ points: n, options: {} }) }(t); if ("shape" === i) return !0; const n = function (t) { const e = t.scale || {}; if (e.getPointPositionForValue) return function (t) { const { scale: e, fill: i } = t, s = e.options, n = e.getLabels().length, a = s.reverse ? e.max : e.min, r = function (t, e, i) { let s; return s = "start" === t ? i : "end" === t ? e.options.reverse ? e.min : e.max : o(t) ? t.value : e.getBaseValue(), s }(i, e, a), l = []; if (s.grid.circular) { const t = e.getPointPositionForValue(0, a); return new ha({ x: t.x, y: t.y, radius: e.getDistanceFromCenterForValue(r) }) } for (let t = 0; t < n; ++t)l.push(e.getPointPositionForValue(t, r)); return l }(t); return function (t) { const { scale: e = {}, fill: i } = t, s = function (t, e) { let i = null; return "start" === t ? i = e.bottom : "end" === t ? i = e.top : o(t) ? i = e.getPixelForValue(t.value) : e.getBasePixel && (i = e.getBasePixel()), i }(i, e); if (a(s)) { const t = e.isHorizontal(); return { x: t ? s : null, y: t ? null : s } } return null }(t) }(t); return n instanceof ha ? n : sa(n, s) } function da(t, e, i) { const s = ca(e), { line: n, scale: o, axis: a } = e, r = n.options, l = r.fill, h = r.backgroundColor, { above: c = h, below: d = h } = l || {}; s && n.points.length && (Ie(t, i), function (t, e) { const { line: i, target: s, above: n, below: o, area: a, scale: r } = e, l = i._loop ? "angle" : e.axis; t.save(), "x" === l && o !== n && (ua(t, s, a.top), fa(t, { line: i, target: s, color: n, scale: r, property: l }), t.restore(), t.save(), ua(t, s, a.bottom)); fa(t, { line: i, target: s, color: o, scale: r, property: l }), t.restore() }(t, { line: n, target: s, above: c, below: d, area: i, scale: o, axis: a }), ze(t)) } function ua(t, e, i) { const { segments: s, points: n } = e; let o = !0, a = !1; t.beginPath(); for (const r of s) { const { start: s, end: l } = r, h = n[s], c = n[ea(s, l, n)]; o ? (t.moveTo(h.x, h.y), o = !1) : (t.lineTo(h.x, i), t.lineTo(h.x, h.y)), a = !!e.pathSegment(t, r, { move: a }), a ? t.closePath() : t.lineTo(c.x, i) } t.lineTo(e.first().x, i), t.closePath(), t.clip() } function fa(t, e) { const { line: i, target: s, property: n, color: o, scale: a } = e, r = function (t, e, i) { const s = t.segments, n = t.points, o = e.points, a = []; for (const t of s) { let { start: s, end: r } = t; r = ea(s, r, n); const l = ta(i, n[s], n[r], t.loop); if (!e.segments) { a.push({ source: t, target: l, start: n[s], end: n[r] }); continue } const h = Ii(e, l); for (const e of h) { const s = ta(i, o[e.start], o[e.end], e.loop), r = Ri(t, n, s); for (const t of r) a.push({ source: t, target: e, start: { [i]: ia(l, s, "start", Math.max) }, end: { [i]: ia(l, s, "end", Math.min) } }) } } return a }(i, s, n); for (const { source: e, target: l, start: h, end: c } of r) { const { style: { backgroundColor: r = o } = {} } = e, d = !0 !== s; t.save(), t.fillStyle = r, ga(t, a, d && ta(n, h, c)), t.beginPath(); const u = !!i.pathSegment(t, e); let f; if (d) { u ? t.closePath() : pa(t, s, c, n); const e = !!s.pathSegment(t, l, { move: u, reverse: !0 }); f = u && e, f || pa(t, s, h, n) } t.closePath(), t.fill(f ? "evenodd" : "nonzero"), t.restore() } } function ga(t, e, i) { const { top: s, bottom: n } = e.chart.chartArea, { property: o, start: a, end: r } = i || {}; "x" === o && (t.beginPath(), t.rect(a, s, r - a, n - s), t.clip()) } function pa(t, e, i, s) { const n = e.interpolate(i, s); n && t.lineTo(n.x, n.y) } var ma = { id: "filler", afterDatasetsUpdate(t, e, i) { const s = (t.data.datasets || []).length, n = []; let o, a, r, l; for (a = 0; a < s; ++a)o = t.getDatasetMeta(a), r = o.dataset, l = null, r && r.options && r instanceof no && (l = { visible: t.isDatasetVisible(a), index: a, fill: aa(r, a, s), chart: t, axis: o.controller.options.indexAxis, scale: o.vScale, line: r }), o.$filler = l, n.push(l); for (a = 0; a < s; ++a)l = n[a], l && !1 !== l.fill && (l.fill = oa(n, a, i.propagate)) }, beforeDraw(t, e, i) { const s = "beforeDraw" === i.drawTime, n = t.getSortedVisibleDatasetMetas(), o = t.chartArea; for (let e = n.length - 1; e >= 0; --e) { const i = n[e].$filler; i && (i.line.updateControlPoints(o, i.axis), s && i.fill && da(t.ctx, i, o)) } }, beforeDatasetsDraw(t, e, i) { if ("beforeDatasetsDraw" !== i.drawTime) return; const s = t.getSortedVisibleDatasetMetas(); for (let e = s.length - 1; e >= 0; --e) { const i = s[e].$filler; na(i) && da(t.ctx, i, t.chartArea) } }, beforeDatasetDraw(t, e, i) { const s = e.meta.$filler; na(s) && "beforeDatasetDraw" === i.drawTime && da(t.ctx, s, t.chartArea) }, defaults: { propagate: !0, drawTime: "beforeDatasetDraw" } }; const ba = (t, e) => { let { boxHeight: i = e, boxWidth: s = e } = t; return t.usePointStyle && (i = Math.min(i, e), s = t.pointStyleWidth || Math.min(s, e)), { boxWidth: s, boxHeight: i, itemHeight: Math.max(e, i) } }; class xa extends Hs { 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, i) { this.maxWidth = t, this.maxHeight = e, this._margins = i, 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 = d(t.generateLabels, [this.chart], this) || []; t.filter && (e = e.filter((e => t.filter(e, this.chart.data)))), t.sort && (e = e.sort(((e, i) => t.sort(e, i, this.chart.data)))), this.options.reverse && e.reverse(), this.legendItems = e } fit() { const { options: t, ctx: e } = this; if (!t.display) return void (this.width = this.height = 0); const i = t.labels, s = Si(i.font), n = s.size, o = this._computeTitleHeight(), { boxWidth: a, itemHeight: r } = ba(i, n); let l, h; e.font = s.string, this.isHorizontal() ? (l = this.maxWidth, h = this._fitRows(o, n, a, r) + 10) : (h = this.maxHeight, l = this._fitCols(o, s, a, r) + 10), this.width = Math.min(l, t.maxWidth || this.maxWidth), this.height = Math.min(h, t.maxHeight || this.maxHeight) } _fitRows(t, e, i, s) { const { ctx: n, maxWidth: o, options: { labels: { padding: a } } } = this, r = this.legendHitBoxes = [], l = this.lineWidths = [0], h = s + a; let c = t; n.textAlign = "left", n.textBaseline = "middle"; let d = -1, u = -h; return this.legendItems.forEach(((t, f) => { const g = i + e / 2 + n.measureText(t.text).width; (0 === f || l[l.length - 1] + g + 2 * a > o) && (c += h, l[l.length - (f > 0 ? 0 : 1)] = 0, u += h, d++), r[f] = { left: 0, top: u, row: d, width: g, height: s }, l[l.length - 1] += g + a })), c } _fitCols(t, e, i, s) { const { ctx: n, maxHeight: o, options: { labels: { padding: a } } } = this, r = this.legendHitBoxes = [], l = this.columnSizes = [], h = o - t; let c = a, d = 0, u = 0, f = 0, g = 0; return this.legendItems.forEach(((t, o) => { const { itemWidth: p, itemHeight: m } = function (t, e, i, s, n) { const o = function (t, e, i, s) { let n = t.text; n && "string" != typeof n && (n = n.reduce(((t, e) => t.length > e.length ? t : e))); return e + i.size / 2 + s.measureText(n).width }(s, t, e, i), a = function (t, e, i) { let s = t; "string" != typeof e.text && (s = _a(e, i)); return s }(n, s, e.lineHeight); return { itemWidth: o, itemHeight: a } }(i, e, n, t, s); o > 0 && u + m + 2 * a > h && (c += d + a, l.push({ width: d, height: u }), f += d + a, g++, d = u = 0), r[o] = { left: f, top: u, col: g, width: p, height: m }, d = Math.max(d, p), u += m + a })), c += d, l.push({ width: d, height: u }), c } adjustHitBoxes() { if (!this.options.display) return; const t = this._computeTitleHeight(), { legendHitBoxes: e, options: { align: i, labels: { padding: s }, rtl: n } } = this, o = Oi(n, this.left, this.width); if (this.isHorizontal()) { let n = 0, a = ft(i, this.left + s, this.right - this.lineWidths[n]); for (const r of e) n !== r.row && (n = r.row, a = ft(i, this.left + s, this.right - this.lineWidths[n])), r.top += this.top + t + s, r.left = o.leftForLtr(o.x(a), r.width), a += r.width + s } else { let n = 0, a = ft(i, this.top + t + s, this.bottom - this.columnSizes[n].height); for (const r of e) r.col !== n && (n = r.col, a = ft(i, this.top + t + s, this.bottom - this.columnSizes[n].height)), r.top = a, r.left += this.left + s, r.left = o.leftForLtr(o.x(r.left), r.width), a += r.height + s } } isHorizontal() { return "top" === this.options.position || "bottom" === this.options.position } draw() { if (this.options.display) { const t = this.ctx; Ie(t, this), this._draw(), ze(t) } } _draw() { const { options: t, columnSizes: e, lineWidths: i, ctx: s } = this, { align: n, labels: o } = t, a = ue.color, r = Oi(t.rtl, this.left, this.width), h = Si(o.font), { padding: c } = o, d = h.size, u = d / 2; let f; this.drawTitle(), s.textAlign = r.textAlign("left"), s.textBaseline = "middle", s.lineWidth = .5, s.font = h.string; const { boxWidth: g, boxHeight: p, itemHeight: m } = ba(o, d), b = this.isHorizontal(), x = this._computeTitleHeight(); f = b ? { x: ft(n, this.left + c, this.right - i[0]), y: this.top + c + x, line: 0 } : { x: this.left + c, y: ft(n, this.top + x + c, this.bottom - e[0].height), line: 0 }, Ai(this.ctx, t.textDirection); const _ = m + c; this.legendItems.forEach(((y, v) => { s.strokeStyle = y.fontColor, s.fillStyle = y.fontColor; const M = s.measureText(y.text).width, w = r.textAlign(y.textAlign || (y.textAlign = o.textAlign)), k = g + u + M; let S = f.x, P = f.y; r.setWidth(this.width), b ? v > 0 && S + k + c > this.right && (P = f.y += _, f.line++, S = f.x = ft(n, this.left + c, this.right - i[f.line])) : v > 0 && P + _ > this.bottom && (S = f.x = S + e[f.line].width + c, f.line++, P = f.y = ft(n, this.top + x + c, this.bottom - e[f.line].height)); if (function (t, e, i) { if (isNaN(g) || g <= 0 || isNaN(p) || p < 0) return; s.save(); const n = l(i.lineWidth, 1); if (s.fillStyle = l(i.fillStyle, a), s.lineCap = l(i.lineCap, "butt"), s.lineDashOffset = l(i.lineDashOffset, 0), s.lineJoin = l(i.lineJoin, "miter"), s.lineWidth = n, s.strokeStyle = l(i.strokeStyle, a), s.setLineDash(l(i.lineDash, [])), o.usePointStyle) { const a = { radius: p * Math.SQRT2 / 2, pointStyle: i.pointStyle, rotation: i.rotation, borderWidth: n }, l = r.xPlus(t, g / 2); Ee(s, a, l, e + u, o.pointStyleWidth && g) } else { const o = e + Math.max((d - p) / 2, 0), a = r.leftForLtr(t, g), l = wi(i.borderRadius); s.beginPath(), Object.values(l).some((t => 0 !== t)) ? He(s, { x: a, y: o, w: g, h: p, radius: l }) : s.rect(a, o, g, p), s.fill(), 0 !== n && s.stroke() } s.restore() }(r.x(S), P, y), S = gt(w, S + g + u, b ? S + k : this.right, t.rtl), function (t, e, i) { Ne(s, i.text, t, e + m / 2, h, { strikethrough: i.hidden, textAlign: r.textAlign(i.textAlign) }) }(r.x(S), P, y), b) f.x += k + c; else if ("string" != typeof y.text) { const t = h.lineHeight; f.y += _a(y, t) + c } else f.y += _ })), Ti(this.ctx, t.textDirection) } drawTitle() { const t = this.options, e = t.title, i = Si(e.font), s = ki(e.padding); if (!e.display) return; const n = Oi(t.rtl, this.left, this.width), o = this.ctx, a = e.position, r = i.size / 2, l = s.top + r; let h, c = this.left, d = this.width; if (this.isHorizontal()) d = Math.max(...this.lineWidths), h = this.top + l, c = ft(t.align, c, this.right - d); else { const e = this.columnSizes.reduce(((t, e) => Math.max(t, e.height)), 0); h = l + ft(t.align, this.top, this.bottom - e - t.labels.padding - this._computeTitleHeight()) } const u = ft(a, c, c + d); o.textAlign = n.textAlign(ut(a)), o.textBaseline = "middle", o.strokeStyle = e.color, o.fillStyle = e.color, o.font = i.string, Ne(o, e.text, u, h, i) } _computeTitleHeight() { const t = this.options.title, e = Si(t.font), i = ki(t.padding); return t.display ? e.lineHeight + i.height : 0 } _getLegendItemAt(t, e) { let i, s, n; if (tt(t, this.left, this.right) && tt(e, this.top, this.bottom)) for (n = this.legendHitBoxes, i = 0; i < n.length; ++i)if (s = n[i], tt(t, s.left, s.left + s.width) && tt(e, s.top, s.top + s.height)) return this.legendItems[i]; return null } handleEvent(t) { const e = this.options; if (!function (t, e) { if (("mousemove" === t || "mouseout" === t) && (e.onHover || e.onLeave)) return !0; if (e.onClick && ("click" === t || "mouseup" === t)) return !0; return !1 }(t.type, e)) return; const i = this._getLegendItemAt(t.x, t.y); if ("mousemove" === t.type || "mouseout" === t.type) { const o = this._hoveredItem, a = (n = i, null !== (s = o) && null !== n && s.datasetIndex === n.datasetIndex && s.index === n.index); o && !a && d(e.onLeave, [t, o, this], this), this._hoveredItem = i, i && !a && d(e.onHover, [t, i, this], this) } else i && d(e.onClick, [t, i, this], this); var s, n } } function _a(t, e) { return e * (t.text ? t.text.length : 0) } var ya = { id: "legend", _element: xa, start(t, e, i) { const s = t.legend = new xa({ ctx: t.ctx, options: i, chart: t }); as.configure(t, s, i), as.addBox(t, s) }, stop(t) { as.removeBox(t, t.legend), delete t.legend }, beforeUpdate(t, e, i) { const s = t.legend; as.configure(t, s, i), s.options = i }, afterUpdate(t) { const e = t.legend; e.buildLabels(), e.adjustHitBoxes() }, afterEvent(t, e) { e.replay || t.legend.handleEvent(e.event) }, defaults: { display: !0, position: "top", align: "center", fullSize: !0, reverse: !1, weight: 1e3, onClick(t, e, i) { const s = e.datasetIndex, n = i.chart; n.isDatasetVisible(s) ? (n.hide(s), e.hidden = !0) : (n.show(s), e.hidden = !1) }, onHover: null, onLeave: null, labels: { color: t => t.chart.options.color, boxWidth: 40, padding: 10, generateLabels(t) { const e = t.data.datasets, { labels: { usePointStyle: i, pointStyle: s, textAlign: n, color: o, useBorderRadius: a, borderRadius: r } } = t.legend.options; return t._getSortedDatasetMetas().map((t => { const l = t.controller.getStyle(i ? 0 : void 0), h = ki(l.borderWidth); return { text: e[t.index].label, fillStyle: l.backgroundColor, fontColor: o, hidden: !t.visible, lineCap: l.borderCapStyle, lineDash: l.borderDash, lineDashOffset: l.borderDashOffset, lineJoin: l.borderJoinStyle, lineWidth: (h.width + h.height) / 4, strokeStyle: l.borderColor, pointStyle: s || l.pointStyle, rotation: l.rotation, textAlign: n || l.textAlign, borderRadius: a && (r || l.borderRadius), datasetIndex: t.index } }), this) } }, title: { color: t => t.chart.options.color, display: !1, position: "center", text: "" } }, descriptors: { _scriptable: t => !t.startsWith("on"), labels: { _scriptable: t => !["generateLabels", "filter", "sort"].includes(t) } } }; class va extends Hs { 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 i = this.options; if (this.left = 0, this.top = 0, !i.display) return void (this.width = this.height = this.right = this.bottom = 0); this.width = this.right = t, this.height = this.bottom = e; const s = n(i.text) ? i.text.length : 1; this._padding = ki(i.padding); const o = s * Si(i.font).lineHeight + this._padding.height; this.isHorizontal() ? this.height = o : this.width = o } isHorizontal() { const t = this.options.position; return "top" === t || "bottom" === t } _drawArgs(t) { const { top: e, left: i, bottom: s, right: n, options: o } = this, a = o.align; let r, l, h, c = 0; return this.isHorizontal() ? (l = ft(a, i, n), h = e + t, r = n - i) : ("left" === o.position ? (l = i + t, h = ft(a, s, e), c = -.5 * C) : (l = n - t, h = ft(a, e, s), c = .5 * C), r = s - e), { titleX: l, titleY: h, maxWidth: r, rotation: c } } draw() { const t = this.ctx, e = this.options; if (!e.display) return; const i = Si(e.font), s = i.lineHeight / 2 + this._padding.top, { titleX: n, titleY: o, maxWidth: a, rotation: r } = this._drawArgs(s); Ne(t, e.text, 0, 0, i, { color: e.color, maxWidth: a, rotation: r, textAlign: ut(e.align), textBaseline: "middle", translation: [n, o] }) } } var Ma = { id: "title", _element: va, start(t, e, i) { !function (t, e) { const i = new va({ ctx: t.ctx, options: e, chart: t }); as.configure(t, i, e), as.addBox(t, i), t.titleBlock = i }(t, i) }, stop(t) { const e = t.titleBlock; as.removeBox(t, e), delete t.titleBlock }, beforeUpdate(t, e, i) { const s = t.titleBlock; as.configure(t, s, i), s.options = i }, 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 wa = new WeakMap; var ka = { id: "subtitle", start(t, e, i) { const s = new va({ ctx: t.ctx, options: i, chart: t }); as.configure(t, s, i), as.addBox(t, s), wa.set(t, s) }, stop(t) { as.removeBox(t, wa.get(t)), wa.delete(t) }, beforeUpdate(t, e, i) { const s = wa.get(t); as.configure(t, s, i), s.options = i }, defaults: { align: "center", display: !1, font: { weight: "normal" }, fullSize: !0, padding: 0, position: "top", text: "", weight: 1500 }, defaultRoutes: { color: "color" }, descriptors: { _scriptable: !0, _indexable: !1 } }; const Sa = { average(t) { if (!t.length) return !1; let e, i, s = 0, n = 0, o = 0; for (e = 0, i = t.length; e < i; ++e) { const i = t[e].element; if (i && i.hasValue()) { const t = i.tooltipPosition(); s += t.x, n += t.y, ++o } } return { x: s / o, y: n / o } }, nearest(t, e) { if (!t.length) return !1; let i, s, n, o = e.x, a = e.y, r = Number.POSITIVE_INFINITY; for (i = 0, s = t.length; i < s; ++i) { const s = t[i].element; if (s && s.hasValue()) { const t = q(e, s.getCenterPoint()); t < r && (r = t, n = s) } } if (n) { const t = n.tooltipPosition(); o = t.x, a = t.y } return { x: o, y: a } } }; function Pa(t, e) { return e && (n(e) ? Array.prototype.push.apply(t, e) : t.push(e)), t } function Da(t) { return ("string" == typeof t || t instanceof String) && t.indexOf("\n") > -1 ? t.split("\n") : t } function Ca(t, e) { const { element: i, datasetIndex: s, index: n } = e, o = t.getDatasetMeta(s).controller, { label: a, value: r } = o.getLabelAndValue(n); return { chart: t, label: a, parsed: o.getParsed(n), raw: t.data.datasets[s].data[n], formattedValue: r, dataset: o.getDataset(), dataIndex: n, datasetIndex: s, element: i } } function Oa(t, e) { const i = t.chart.ctx, { body: s, footer: n, title: o } = t, { boxWidth: a, boxHeight: r } = e, l = Si(e.bodyFont), h = Si(e.titleFont), c = Si(e.footerFont), d = o.length, f = n.length, g = s.length, p = ki(e.padding); let m = p.height, b = 0, x = s.reduce(((t, e) => t + e.before.length + e.lines.length + e.after.length), 0); if (x += t.beforeBody.length + t.afterBody.length, d && (m += d * h.lineHeight + (d - 1) * e.titleSpacing + e.titleMarginBottom), x) { m += g * (e.displayColors ? Math.max(r, l.lineHeight) : l.lineHeight) + (x - g) * l.lineHeight + (x - 1) * e.bodySpacing } f && (m += e.footerMarginTop + f * c.lineHeight + (f - 1) * e.footerSpacing); let _ = 0; const y = function (t) { b = Math.max(b, i.measureText(t).width + _) }; return i.save(), i.font = h.string, u(t.title, y), i.font = l.string, u(t.beforeBody.concat(t.afterBody), y), _ = e.displayColors ? a + 2 + e.boxPadding : 0, u(s, (t => { u(t.before, y), u(t.lines, y), u(t.after, y) })), _ = 0, i.font = c.string, u(t.footer, y), i.restore(), b += p.width, { width: b, height: m } } function Aa(t, e, i, s) { const { x: n, width: o } = i, { width: a, chartArea: { left: r, right: l } } = t; let h = "center"; return "center" === s ? h = n <= (r + l) / 2 ? "left" : "right" : n <= o / 2 ? h = "left" : n >= a - o / 2 && (h = "right"), function (t, e, i, s) { const { x: n, width: o } = s, a = i.caretSize + i.caretPadding; return "left" === t && n + o + a > e.width || "right" === t && n - o - a < 0 || void 0 }(h, t, e, i) && (h = "center"), h } function Ta(t, e, i) { const s = i.yAlign || e.yAlign || function (t, e) { const { y: i, height: s } = e; return i < s / 2 ? "top" : i > t.height - s / 2 ? "bottom" : "center" }(t, i); return { xAlign: i.xAlign || e.xAlign || Aa(t, e, i, s), yAlign: s } } function La(t, e, i, s) { const { caretSize: n, caretPadding: o, cornerRadius: a } = t, { xAlign: r, yAlign: l } = i, h = n + o, { topLeft: c, topRight: d, bottomLeft: u, bottomRight: f } = wi(a); let g = function (t, e) { let { x: i, width: s } = t; return "right" === e ? i -= s : "center" === e && (i -= s / 2), i }(e, r); const p = function (t, e, i) { let { y: s, height: n } = t; return "top" === e ? s += i : s -= "bottom" === e ? n + i : n / 2, s }(e, l, h); return "center" === l ? "left" === r ? g += h : "right" === r && (g -= h) : "left" === r ? g -= Math.max(c, u) + n : "right" === r && (g += Math.max(d, f) + n), { x: J(g, 0, s.width - e.width), y: J(p, 0, s.height - e.height) } } function Ea(t, e, i) { const s = ki(i.padding); return "center" === e ? t.x + t.width / 2 : "right" === e ? t.x + t.width - s.right : t.x + s.left } function Ra(t) { return Pa([], Da(t)) } function Ia(t, e) { const i = e && e.dataset && e.dataset.tooltip && e.dataset.tooltip.callbacks; return i ? t.override(i) : t } const za = { beforeTitle: e, title(t) { if (t.length > 0) { const e = t[0], i = e.chart.data.labels, s = i ? i.length : 0; if (this && this.options && "dataset" === this.options.mode) return e.dataset.label || ""; if (e.label) return e.label; if (s > 0 && e.dataIndex < s) return i[e.dataIndex] } return "" }, afterTitle: e, beforeBody: e, beforeLabel: e, label(t) { if (this && this.options && "dataset" === this.options.mode) return t.label + ": " + t.formattedValue || t.formattedValue; let e = t.dataset.label || ""; e && (e += ": "); const i = t.formattedValue; return s(i) || (e += i), e }, labelColor(t) { const e = t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex); return { borderColor: e.borderColor, backgroundColor: e.backgroundColor, borderWidth: e.borderWidth, borderDash: e.borderDash, borderDashOffset: e.borderDashOffset, borderRadius: 0 } }, labelTextColor() { return this.options.bodyColor }, labelPointStyle(t) { const e = t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex); return { pointStyle: e.pointStyle, rotation: e.rotation } }, afterLabel: e, afterBody: e, beforeFooter: e, footer: e, afterFooter: e }; function Fa(t, e, i, s) { const n = t[e].call(i, s); return void 0 === n ? za[e].call(i, s) : n } class Va extends Hs { static positioners = Sa; 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, i = this.options.setContext(this.getContext()), s = i.enabled && e.options.animation && i.animations, n = new Os(this.chart, s); return s._cacheable && (this._cachedAnimations = Object.freeze(n)), n } getContext() { return this.$context || (this.$context = (t = this.chart.getContext(), e = this, i = this._tooltipItems, Ci(t, { tooltip: e, tooltipItems: i, type: "tooltip" }))); var t, e, i } getTitle(t, e) { const { callbacks: i } = e, s = Fa(i, "beforeTitle", this, t), n = Fa(i, "title", this, t), o = Fa(i, "afterTitle", this, t); let a = []; return a = Pa(a, Da(s)), a = Pa(a, Da(n)), a = Pa(a, Da(o)), a } getBeforeBody(t, e) { return Ra(Fa(e.callbacks, "beforeBody", this, t)) } getBody(t, e) { const { callbacks: i } = e, s = []; return u(t, (t => { const e = { before: [], lines: [], after: [] }, n = Ia(i, t); Pa(e.before, Da(Fa(n, "beforeLabel", this, t))), Pa(e.lines, Fa(n, "label", this, t)), Pa(e.after, Da(Fa(n, "afterLabel", this, t))), s.push(e) })), s } getAfterBody(t, e) { return Ra(Fa(e.callbacks, "afterBody", this, t)) } getFooter(t, e) { const { callbacks: i } = e, s = Fa(i, "beforeFooter", this, t), n = Fa(i, "footer", this, t), o = Fa(i, "afterFooter", this, t); let a = []; return a = Pa(a, Da(s)), a = Pa(a, Da(n)), a = Pa(a, Da(o)), a } _createItems(t) { const e = this._active, i = this.chart.data, s = [], n = [], o = []; let a, r, l = []; for (a = 0, r = e.length; a < r; ++a)l.push(Ca(this.chart, e[a])); return t.filter && (l = l.filter(((e, s, n) => t.filter(e, s, n, i)))), t.itemSort && (l = l.sort(((e, s) => t.itemSort(e, s, i)))), u(l, (e => { const i = Ia(t.callbacks, e); s.push(Fa(i, "labelColor", this, e)), n.push(Fa(i, "labelPointStyle", this, e)), o.push(Fa(i, "labelTextColor", this, e)) })), this.labelColors = s, this.labelPointStyles = n, this.labelTextColors = o, this.dataPoints = l, l } update(t, e) { const i = this.options.setContext(this.getContext()), s = this._active; let n, o = []; if (s.length) { const t = Sa[i.position].call(this, s, this._eventPosition); o = this._createItems(i), this.title = this.getTitle(o, i), this.beforeBody = this.getBeforeBody(o, i), this.body = this.getBody(o, i), this.afterBody = this.getAfterBody(o, i), this.footer = this.getFooter(o, i); const e = this._size = Oa(this, i), a = Object.assign({}, t, e), r = Ta(this.chart, i, a), l = La(i, a, r, this.chart); this.xAlign = r.xAlign, this.yAlign = r.yAlign, n = { opacity: 1, x: l.x, y: l.y, width: e.width, height: e.height, caretX: t.x, caretY: t.y } } else 0 !== this.opacity && (n = { opacity: 0 }); this._tooltipItems = o, this.$context = void 0, n && this._resolveAnimations().update(this, n), t && i.external && i.external.call(this, { chart: this.chart, tooltip: this, replay: e }) } drawCaret(t, e, i, s) { const n = this.getCaretPosition(t, i, s); e.lineTo(n.x1, n.y1), e.lineTo(n.x2, n.y2), e.lineTo(n.x3, n.y3) } getCaretPosition(t, e, i) { const { xAlign: s, yAlign: n } = this, { caretSize: o, cornerRadius: a } = i, { topLeft: r, topRight: l, bottomLeft: h, bottomRight: c } = wi(a), { x: d, y: u } = t, { width: f, height: g } = e; let p, m, b, x, _, y; return "center" === n ? (_ = u + g / 2, "left" === s ? (p = d, m = p - o, x = _ + o, y = _ - o) : (p = d + f, m = p + o, x = _ - o, y = _ + o), b = p) : (m = "left" === s ? d + Math.max(r, h) + o : "right" === s ? d + f - Math.max(l, c) - o : this.caretX, "top" === n ? (x = u, _ = x - o, p = m - o, b = m + o) : (x = u + g, _ = x + o, p = m + o, b = m - o), y = x), { x1: p, x2: m, x3: b, y1: x, y2: _, y3: y } } drawTitle(t, e, i) { const s = this.title, n = s.length; let o, a, r; if (n) { const l = Oi(i.rtl, this.x, this.width); for (t.x = Ea(this, i.titleAlign, i), e.textAlign = l.textAlign(i.titleAlign), e.textBaseline = "middle", o = Si(i.titleFont), a = i.titleSpacing, e.fillStyle = i.titleColor, e.font = o.string, r = 0; r < n; ++r)e.fillText(s[r], l.x(t.x), t.y + o.lineHeight / 2), t.y += o.lineHeight + a, r + 1 === n && (t.y += i.titleMarginBottom - a) } } _drawColorBox(t, e, i, s, n) { const a = this.labelColors[i], r = this.labelPointStyles[i], { boxHeight: l, boxWidth: h } = n, c = Si(n.bodyFont), d = Ea(this, "left", n), u = s.x(d), f = l < c.lineHeight ? (c.lineHeight - l) / 2 : 0, g = e.y + f; if (n.usePointStyle) { const e = { radius: Math.min(h, l) / 2, pointStyle: r.pointStyle, rotation: r.rotation, borderWidth: 1 }, i = s.leftForLtr(u, h) + h / 2, o = g + l / 2; t.strokeStyle = n.multiKeyBackground, t.fillStyle = n.multiKeyBackground, Le(t, e, i, o), t.strokeStyle = a.borderColor, t.fillStyle = a.backgroundColor, Le(t, e, i, o) } else { t.lineWidth = o(a.borderWidth) ? Math.max(...Object.values(a.borderWidth)) : a.borderWidth || 1, t.strokeStyle = a.borderColor, t.setLineDash(a.borderDash || []), t.lineDashOffset = a.borderDashOffset || 0; const e = s.leftForLtr(u, h), i = s.leftForLtr(s.xPlus(u, 1), h - 2), r = wi(a.borderRadius); Object.values(r).some((t => 0 !== t)) ? (t.beginPath(), t.fillStyle = n.multiKeyBackground, He(t, { x: e, y: g, w: h, h: l, radius: r }), t.fill(), t.stroke(), t.fillStyle = a.backgroundColor, t.beginPath(), He(t, { x: i, y: g + 1, w: h - 2, h: l - 2, radius: r }), t.fill()) : (t.fillStyle = n.multiKeyBackground, t.fillRect(e, g, h, l), t.strokeRect(e, g, h, l), t.fillStyle = a.backgroundColor, t.fillRect(i, g + 1, h - 2, l - 2)) } t.fillStyle = this.labelTextColors[i] } drawBody(t, e, i) { const { body: s } = this, { bodySpacing: n, bodyAlign: o, displayColors: a, boxHeight: r, boxWidth: l, boxPadding: h } = i, c = Si(i.bodyFont); let d = c.lineHeight, f = 0; const g = Oi(i.rtl, this.x, this.width), p = function (i) { e.fillText(i, g.x(t.x + f), t.y + d / 2), t.y += d + n }, m = g.textAlign(o); let b, x, _, y, v, M, w; for (e.textAlign = o, e.textBaseline = "middle", e.font = c.string, t.x = Ea(this, m, i), e.fillStyle = i.bodyColor, u(this.beforeBody, p), f = a && "right" !== m ? "center" === o ? l / 2 + h : l + 2 + h : 0, y = 0, M = s.length; y < M; ++y) { for (b = s[y], x = this.labelTextColors[y], e.fillStyle = x, u(b.before, p), _ = b.lines, a && _.length && (this._drawColorBox(e, t, y, g, i), d = Math.max(c.lineHeight, r)), v = 0, w = _.length; v < w; ++v)p(_[v]), d = c.lineHeight; u(b.after, p) } f = 0, d = c.lineHeight, u(this.afterBody, p), t.y -= n } drawFooter(t, e, i) { const s = this.footer, n = s.length; let o, a; if (n) { const r = Oi(i.rtl, this.x, this.width); for (t.x = Ea(this, i.footerAlign, i), t.y += i.footerMarginTop, e.textAlign = r.textAlign(i.footerAlign), e.textBaseline = "middle", o = Si(i.footerFont), e.fillStyle = i.footerColor, e.font = o.string, a = 0; a < n; ++a)e.fillText(s[a], r.x(t.x), t.y + o.lineHeight / 2), t.y += o.lineHeight + i.footerSpacing } } drawBackground(t, e, i, s) { const { xAlign: n, yAlign: o } = this, { x: a, y: r } = t, { width: l, height: h } = i, { topLeft: c, topRight: d, bottomLeft: u, bottomRight: f } = wi(s.cornerRadius); e.fillStyle = s.backgroundColor, e.strokeStyle = s.borderColor, e.lineWidth = s.borderWidth, e.beginPath(), e.moveTo(a + c, r), "top" === o && this.drawCaret(t, e, i, s), e.lineTo(a + l - d, r), e.quadraticCurveTo(a + l, r, a + l, r + d), "center" === o && "right" === n && this.drawCaret(t, e, i, s), e.lineTo(a + l, r + h - f), e.quadraticCurveTo(a + l, r + h, a + l - f, r + h), "bottom" === o && this.drawCaret(t, e, i, s), e.lineTo(a + u, r + h), e.quadraticCurveTo(a, r + h, a, r + h - u), "center" === o && "left" === n && this.drawCaret(t, e, i, s), e.lineTo(a, r + c), e.quadraticCurveTo(a, r, a + c, r), e.closePath(), e.fill(), s.borderWidth > 0 && e.stroke() } _updateAnimationTarget(t) { const e = this.chart, i = this.$animations, s = i && i.x, n = i && i.y; if (s || n) { const i = Sa[t.position].call(this, this._active, this._eventPosition); if (!i) return; const o = this._size = Oa(this, t), a = Object.assign({}, i, this._size), r = Ta(e, t, a), l = La(t, a, r, e); s._to === l.x && n._to === l.y || (this.xAlign = r.xAlign, this.yAlign = r.yAlign, this.width = o.width, this.height = o.height, this.caretX = i.x, this.caretY = i.y, this._resolveAnimations().update(this, l)) } } _willRender() { return !!this.opacity } draw(t) { const e = this.options.setContext(this.getContext()); let i = this.opacity; if (!i) return; this._updateAnimationTarget(e); const s = { width: this.width, height: this.height }, n = { x: this.x, y: this.y }; i = Math.abs(i) < .001 ? 0 : i; const o = ki(e.padding), a = this.title.length || this.beforeBody.length || this.body.length || this.afterBody.length || this.footer.length; e.enabled && a && (t.save(), t.globalAlpha = i, this.drawBackground(n, t, s, e), Ai(t, e.textDirection), n.y += o.top, this.drawTitle(n, t, e), this.drawBody(n, t, e), this.drawFooter(n, t, e), Ti(t, e.textDirection), t.restore()) } getActiveElements() { return this._active || [] } setActiveElements(t, e) { const i = this._active, s = t.map((({ datasetIndex: t, index: e }) => { const i = this.chart.getDatasetMeta(t); if (!i) throw new Error("Cannot find a dataset at index " + t); return { datasetIndex: t, element: i.data[e], index: e } })), n = !f(i, s), o = this._positionChanged(s, e); (n || o) && (this._active = s, this._eventPosition = e, this._ignoreReplayEvents = !0, this.update(!0)) } handleEvent(t, e, i = !0) { if (e && this._ignoreReplayEvents) return !1; this._ignoreReplayEvents = !1; const s = this.options, n = this._active || [], o = this._getActiveElements(t, n, e, i), a = this._positionChanged(o, t), r = e || !f(o, n) || a; return r && (this._active = o, (s.enabled || s.external) && (this._eventPosition = { x: t.x, y: t.y }, this.update(!0, e))), r } _getActiveElements(t, e, i, s) { const n = this.options; if ("mouseout" === t.type) return []; if (!s) return e.filter((t => this.chart.data.datasets[t.datasetIndex] && void 0 !== this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index))); const o = this.chart.getElementsAtEventForMode(t, n.mode, n, i); return n.reverse && o.reverse(), o } _positionChanged(t, e) { const { caretX: i, caretY: s, options: n } = this, o = Sa[n.position].call(this, t, e); return !1 !== o && (i !== o.x || s !== o.y) } } var Ba = { id: "tooltip", _element: Va, positioners: Sa, afterInit(t, e, i) { i && (t.tooltip = new Va({ chart: t, options: i })) }, beforeUpdate(t, e, i) { t.tooltip && t.tooltip.initialize(i) }, reset(t, e, i) { t.tooltip && t.tooltip.initialize(i) }, afterDraw(t) { const e = t.tooltip; if (e && e._willRender()) { const i = { tooltip: e }; if (!1 === t.notifyPlugins("beforeTooltipDraw", { ...i, cancelable: !0 })) return; e.draw(t.ctx), t.notifyPlugins("afterTooltipDraw", i) } }, afterEvent(t, e) { if (t.tooltip) { const i = e.replay; t.tooltip.handleEvent(e.event, i, e.inChartArea) && (e.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: (t, e) => e.bodyFont.size, boxWidth: (t, e) => e.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: za }, defaultRoutes: { bodyFont: "font", footerFont: "font", titleFont: "font" }, descriptors: { _scriptable: t => "filter" !== t && "itemSort" !== t && "external" !== t, _indexable: !1, callbacks: { _scriptable: !1, _indexable: !1 }, animation: { _fallback: !1 }, animations: { _fallback: "animation" } }, additionalOptionScopes: ["interaction"] }; return An.register(Yn, jo, fo, t), An.helpers = { ...Wi }, An._adapters = Rn, An.Animation = Cs, An.Animations = Os, An.animator = xt, An.controllers = en.controllers.items, An.DatasetController = Ns, An.Element = Hs, An.elements = fo, An.Interaction = Xi, An.layouts = as, An.platforms = Ss, An.Scale = Js, An.Ticks = ae, Object.assign(An, Yn, jo, fo, t, Ss), An.Chart = An, "undefined" != typeof window && (window.Chart = An), An+}));+//# sourceMappingURL=chart.umd.js.map\ No newline at end of filediff --git a/scripts/publish-scheduled.js b/scripts/publish-scheduled.jsnew file mode 100644index 0000000..83f130a--- /dev/null+++ b/scripts/publish-scheduled.js@@ -0,0 +1,185 @@+#!/usr/bin/env node+/**+ * Instagram Scheduled Post Publisher+ *+ * Runs standalone in GitHub Actions (cron every 15 min).+ * Reads scheduled posts, publishes due ones to Instagram, updates the file.+ *+ * Environment variables (set as GitHub Secrets):+ * ACCOUNTS_JSON - Base64-encoded contents of accounts.json+ *+ * Requires Node.js 18+ (uses native fetch).+ */++const fs = require('fs');+const path = require('path');++const SCHEDULED_POSTS_FILE = path.join(__dirname, '..', 'backend', 'data', 'scheduled_posts.json');++// ─── Helpers ─────────────────────────────────────────────────────────────────++function getAccounts() {+ // Priority 1: ACCOUNTS_JSON env var (GitHub Actions)+ if (process.env.ACCOUNTS_JSON) {+ try {+ return JSON.parse(Buffer.from(process.env.ACCOUNTS_JSON, 'base64').toString('utf8'));+ } catch {+ // Maybe it's plain JSON, not base64+ return JSON.parse(process.env.ACCOUNTS_JSON);+ }+ }+ // Priority 2: Local file+ const localFile = path.join(__dirname, '..', 'backend', 'data', 'accounts.json');+ if (fs.existsSync(localFile)) {+ return JSON.parse(fs.readFileSync(localFile, 'utf8'));+ }+ return [];+}++function getScheduledPosts() {+ if (!fs.existsSync(SCHEDULED_POSTS_FILE)) return [];+ return JSON.parse(fs.readFileSync(SCHEDULED_POSTS_FILE, 'utf8'));+}++function saveScheduledPosts(posts) {+ fs.writeFileSync(SCHEDULED_POSTS_FILE, JSON.stringify(posts, null, 2));+}++function sleep(ms) {+ return new Promise(r => setTimeout(r, ms));+}++// ─── Instagram Publishing ────────────────────────────────────────────────────++async function publishPost(post, accounts) {+ const acct = accounts.find(a => a.id === post.accountId);+ if (!acct) throw new Error('Account not found: ' + post.accountId);++ const igId = acct.igUserId;+ const token = acct.accessToken;+ const params = { access_token: token };++ // Build container params based on media type+ if (post.mediaType === 'REELS') {+ params.media_type = 'REELS';+ params.video_url = post.mediaUrl;+ if (post.caption) params.caption = post.caption;+ if (post.shareToFeed !== undefined) params.share_to_feed = post.shareToFeed;+ if (post.coverUrl) params.cover_url = post.coverUrl;+ if (post.collaborators?.length) params.collaborators = JSON.stringify(post.collaborators);+ if (post.audioName) params.audio_name = post.audioName;+ if (post.thumbOffset != null) params.thumb_offset = post.thumbOffset;+ if (post.locationId) params.location_id = post.locationId;+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ } else if (post.mediaType === 'STORIES') {+ params.media_type = 'STORIES';+ if (post.mediaUrl.match(/\.(mp4|mov|avi|webm)/i)) {+ params.video_url = post.mediaUrl;+ } else {+ params.image_url = post.mediaUrl;+ }+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ } else {+ // IMAGE+ params.image_url = post.mediaUrl;+ if (post.caption) params.caption = post.caption;+ if (post.locationId) params.location_id = post.locationId;+ if (post.userTags?.length) params.user_tags = JSON.stringify(post.userTags);+ if (post.altText) params.alt_text = post.altText;+ }++ // Step 1: Create container+ const qs = new URLSearchParams(params).toString();+ const createRes = await fetch(+ `https://graph.instagram.com/v25.0/${igId}/media?${qs}`,+ { method: 'POST' }+ );+ const createData = await createRes.json();+ if (createData.error) throw new Error(createData.error.message);++ const containerId = createData.id;++ // Step 2: Wait for processing (videos/reels need polling)+ if (post.mediaType === 'REELS' || post.mediaType === 'STORIES') {+ for (let i = 0; i < 60; i++) {+ await sleep(3000);+ const statusRes = await fetch(+ `https://graph.instagram.com/v25.0/${containerId}?fields=status_code,status&access_token=${token}`+ );+ const statusData = await statusRes.json();+ if (statusData.status_code === 'FINISHED' || statusData.status_code === 'PUBLISHED') break;+ if (statusData.status_code === 'ERROR') throw new Error('Processing failed: ' + (statusData.status || ''));+ if (statusData.status_code === 'EXPIRED') throw new Error('Container expired');+ }+ } else {+ await sleep(2000);+ }++ // Step 3: Publish+ const pubRes = await fetch(+ `https://graph.instagram.com/v25.0/${igId}/media_publish?creation_id=${containerId}&access_token=${token}`,+ { method: 'POST' }+ );+ const pubData = await pubRes.json();+ if (pubData.error) throw new Error(pubData.error.message);++ return pubData.id;+}++// ─── Main ────────────────────────────────────────────────────────────────────++async function main() {+ console.log('📅 Instagram Scheduled Post Publisher');+ console.log(` Time: ${new Date().toISOString()}`);+ console.log('');++ const accounts = getAccounts();+ if (!accounts.length) {+ console.log('❌ No accounts found.');+ console.log(' Set the ACCOUNTS_JSON secret (base64 of accounts.json)');+ process.exit(1);+ }+ console.log(` Accounts loaded: ${accounts.length}`);++ const posts = getScheduledPosts();+ const now = new Date();+ const duePosts = posts.filter(p => p.status === 'pending' && new Date(p.scheduledAt) <= now);++ if (!duePosts.length) {+ console.log('✓ No posts due for publishing');+ process.exit(0);+ }++ console.log(`⏰ ${duePosts.length} post(s) due for publishing\n`);+ let processed = 0;++ for (const post of duePosts) {+ console.log(` Publishing: ${post.id} (${post.mediaType}) — scheduled for ${post.scheduledAt}`);+ post.status = 'publishing';+ saveScheduledPosts(posts);++ try {+ const mediaId = await publishPost(post, accounts);+ post.status = 'published';+ post.publishedMediaId = mediaId;+ post.publishedAt = new Date().toISOString();+ processed++;+ console.log(` ✓ Published → media ${mediaId}`);+ } catch (err) {+ post.status = 'failed';+ post.error = err.message;+ console.error(` ✗ Failed: ${err.message}`);+ }++ saveScheduledPosts(posts);+ }++ console.log(`\n📊 Results: ${processed}/${duePosts.length} published successfully`);+ // Exit 0 even if some failed — so the commit step still runs+ process.exit(0);+}++main().catch(err => {+ console.error('Fatal error:', err);+ process.exit(1);+});