diff --git a/.scannerwork/.sonar_lock b/.scannerwork/.sonar_lock new file mode 100644 index 0000000..e69de29 diff --git a/.scannerwork/report-task.txt b/.scannerwork/report-task.txt new file mode 100644 index 0000000..0d8ec1e --- /dev/null +++ b/.scannerwork/report-task.txt @@ -0,0 +1,6 @@ +projectKey=calypso +serverUrl=https://sonar.avt.data-center.id +serverVersion=25.12.0.117093 +dashboardUrl=https://sonar.avt.data-center.id/dashboard?id=calypso +ceTaskId=2bb5340c-a81c-4dee-a5d2-0d498ee5e6c6 +ceTaskUrl=https://sonar.avt.data-center.id/api/ce/task?id=2bb5340c-a81c-4dee-a5d2-0d498ee5e6c6 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..31ff5c6 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,137 @@ +# AGENTS + +## Overview +- Languages: Go backend with `github.com/gin-gonic/gin`, `zap`, PostgreSQL migrations and REST handlers under `backend/internal`, plus a Vite+React+TypeScript frontend under `frontend/`. +- Keep the system deterministic: Go 1.22+, PostgreSQL 14+, Node 18+, npm 10+ (use `node --version`/`npm --version` to confirm). +- Secret material lives in `/etc/calypso/config.yaml` or environment variables (never commit private keys, JWT secrets, or database passwords). +- The backend expects `CALYPSO_DB_PASSWORD` and `CALYPSO_JWT_SECRET` (minimum 32 characters) before running locally or in CI. + +## Environment Setup +- Run `sudo ./scripts/install-requirements.sh` from the repo root to provision system dependencies on Ubuntu-like hosts before building the backend. +- `config.yaml.example` provides defaults; copy it to `/etc/calypso/config.yaml`, then edit the file or override with the `CALYPSO_*` environment variables before launching. +- For frontend work, `npm install` from `frontend/` once before subsequent builds or `npm run dev` sessions. + +## Backend Tooling (Go) +### Build & Run +- `make build` (`go build -o bin/calypso-api ./cmd/calypso-api`) produces the local binary. +- `make run` (`go run ./cmd/calypso-api -config config.yaml.example`) is the quickest local dev server; supply `-config` pointing at your working config. +- Production cross-build: `make build-linux` sets `CGO_ENABLED=0 GOOS=linux GOARCH=amd64` and strips symbols. +- `deploy/systemd/calypso-api.service` is a template—copy it to `/etc/systemd/system/`, `daemon-reload`, `enable`, and `start` to run as service. + +### Testing +- `make test` runs `go test ./...` across all packages; it is the authoritative test runner today. +- To run a single test, narrow the package and pass `-run`: `cd backend && go test ./internal/auth -run '^TestHandler_Login$'` (use `.` to target the current package and regular expressions for test names). +- `make test-coverage` generates `coverage.out` and opens a coverage report via `go tool cover -html=coverage.out`. + +### Lint & Format +- `make fmt` (`go fmt ./...`) keeps source gofmt-clean; run it after edits and before committing. +- `make lint` requires `golangci-lint`; install it with `make install-deps` (which calls `go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest`). +- `make deps` handles dependency downloads and tidies `go.mod`/`go.sum` when vendor changes are necessary. + +## Backend Style Guidelines (Go) +### Imports +- Group imports with standard library packages first, blank line, then third-party packages (gofmt enforces this). +- Do not alias imports unless needed to disambiguate. Keep third-party import paths explicit (e.g., `github.com/gin-gonic/gin`). +- Prefer explicit package names (`config`, `database`, `logger`) rather than dot-importing. + +### Formatting & Files +- Always run `gofmt` (or `make fmt`) before committing; gofmt enforces tabs for indentation and consistent formatting. +- Keep files small (100–300 lines) and break responsibilities into `internal/common`, `internal/iam`, etc., mirroring the current layout. +- Maintain doc comments on exported functions, types, and struct fields; these comments start with the identifier they describe. + +### Types & Naming +- Use PascalCase (UpperCamel) for exported types/fields/methods and camelCase for internal helpers. +- Keep configuration structs descriptive (`ServerConfig`, `DatabaseConfig`) and align YAML tags with snake_case field names. +- When introducing new structs, mimic the existing tag conventions (`yaml:"field_name"`). +- Use short, meaningful receiver names (`func (h *Handler) ...`), ideally 1–3 characters, matching current files. +- Name boolean helpers `isX`/`shouldY` and prefer `cfg`/`db`/`ctx` as short local variables for configuration, database, and contexts. + +### Error Handling +- Wrap errors with `fmt.Errorf("context: %w", err)` and return early. Do not swallow errors unless there is a clear action (e.g., logging + fallback). +- Use `gin.Context` to respond with the appropriate HTTP status codes (`c.JSON(http.StatusBadRequest, gin.H{...})`). +- Log warnings vs. errors via the shared `logger.Logger` (`h.logger.Warn(...)` for expected issues, `Error` for failures, `Info` for happy paths). +- Avoid `panic` in handlers; only panic during initialization (e.g., new logger). Instead, log and return a 5xx status. +- Keep timeouts and cancellation explicit using `context.WithTimeout` when communicating with databases or external systems. + +### Logging & Observability +- Use `zap`-backed `logger.NewLogger`, pass service-specific names (e.g., `router`, `auth-handler`), and attach structured pairs (`"user_id", user.ID`). +- Allow log format and level to be configured via `CALYPSO_LOG_FORMAT`/`CALYPSO_LOG_LEVEL` if present. +- Prefer adding caller info and stack traces on `Error`level logs when helpful. Do not sprinkle raw `fmt.Println` or `log.Print`. + +### HTTP & Routing +- All HTTP routing lives under `internal/common/router`; register handlers through route groups and middleware (auth/authZ) as seen in `router.NewRouter`. +- Use Gin middleware for sessions, JWT validation, and auditing. Keep handler methods grouped by feature (auth, iam, tasks). +- Keep handler structs simple: inject shared dependencies (`db`, `config`, `logger`) via constructors, then refer to them as fields. +- For JSON requests/responses, mirror struct field names in `json` tags (snake_case) even if Go fields are camelCase. + +### Database & Migrations +- Use prepared statements or parameterized queries (see `iam` and `sessions` tables) with `$1` style placeholders. +- Run migrations automatically from `internal/common/database/migrations/` via `database.RunMigrations` at startup. +- Hunters: use `database.DB` wrapper for connection pool handling, close connections via `defer db.Close()`. +- When adding new tables, drop SQL files into `db/migrations/` and re-run migrations via the running service or a migration helper. + +### Security Notes +- JWT secrets must be strong (>=32 characters). Use environment variables, never embed secrets in code or checked-in configs. +- Database passwords, API keys, and secrets are populated via env vars (`CALYPSO_DB_PASSWORD`, `CALYPSO_JWT_SECRET`, `CALYPSO_JWT_SECRET`) or `config.yaml` on the host. +- All mutating endpoints should log audit events and guard via IAM roles (see `iam` package for role resolution). +- Bacula client registration and capability pushes require the `bacula-admin` role; enforce it via `requireRole("bacula-admin")` on `/api/v1/bacula/clients` routes. + +## Frontend Tooling (React + TypeScript) +### Build & Run +- Work inside `frontend/`. Start the dev server with `npm run dev` (proxies `/api` → `http://localhost:8080`). +- Production builds use `npm run build`, which runs `tsc` before `vite build` to ensure typing correctness. +- Serve production output via `npm run preview` if you need to smoke-test a `dist/` snapshot. + +### Testing +- No automated frontend tests run currently. If you add a test harness (Jest/Vitest), ensure `npm test` or equivalent is added to `package.json`. +- For manual verification, interact with the dev server after logging into the backend API from `localhost:3000`. + +### Lint & Formatting +- `npm run lint` runs ESLint across `.ts/.tsx` files with the `@typescript-eslint` recommended rules and `react-hooks` enforcement. It also blocks unused directives and sets `--max-warnings 0`. +- The linter requires you to keep hooks exhaustive and avoid unused vars; prefix intentionally unused arguments with `_` (e.g., `_event`). +- `tsconfig.json` sets `strict` mode, `noUnusedLocals`, `noUnusedParameters`, and `noFallthroughCasesInSwitch`. Respect these by keeping types precise and handling every branch. + +## Frontend Style Guidelines (TypeScript + React) +### Imports & Aliases +- Use the `@/` alias defined in `tsconfig.json` for slices inside `src/` (e.g., `import Layout from '@/components/Layout'`). +- Import React/third-party packages at the top, followed by `@/` aliased modules, maintaining alphabetical order within each group. +- Prefer named exports for hooks and API utilities, default exports for page components (e.g., `export default function LoginPage()`). + +### Formatting & Syntax +- Use single quotes for strings, omit semicolons (the repo follows Prettier/Vite defaults), and keep 2-space indentation inside JSX. +- Keep JSX clean: wrap complex class combinations and conditional fragments in template literals or helper functions, avoid inline object literal props unless necessary. +- Keep React components in kebab-case file names (e.g., `Login.tsx`, `Layout.tsx`) and align component names with file names. + +### Types & Naming +- Use `interface` or `type` aliases for props and API shapes (e.g., `interface LoginRequest`), and add optional fields with `?`. +- Names for state setters, handlers, and store selectors follow camelCase (`setAuth`, `handleSubmit`, `loginMutation`). +- Use descriptive names for UI data (`navigation`, `userMenu`, `alerts`). Keep boolean flags prefixed with `is`, `has`, or `should`. + +### State, Hooks, & Effects +- Prefer `useState`/`useEffect` for local UI state and `Zustand` stores (`useAuthStore`) for shared state. +- Keep `useEffect` dependency arrays explicit; avoid disabling exhaustive-deps rules unless documented. +- Manage async server interactions with TanStack Query (`useMutation`, `useQuery`) and centralize API clients (`src/api/client.ts`). + +### Styling & Layout +- TailwindCSS classes are used for layout (`flex`, `gap`, `bg-...`). Keep className strings readable and group related classes together (spacing, color, typography). +- Use utility classes for responsive behavior (`lg:hidden`, `px-4`). For dynamic class toggling, compute the string in JS before passing it to `className`. +- Keep inline styles minimal; prefer CSS utilities and shared constants (colors, text sizing) defined in tailwind config. + +### API & Networking +- Use `src/api/client.ts` as the single Axios instance (`baseURL: '/api/v1'`). Attach request/response interceptors for auth token injection/401 handling. +- Return typed promises from API helpers (e.g., `Promise`). Let callers handle success/errors via TanStack Query callbacks. +- Use `authApi.getMe`, `authApi.login`, etc., for all backend interactions; do not re-implement Axios calls directly in UI components. + +### Error Handling +- Surface backend errors by reading `error.response?.data?.error` (as seen in `LoginPage`) and displaying friendly messages via inline UI alerts or toast components. +- Clear authentication state on 401 responses using the Axios interceptor (`useAuthStore.getState().clearAuth()`), then redirect to `/login`. +- Display loading or pending states (`loginMutation.isPending`) instead of disabling UI abruptly; provide visual feedback for async actions. + +## Repository Practices +- Keep database migration files under `db/migrations/` and refer to them from `internal/common/database/migrations/` for auto-run. +- When adding commands or packages, update the relevant `Makefile` target or `package.json` script, and document the command in this AGENTS file. +- Commit `go.mod`, `go.sum`, and `package-lock.json`/`package.json` updates together with code changes. +- Avoid committing binaries (`bin/`), coverage artifacts (`coverage.out`), or built frontend output (`frontend/dist/`). These are ignored by `.gitignore` but double-check before commits. + +## Cursor & Copilot Rules +- There are no `.cursor/rules/`, `.cursorrules`, or `.github/copilot-instructions.md` files in this repository. Follow the guidelines laid out above. diff --git a/backend/bin/calypso-api b/backend/bin/calypso-api index 41bd1bc..fe02de6 100755 Binary files a/backend/bin/calypso-api and b/backend/bin/calypso-api differ diff --git a/backend/cmd/calypso-api/main.go b/backend/cmd/calypso-api/main.go index 7c2311f..dfe9a33 100644 --- a/backend/cmd/calypso-api/main.go +++ b/backend/cmd/calypso-api/main.go @@ -65,12 +65,13 @@ func main() { r := router.NewRouter(cfg, db, logger) // Create HTTP server + // Note: WriteTimeout should be 0 for WebSocket connections (they handle their own timeouts) srv := &http.Server{ Addr: fmt.Sprintf(":%d", cfg.Server.Port), Handler: r, ReadTimeout: 15 * time.Second, - WriteTimeout: 15 * time.Second, - IdleTimeout: 60 * time.Second, + WriteTimeout: 0, // 0 means no timeout - needed for WebSocket connections + IdleTimeout: 120 * time.Second, // Increased for WebSocket keep-alive } // Setup graceful shutdown diff --git a/backend/go.mod b/backend/go.mod index 641fa0a..1afd9e2 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -5,15 +5,19 @@ go 1.24.0 toolchain go1.24.11 require ( + github.com/creack/pty v1.1.24 github.com/gin-gonic/gin v1.10.0 + github.com/go-playground/validator/v10 v10.20.0 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.3 github.com/lib/pq v1.10.9 + github.com/minio/madmin-go/v3 v3.0.110 + github.com/minio/minio-go/v7 v7.0.97 github.com/stretchr/testify v1.11.1 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.23.0 - golang.org/x/sync v0.7.0 + golang.org/x/crypto v0.37.0 + golang.org/x/sync v0.15.0 golang.org/x/time v0.14.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -21,29 +25,57 @@ require ( require ( github.com/bytedance/sonic v1.11.6 // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.20.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-json v0.10.5 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.11 // indirect + github.com/klauspost/crc32 v1.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/minio/crc64nvme v1.1.0 // indirect + github.com/minio/md5-simd v1.1.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/philhofer/fwd v1.2.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.63.0 // indirect + github.com/prometheus/procfs v0.16.0 // indirect + github.com/prometheus/prom2json v1.4.2 // indirect + github.com/prometheus/prometheus v0.303.0 // indirect + github.com/rs/xid v1.6.0 // indirect + github.com/safchain/ethtool v0.5.10 // indirect + github.com/secure-io/sio-go v0.3.1 // indirect + github.com/shirou/gopsutil/v3 v3.24.5 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/tinylib/msgp v1.3.0 // indirect + github.com/tklauser/go-sysconf v0.3.15 // indirect + github.com/tklauser/numcpus v0.10.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect - go.uber.org/multierr v1.10.0 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect ) diff --git a/backend/go.sum b/backend/go.sum index cccf836..3bb799c 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -2,19 +2,31 @@ github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= +github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -23,12 +35,17 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= +github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -36,25 +53,75 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= -github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= +github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM= +github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr325bN2FD2ISlRRztXibcX6e8f5FR5Dc= +github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/minio/crc64nvme v1.1.0 h1:e/tAguZ+4cw32D+IO/8GSf5UVr9y+3eJcxZI2WOO/7Q= +github.com/minio/crc64nvme v1.1.0/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= +github.com/minio/madmin-go/v3 v3.0.110 h1:FIYekj7YPc430ffpXFWiUtyut3qBt/unIAcDzJn9H5M= +github.com/minio/madmin-go/v3 v3.0.110/go.mod h1:WOe2kYmYl1OIlY2DSRHVQ8j1v4OItARQ6jGyQqcCud8= +github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= +github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= +github.com/minio/minio-go/v7 v7.0.97 h1:lqhREPyfgHTB/ciX8k2r8k0D93WaFqxbJX36UZq5occ= +github.com/minio/minio-go/v7 v7.0.97/go.mod h1:re5VXuo0pwEtoNLsNuSr0RrLfT/MBtohwdaSmPPSRSk= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= +github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k= +github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18= +github.com/prometheus/procfs v0.16.0 h1:xh6oHhKwnOJKMYiYBDWmkHqQPyiY40sny36Cmx2bbsM= +github.com/prometheus/procfs v0.16.0/go.mod h1:8veyXUu3nGP7oaCxhX6yeaM5u4stL2FeMXnCqhDthZg= +github.com/prometheus/prom2json v1.4.2 h1:PxCTM+Whqi/eykO1MKsEL0p/zMpxp9ybpsmdFamw6po= +github.com/prometheus/prom2json v1.4.2/go.mod h1:zuvPm7u3epZSbXPWHny6G+o8ETgu6eAK3oPr6yFkRWE= +github.com/prometheus/prometheus v0.303.0 h1:wsNNsbd4EycMCphYnTmNY9JASBVbp7NWwJna857cGpA= +github.com/prometheus/prometheus v0.303.0/go.mod h1:8PMRi+Fk1WzopMDeb0/6hbNs9nV6zgySkU/zds5Lu3o= +github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/safchain/ethtool v0.5.10 h1:Im294gZtuf4pSGJRAOGKaASNi3wMeFaGaWuSaomedpc= +github.com/safchain/ethtool v0.5.10/go.mod h1:w9jh2Lx7YBR4UwzLkzCmWl85UY0W2uZdd7/DckVE5+c= +github.com/secure-io/sio-go v0.3.1 h1:dNvY9awjabXTYGsTF1PiCySl9Ltofk9GA3VdWlo7rRc= +github.com/secure-io/sio-go v0.3.1/go.mod h1:+xbkjDzPjwh4Axd07pRKSNriS9SCiYksWnZqdnfpQxs= +github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= +github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -68,39 +135,57 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tinylib/msgp v1.3.0 h1:ULuf7GPooDaIlbyvgAxBV/FI7ynli6LZ1/nVUNu+0ww= +github.com/tinylib/msgp v1.3.0/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0= +github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= +github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= +github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= +github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= +golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/internal/backup/handler.go b/backend/internal/backup/handler.go index c3e7709..0532a1f 100644 --- a/backend/internal/backup/handler.go +++ b/backend/internal/backup/handler.go @@ -116,3 +116,281 @@ func (h *Handler) CreateJob(c *gin.Context) { c.JSON(http.StatusCreated, job) } + +// ExecuteBconsoleCommand executes a bconsole command +func (h *Handler) ExecuteBconsoleCommand(c *gin.Context) { + var req struct { + Command string `json:"command" binding:"required"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "command is required"}) + return + } + + output, err := h.service.ExecuteBconsoleCommand(c.Request.Context(), req.Command) + if err != nil { + h.logger.Error("Failed to execute bconsole command", "error", err, "command", req.Command) + c.JSON(http.StatusInternalServerError, gin.H{ + "error": "failed to execute command", + "output": output, + "details": err.Error(), + }) + return + } + + c.JSON(http.StatusOK, gin.H{ + "output": output, + }) +} + +// ListClients lists all backup clients with optional filters +func (h *Handler) ListClients(c *gin.Context) { + opts := ListClientsOptions{} + + // Parse enabled filter + if enabledStr := c.Query("enabled"); enabledStr != "" { + enabled := enabledStr == "true" + opts.Enabled = &enabled + } + + // Parse search query + opts.Search = c.Query("search") + + // Parse category filter + if category := c.Query("category"); category != "" { + // Validate category + validCategories := map[string]bool{ + "File": true, + "Database": true, + "Virtual": true, + } + if validCategories[category] { + opts.Category = category + } + } + + clients, err := h.service.ListClients(c.Request.Context(), opts) + if err != nil { + h.logger.Error("Failed to list clients", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{ + "error": "failed to list clients", + "details": err.Error(), + }) + return + } + + if clients == nil { + clients = []Client{} + } + + c.JSON(http.StatusOK, gin.H{ + "clients": clients, + "total": len(clients), + }) +} + +// GetDashboardStats returns dashboard statistics +func (h *Handler) GetDashboardStats(c *gin.Context) { + stats, err := h.service.GetDashboardStats(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to get dashboard stats", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get dashboard stats"}) + return + } + + c.JSON(http.StatusOK, stats) +} + +// ListStoragePools lists all storage pools +func (h *Handler) ListStoragePools(c *gin.Context) { + pools, err := h.service.ListStoragePools(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list storage pools", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list storage pools"}) + return + } + + if pools == nil { + pools = []StoragePool{} + } + + h.logger.Info("Listed storage pools", "count", len(pools)) + c.JSON(http.StatusOK, gin.H{ + "pools": pools, + "total": len(pools), + }) +} + +// ListStorageVolumes lists all storage volumes +func (h *Handler) ListStorageVolumes(c *gin.Context) { + poolName := c.Query("pool_name") + + volumes, err := h.service.ListStorageVolumes(c.Request.Context(), poolName) + if err != nil { + h.logger.Error("Failed to list storage volumes", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list storage volumes"}) + return + } + + if volumes == nil { + volumes = []StorageVolume{} + } + + c.JSON(http.StatusOK, gin.H{ + "volumes": volumes, + "total": len(volumes), + }) +} + +// ListStorageDaemons lists all storage daemons +func (h *Handler) ListStorageDaemons(c *gin.Context) { + daemons, err := h.service.ListStorageDaemons(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list storage daemons", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list storage daemons"}) + return + } + + if daemons == nil { + daemons = []StorageDaemon{} + } + + c.JSON(http.StatusOK, gin.H{ + "daemons": daemons, + "total": len(daemons), + }) +} + +// CreateStoragePool creates a new storage pool +func (h *Handler) CreateStoragePool(c *gin.Context) { + var req CreatePoolRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + pool, err := h.service.CreateStoragePool(c.Request.Context(), req) + if err != nil { + h.logger.Error("Failed to create storage pool", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusCreated, pool) +} + +// DeleteStoragePool deletes a storage pool +func (h *Handler) DeleteStoragePool(c *gin.Context) { + idStr := c.Param("id") + if idStr == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "pool ID is required"}) + return + } + + var poolID int + if _, err := fmt.Sscanf(idStr, "%d", &poolID); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid pool ID"}) + return + } + + err := h.service.DeleteStoragePool(c.Request.Context(), poolID) + if err != nil { + h.logger.Error("Failed to delete storage pool", "error", err, "pool_id", poolID) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "pool deleted successfully"}) +} + +// CreateStorageVolume creates a new storage volume +func (h *Handler) CreateStorageVolume(c *gin.Context) { + var req CreateVolumeRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + volume, err := h.service.CreateStorageVolume(c.Request.Context(), req) + if err != nil { + h.logger.Error("Failed to create storage volume", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusCreated, volume) +} + +// UpdateStorageVolume updates a storage volume +func (h *Handler) UpdateStorageVolume(c *gin.Context) { + idStr := c.Param("id") + if idStr == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "volume ID is required"}) + return + } + + var volumeID int + if _, err := fmt.Sscanf(idStr, "%d", &volumeID); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid volume ID"}) + return + } + + var req UpdateVolumeRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + volume, err := h.service.UpdateStorageVolume(c.Request.Context(), volumeID, req) + if err != nil { + h.logger.Error("Failed to update storage volume", "error", err, "volume_id", volumeID) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, volume) +} + +// DeleteStorageVolume deletes a storage volume +func (h *Handler) DeleteStorageVolume(c *gin.Context) { + idStr := c.Param("id") + if idStr == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "volume ID is required"}) + return + } + + var volumeID int + if _, err := fmt.Sscanf(idStr, "%d", &volumeID); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid volume ID"}) + return + } + + err := h.service.DeleteStorageVolume(c.Request.Context(), volumeID) + if err != nil { + h.logger.Error("Failed to delete storage volume", "error", err, "volume_id", volumeID) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "volume deleted successfully"}) +} + +// ListMedia lists all media from bconsole "list media" command +func (h *Handler) ListMedia(c *gin.Context) { + media, err := h.service.ListMedia(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list media", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + if media == nil { + media = []Media{} + } + + h.logger.Info("Listed media", "count", len(media)) + c.JSON(http.StatusOK, gin.H{ + "media": media, + "total": len(media), + }) +} diff --git a/backend/internal/backup/service.go b/backend/internal/backup/service.go index 7a2a9fd..4de6481 100644 --- a/backend/internal/backup/service.go +++ b/backend/internal/backup/service.go @@ -78,6 +78,87 @@ type ListJobsOptions struct { Offset int // Offset for pagination } +// Client represents a backup client +type Client struct { + ClientID int `json:"client_id"` + Name string `json:"name"` + Uname *string `json:"uname,omitempty"` + Enabled bool `json:"enabled"` + Category *string `json:"category,omitempty"` // "File", "Database", "Virtual" + AutoPrune *bool `json:"auto_prune,omitempty"` + FileRetention *int64 `json:"file_retention,omitempty"` + JobRetention *int64 `json:"job_retention,omitempty"` + LastBackupAt *time.Time `json:"last_backup_at,omitempty"` + TotalJobs *int `json:"total_jobs,omitempty"` + TotalBytes *int64 `json:"total_bytes,omitempty"` + Status *string `json:"status,omitempty"` // "online" or "offline" +} + +// ListClientsOptions represents filtering options for clients +type ListClientsOptions struct { + Enabled *bool // Filter by enabled status (nil = all) + Search string // Search by client name + Category string // Filter by category: "File", "Database", "Virtual" (empty = all) +} + +// DashboardStats represents statistics for the backup dashboard +type DashboardStats struct { + DirectorStatus string `json:"director_status"` // "Active" or "Inactive" + DirectorUptime string `json:"director_uptime"` // e.g., "14d 2h 12m" + LastJob *Job `json:"last_job,omitempty"` + ActiveJobsCount int `json:"active_jobs_count"` + DefaultPool *PoolStats `json:"default_pool,omitempty"` +} + +// PoolStats represents pool storage statistics +type PoolStats struct { + Name string `json:"name"` + UsedBytes int64 `json:"used_bytes"` + TotalBytes int64 `json:"total_bytes"` + UsagePercent float64 `json:"usage_percent"` +} + +// StoragePool represents a Bacula storage pool +type StoragePool struct { + PoolID int `json:"pool_id"` + Name string `json:"name"` + PoolType string `json:"pool_type"` + LabelFormat *string `json:"label_format,omitempty"` + Recycle *bool `json:"recycle,omitempty"` + AutoPrune *bool `json:"auto_prune,omitempty"` + VolumeCount int `json:"volume_count"` + UsedBytes int64 `json:"used_bytes"` + TotalBytes int64 `json:"total_bytes"` + UsagePercent float64 `json:"usage_percent"` +} + +// StorageVolume represents a Bacula storage volume +type StorageVolume struct { + VolumeID int `json:"volume_id"` + MediaID int `json:"media_id"` + VolumeName string `json:"volume_name"` + PoolName string `json:"pool_name"` + MediaType string `json:"media_type"` + VolStatus string `json:"vol_status"` // Full, Append, Used, Error, etc. + VolBytes int64 `json:"vol_bytes"` + MaxVolBytes int64 `json:"max_vol_bytes"` + VolFiles int `json:"vol_files"` + VolRetention *time.Time `json:"vol_retention,omitempty"` + LastWritten *time.Time `json:"last_written,omitempty"` + RecycleCount int `json:"recycle_count"` +} + +// StorageDaemon represents a Bacula storage daemon +type StorageDaemon struct { + StorageID int `json:"storage_id"` + Name string `json:"name"` + Address string `json:"address"` + Port int `json:"port"` + DeviceName string `json:"device_name"` + MediaType string `json:"media_type"` + Status string `json:"status"` // Online, Offline +} + // SyncJobsFromBacula syncs jobs from Bacula/Bareos to the database // Tries to query Bacula database directly first, falls back to bconsole if database access fails func (s *Service) SyncJobsFromBacula(ctx context.Context) error { @@ -233,7 +314,8 @@ func (s *Service) queryBaculaDirect(ctx context.Context) ([]Job, error) { // syncFromBconsole syncs jobs using bconsole command (fallback method) func (s *Service) syncFromBconsole(ctx context.Context) error { // Execute bconsole command to list jobs - cmd := exec.CommandContext(ctx, "sh", "-c", "echo -e 'list jobs\nquit' | bconsole") + bconsoleConfig := "/opt/calypso/conf/bacula/bconsole.conf" + cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("echo -e 'list jobs\nquit' | bconsole -c %s", bconsoleConfig)) output, err := cmd.CombinedOutput() if err != nil { @@ -428,7 +510,8 @@ func (s *Service) parseBconsoleOutput(ctx context.Context, output string) []Job // getClientNameFromJob gets client name from job details using bconsole func (s *Service) getClientNameFromJob(ctx context.Context, jobID int) string { // Execute bconsole to get job details - cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("echo -e 'list job jobid=%d\nquit' | bconsole", jobID)) + bconsoleConfig := "/opt/calypso/conf/bacula/bconsole.conf" + cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("echo -e 'list job jobid=%d\nquit' | bconsole -c %s", jobID, bconsoleConfig)) output, err := cmd.CombinedOutput() if err != nil { @@ -451,6 +534,424 @@ func (s *Service) getClientNameFromJob(ctx context.Context, jobID int) string { return "" } +// ExecuteBconsoleCommand executes a bconsole command and returns the output +func (s *Service) ExecuteBconsoleCommand(ctx context.Context, command string) (string, error) { + // Sanitize command + command = strings.TrimSpace(command) + if command == "" { + return "", fmt.Errorf("command cannot be empty") + } + + // Remove any existing quit commands from user input + command = strings.TrimSuffix(strings.ToLower(command), "quit") + command = strings.TrimSpace(command) + + // Ensure command ends with quit + commandWithQuit := command + "\nquit" + + // Use printf instead of echo -e for better compatibility + // Escape single quotes in command + escapedCommand := strings.ReplaceAll(commandWithQuit, "'", "'\"'\"'") + + // Execute bconsole command using printf to avoid echo -e issues + // Use -c flag to specify config file location + bconsoleConfig := "/opt/calypso/conf/bacula/bconsole.conf" + cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("printf '%%s\\n' '%s' | bconsole -c %s", escapedCommand, bconsoleConfig)) + + output, err := cmd.CombinedOutput() + if err != nil { + // bconsole may return non-zero exit code even on success, so check output + outputStr := string(output) + if len(outputStr) > 0 { + // If there's output, return it even if there's an error + return outputStr, nil + } + return outputStr, fmt.Errorf("bconsole error: %w", err) + } + + return string(output), nil +} + +// ListClients lists all backup clients from Bacula database Client table +// Falls back to bconsole if database connection is not available +func (s *Service) ListClients(ctx context.Context, opts ListClientsOptions) ([]Client, error) { + // Try database first if available + if s.baculaDB != nil { + clients, err := s.queryClientsFromDatabase(ctx, opts) + if err == nil { + s.logger.Debug("Queried clients from Bacula database", "count", len(clients)) + return clients, nil + } + s.logger.Warn("Failed to query clients from database, trying bconsole fallback", "error", err) + } + + // Fallback to bconsole + s.logger.Info("Using bconsole fallback for list clients") + return s.queryClientsFromBconsole(ctx, opts) +} + +// queryClientsFromDatabase queries clients from Bacula database +func (s *Service) queryClientsFromDatabase(ctx context.Context, opts ListClientsOptions) ([]Client, error) { + // First, try a simple query to check if Client table exists and has data + simpleQuery := `SELECT COUNT(*) FROM Client` + var count int + err := s.baculaDB.QueryRowContext(ctx, simpleQuery).Scan(&count) + if err != nil { + s.logger.Warn("Failed to count clients from Client table", "error", err) + return nil, fmt.Errorf("failed to query Client table: %w", err) + } + s.logger.Debug("Total clients in database", "count", count) + + if count == 0 { + s.logger.Info("No clients found in Bacula database") + return []Client{}, nil + } + + // Build query with filters + query := ` + SELECT + c.ClientId, + c.Name, + c.Uname, + true as enabled, + c.AutoPrune, + c.FileRetention, + c.JobRetention, + MAX(j.StartTime) as last_backup_at, + COUNT(DISTINCT j.JobId) as total_jobs, + COALESCE(SUM(j.JobBytes), 0) as total_bytes + FROM Client c + LEFT JOIN Job j ON c.ClientId = j.ClientId + WHERE 1=1 + ` + + args := []interface{}{} + argIndex := 1 + + if opts.Enabled != nil { + query += fmt.Sprintf(" AND true = $%d", argIndex) + args = append(args, *opts.Enabled) + argIndex++ + } + + if opts.Search != "" { + query += fmt.Sprintf(" AND c.Name ILIKE $%d", argIndex) + args = append(args, "%"+opts.Search+"%") + argIndex++ + } + + query += " GROUP BY c.ClientId, c.Name, c.Uname, c.AutoPrune, c.FileRetention, c.JobRetention" + query += " ORDER BY c.Name" + + s.logger.Debug("Executing clients query", "query", query, "args", args) + rows, err := s.baculaDB.QueryContext(ctx, query, args...) + if err != nil { + s.logger.Error("Failed to execute clients query", "error", err, "query", query) + return nil, fmt.Errorf("failed to query clients from Bacula database: %w", err) + } + defer rows.Close() + + var clients []Client + for rows.Next() { + var client Client + var uname sql.NullString + var autoPrune sql.NullBool + var fileRetention, jobRetention sql.NullInt64 + var lastBackupAt sql.NullTime + var totalJobs sql.NullInt64 + var totalBytes sql.NullInt64 + + err := rows.Scan( + &client.ClientID, + &client.Name, + &uname, + &client.Enabled, + &autoPrune, + &fileRetention, + &jobRetention, + &lastBackupAt, + &totalJobs, + &totalBytes, + ) + if err != nil { + s.logger.Error("Failed to scan client row", "error", err) + continue + } + + if uname.Valid { + client.Uname = &uname.String + } + if autoPrune.Valid { + client.AutoPrune = &autoPrune.Bool + } + if fileRetention.Valid { + val := fileRetention.Int64 + client.FileRetention = &val + } + if jobRetention.Valid { + val := jobRetention.Int64 + client.JobRetention = &val + } + if lastBackupAt.Valid { + client.LastBackupAt = &lastBackupAt.Time + } + if totalJobs.Valid { + val := int(totalJobs.Int64) + client.TotalJobs = &val + } + if totalBytes.Valid { + val := totalBytes.Int64 + client.TotalBytes = &val + } + + // Determine client status based on enabled and last backup + // If client is enabled and has recent backup (within 24 hours), consider it online + // Otherwise, mark as offline + if client.Enabled { + if lastBackupAt.Valid { + timeSinceLastBackup := time.Since(lastBackupAt.Time) + if timeSinceLastBackup < 24*time.Hour { + status := "online" + client.Status = &status + } else { + status := "offline" + client.Status = &status + } + } else { + // No backup yet, but enabled - assume online + status := "online" + client.Status = &status + } + } else { + status := "offline" + client.Status = &status + } + + clients = append(clients, client) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating client rows: %w", err) + } + + // Load categories from Calypso database + if err := s.loadClientCategories(ctx, clients); err != nil { + s.logger.Warn("Failed to load client categories", "error", err) + // Continue without categories, set default to "File" + for i := range clients { + if clients[i].Category == nil { + defaultCategory := "File" + clients[i].Category = &defaultCategory + } + } + } + + // Filter by category if specified + if opts.Category != "" { + filtered := []Client{} + for _, client := range clients { + if client.Category != nil && *client.Category == opts.Category { + filtered = append(filtered, client) + } + } + clients = filtered + } + + s.logger.Debug("Queried clients from Bacula database", "count", len(clients)) + return clients, nil +} + +// loadClientCategories loads category information from Calypso database +func (s *Service) loadClientCategories(ctx context.Context, clients []Client) error { + if len(clients) == 0 { + return nil + } + + // Build query to get categories for all client IDs + clientIDs := make([]interface{}, len(clients)) + for i, client := range clients { + clientIDs[i] = client.ClientID + } + + // Create placeholders for IN clause + placeholders := make([]string, len(clientIDs)) + args := make([]interface{}, len(clientIDs)) + for i := range clientIDs { + placeholders[i] = fmt.Sprintf("$%d", i+1) + args[i] = clientIDs[i] + } + + query := fmt.Sprintf(` + SELECT client_id, category + FROM client_metadata + WHERE client_id IN (%s) + `, strings.Join(placeholders, ",")) + + rows, err := s.db.QueryContext(ctx, query, args...) + if err != nil { + // Table might not exist yet (migration not run), return nil error + if strings.Contains(err.Error(), "does not exist") { + return nil + } + return fmt.Errorf("failed to query client categories: %w", err) + } + defer rows.Close() + + // Create map of client_id -> category + categoryMap := make(map[int]string) + for rows.Next() { + var clientID int + var category string + if err := rows.Scan(&clientID, &category); err != nil { + continue + } + categoryMap[clientID] = category + } + + // Assign categories to clients + for i := range clients { + if category, exists := categoryMap[clients[i].ClientID]; exists { + clients[i].Category = &category + } else { + // Default to "File" if no category found + defaultCategory := "File" + clients[i].Category = &defaultCategory + } + } + + return nil +} + +// queryClientsFromBconsole queries clients using bconsole command (fallback method) +func (s *Service) queryClientsFromBconsole(ctx context.Context, opts ListClientsOptions) ([]Client, error) { + // Execute bconsole command to list clients + s.logger.Debug("Executing bconsole list clients command") + output, err := s.ExecuteBconsoleCommand(ctx, "list clients") + if err != nil { + s.logger.Error("Failed to execute bconsole list clients", "error", err) + return nil, fmt.Errorf("failed to execute bconsole list clients: %w", err) + } + + previewLen := 200 + if len(output) < previewLen { + previewLen = len(output) + } + s.logger.Debug("bconsole output", "output_length", len(output), "output_preview", output[:previewLen]) + + // Parse bconsole output + clients := s.parseBconsoleClientsOutput(output) + s.logger.Debug("Parsed clients from bconsole", "count", len(clients)) + + // Load categories from Calypso database + if err := s.loadClientCategories(ctx, clients); err != nil { + s.logger.Warn("Failed to load client categories", "error", err) + // Continue without categories, set default to "File" + for i := range clients { + if clients[i].Category == nil { + defaultCategory := "File" + clients[i].Category = &defaultCategory + } + } + } + + // Apply filters + filtered := []Client{} + for _, client := range clients { + if opts.Enabled != nil && client.Enabled != *opts.Enabled { + continue + } + if opts.Search != "" && !strings.Contains(strings.ToLower(client.Name), strings.ToLower(opts.Search)) { + continue + } + if opts.Category != "" { + if client.Category == nil || *client.Category != opts.Category { + continue + } + } + filtered = append(filtered, client) + } + + return filtered, nil +} + +// parseBconsoleClientsOutput parses bconsole "list clients" output +func (s *Service) parseBconsoleClientsOutput(output string) []Client { + var clients []Client + lines := strings.Split(output, "\n") + + inTable := false + headerFound := false + + for _, line := range lines { + line = strings.TrimSpace(line) + + // Skip connection messages and command echo + if strings.Contains(line, "Connecting to Director") || + strings.Contains(line, "Enter a period") || + strings.Contains(line, "list clients") || + strings.Contains(line, "quit") || + strings.Contains(line, "You have messages") || + strings.Contains(line, "Automatically selected") || + strings.Contains(line, "Using Catalog") { + continue + } + + // Detect table header + if !headerFound && (strings.Contains(line, "Name") || strings.Contains(line, "| Name")) { + headerFound = true + inTable = true + continue + } + + // Detect table separator + if strings.HasPrefix(line, "+") && strings.Contains(line, "-") { + continue + } + + // Skip empty lines + if line == "" { + continue + } + + // Parse table rows (format: | clientname | address |) + if inTable && strings.Contains(line, "|") { + parts := strings.Split(line, "|") + if len(parts) >= 2 { + clientName := strings.TrimSpace(parts[1]) + clientName = strings.Trim(clientName, "\"'") + + if clientName == "" || clientName == "Name" || strings.HasPrefix(clientName, "-") { + continue + } + + client := Client{ + ClientID: 0, + Name: clientName, + Enabled: true, + } + clients = append(clients, client) + } + } else if inTable && !strings.Contains(line, "|") { + // Fallback format + parts := strings.Fields(line) + if len(parts) > 0 { + clientName := parts[0] + clientName = strings.Trim(clientName, "\"'") + if clientName != "" && clientName != "Name" && !strings.HasPrefix(clientName, "-") { + client := Client{ + ClientID: 0, + Name: clientName, + Enabled: true, + } + clients = append(clients, client) + } + } + } + } + + return clients +} + // upsertJob inserts or updates a job in the database func (s *Service) upsertJob(ctx context.Context, job Job) error { query := ` @@ -779,3 +1280,1215 @@ func (s *Service) CreateJob(ctx context.Context, req CreateJobRequest) (*Job, er return &job, nil } + +// GetDashboardStats returns statistics for the backup dashboard +func (s *Service) GetDashboardStats(ctx context.Context) (*DashboardStats, error) { + stats := &DashboardStats{ + DirectorStatus: "Active", // Default to active + ActiveJobsCount: 0, + } + + // Get director status and uptime from bconsole + output, err := s.ExecuteBconsoleCommand(ctx, "status director") + if err == nil && len(output) > 0 { + // If bconsole returns output, director is active + // Parse output to extract uptime + lines := strings.Split(output, "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + // Look for "Daemon started" line which contains uptime info + if strings.Contains(line, "Daemon started") { + stats.DirectorStatus = "Active" + stats.DirectorUptime = s.parseUptimeFromStatus(line) + break + } + // Also check for version line as indicator of active director + if strings.Contains(line, "Version:") { + stats.DirectorStatus = "Active" + } + } + + // If we didn't find uptime yet, try to parse from any date in the output + if stats.DirectorUptime == "" { + for _, line := range lines { + line = strings.TrimSpace(line) + if strings.Contains(line, "started") || strings.Contains(line, "since") { + uptime := s.parseUptimeFromStatus(line) + if uptime != "Unknown" { + stats.DirectorUptime = uptime + break + } + } + } + } + + // If still no uptime, set default + if stats.DirectorUptime == "" { + stats.DirectorUptime = "Active" + } + } else { + s.logger.Warn("Failed to get director status from bconsole", "error", err) + stats.DirectorStatus = "Inactive" + stats.DirectorUptime = "Unknown" + } + + // Get last completed job + lastJobQuery := ` + SELECT id, job_id, job_name, client_name, job_type, job_level, status, + bytes_written, files_written, started_at, ended_at, created_at, updated_at + FROM backup_jobs + WHERE status = 'Completed' + ORDER BY ended_at DESC NULLS LAST, started_at DESC + LIMIT 1 + ` + var lastJob Job + var startedAt, endedAt sql.NullTime + err = s.db.QueryRowContext(ctx, lastJobQuery).Scan( + &lastJob.ID, &lastJob.JobID, &lastJob.JobName, &lastJob.ClientName, + &lastJob.JobType, &lastJob.JobLevel, &lastJob.Status, + &lastJob.BytesWritten, &lastJob.FilesWritten, + &startedAt, &endedAt, &lastJob.CreatedAt, &lastJob.UpdatedAt, + ) + if err == nil { + if startedAt.Valid { + lastJob.StartedAt = &startedAt.Time + } + if endedAt.Valid { + lastJob.EndedAt = &endedAt.Time + } + // Calculate duration + if lastJob.StartedAt != nil && lastJob.EndedAt != nil { + duration := int(lastJob.EndedAt.Sub(*lastJob.StartedAt).Seconds()) + lastJob.DurationSeconds = &duration + } + stats.LastJob = &lastJob + } else if err != sql.ErrNoRows { + s.logger.Warn("Failed to get last job", "error", err) + } + + // Count active (running) jobs + activeJobsQuery := `SELECT COUNT(*) FROM backup_jobs WHERE status = 'Running'` + err = s.db.QueryRowContext(ctx, activeJobsQuery).Scan(&stats.ActiveJobsCount) + if err != nil { + s.logger.Warn("Failed to count active jobs", "error", err) + } + + // Get default pool stats from Bacula database + if s.baculaDB != nil { + poolStats, err := s.getDefaultPoolStats(ctx) + if err == nil { + stats.DefaultPool = poolStats + } else { + s.logger.Warn("Failed to get pool stats", "error", err) + } + } + + return stats, nil +} + +// parseUptimeFromStatus parses uptime from bconsole status output +func (s *Service) parseUptimeFromStatus(line string) string { + // Look for "Daemon started" pattern: "Daemon started 28-Dec-25 01:45" + // Bacula format: "28-Dec-25 01:45" or "30-Dec-2025 02:24:58" + + // Try to find date pattern in the line + // Format: "DD-MMM-YY HH:MM" or "DD-MMM-YYYY HH:MM:SS" + words := strings.Fields(line) + for i := 0; i < len(words); i++ { + word := words[i] + // Check if word looks like a date (contains "-" and month abbreviation) + if strings.Contains(word, "-") && (strings.Contains(word, "Jan") || + strings.Contains(word, "Feb") || strings.Contains(word, "Mar") || + strings.Contains(word, "Apr") || strings.Contains(word, "May") || + strings.Contains(word, "Jun") || strings.Contains(word, "Jul") || + strings.Contains(word, "Aug") || strings.Contains(word, "Sep") || + strings.Contains(word, "Oct") || strings.Contains(word, "Nov") || + strings.Contains(word, "Dec")) { + + // Try to parse date + time + var dateTimeStr string + if i+1 < len(words) { + // Date + time (2 words) + dateTimeStr = word + " " + words[i+1] + } else { + dateTimeStr = word + } + + // Try different date formats + formats := []string{ + "02-Jan-06 15:04", // "28-Dec-25 01:45" + "02-Jan-2006 15:04:05", // "30-Dec-2025 02:24:58" + "02-Jan-2006 15:04", // "30-Dec-2025 02:24" + "2006-01-02 15:04:05", // ISO format + "2006-01-02 15:04", // ISO format without seconds + } + + for _, format := range formats { + if t, err := time.Parse(format, dateTimeStr); err == nil { + duration := time.Since(t) + return s.formatUptime(duration) + } + } + } + } + + return "Unknown" +} + +// formatUptime formats a duration as "Xd Xh Xm" +func (s *Service) formatUptime(duration time.Duration) string { + days := int(duration.Hours() / 24) + hours := int(duration.Hours()) % 24 + minutes := int(duration.Minutes()) % 60 + + if days > 0 { + return fmt.Sprintf("%dd %dh %dm", days, hours, minutes) + } + if hours > 0 { + return fmt.Sprintf("%dh %dm", hours, minutes) + } + return fmt.Sprintf("%dm", minutes) +} + +// getDefaultPoolStats gets statistics for the default pool from Bacula database +func (s *Service) getDefaultPoolStats(ctx context.Context) (*PoolStats, error) { + // Query Pool table for default pool (usually named "Default" or "Full") + query := ` + SELECT + p.Name, + COALESCE(SUM(v.VolBytes), 0) as used_bytes, + COALESCE(SUM(v.MaxVolBytes), 0) as total_bytes + FROM Pool p + LEFT JOIN Media m ON p.PoolId = m.PoolId + LEFT JOIN Volumes v ON m.MediaId = v.MediaId + WHERE p.Name = 'Default' OR p.Name = 'Full' + GROUP BY p.Name + ORDER BY p.Name + LIMIT 1 + ` + + var pool PoolStats + var name sql.NullString + var usedBytes, totalBytes sql.NullInt64 + + err := s.baculaDB.QueryRowContext(ctx, query).Scan(&name, &usedBytes, &totalBytes) + if err != nil { + if err == sql.ErrNoRows { + // Try alternative query - get pool with most volumes + altQuery := ` + SELECT + p.Name, + COALESCE(SUM(v.VolBytes), 0) as used_bytes, + COALESCE(SUM(v.MaxVolBytes), 0) as total_bytes + FROM Pool p + LEFT JOIN Media m ON p.PoolId = m.PoolId + LEFT JOIN Volumes v ON m.MediaId = v.MediaId + GROUP BY p.Name + ORDER BY COUNT(m.MediaId) DESC + LIMIT 1 + ` + err = s.baculaDB.QueryRowContext(ctx, altQuery).Scan(&name, &usedBytes, &totalBytes) + if err != nil { + return nil, fmt.Errorf("failed to query pool stats: %w", err) + } + } else { + return nil, fmt.Errorf("failed to query pool stats: %w", err) + } + } + + if name.Valid { + pool.Name = name.String + } + if usedBytes.Valid { + pool.UsedBytes = usedBytes.Int64 + } + if totalBytes.Valid { + pool.TotalBytes = totalBytes.Int64 + } + + // Calculate usage percent + if pool.TotalBytes > 0 { + pool.UsagePercent = float64(pool.UsedBytes) / float64(pool.TotalBytes) * 100 + } else { + // If total is 0, set total to used to show 100% if there's data + if pool.UsedBytes > 0 { + pool.TotalBytes = pool.UsedBytes + pool.UsagePercent = 100.0 + } + } + + return &pool, nil +} + +// ListStoragePools lists all storage pools from Bacula database +func (s *Service) ListStoragePools(ctx context.Context) ([]StoragePool, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + query := ` + SELECT + p.PoolId, + p.Name, + COALESCE(p.PoolType, 'Backup') as PoolType, + p.LabelFormat, + p.Recycle, + p.AutoPrune, + COALESCE(COUNT(DISTINCT m.MediaId), 0) as volume_count, + COALESCE(SUM(m.VolBytes), 0) as used_bytes, + COALESCE(SUM(m.VolBytes), 0) as total_bytes + FROM Pool p + LEFT JOIN Media m ON p.PoolId = m.PoolId + GROUP BY p.PoolId, p.Name, p.PoolType, p.LabelFormat, p.Recycle, p.AutoPrune + ORDER BY p.Name + ` + + rows, err := s.baculaDB.QueryContext(ctx, query) + if err != nil { + return nil, fmt.Errorf("failed to query storage pools: %w", err) + } + defer rows.Close() + + var pools []StoragePool + for rows.Next() { + var pool StoragePool + var labelFormat, poolType sql.NullString + var recycle, autoPrune sql.NullBool + var usedBytes, totalBytes sql.NullInt64 + + err := rows.Scan( + &pool.PoolID, &pool.Name, &poolType, &labelFormat, + &recycle, &autoPrune, &pool.VolumeCount, + &usedBytes, &totalBytes, + ) + if err != nil { + s.logger.Error("Failed to scan pool row", "error", err) + continue + } + + // Set default pool type if null + if poolType.Valid && poolType.String != "" { + pool.PoolType = poolType.String + } else { + pool.PoolType = "Backup" // Default + } + + if labelFormat.Valid && labelFormat.String != "" { + pool.LabelFormat = &labelFormat.String + } + if recycle.Valid { + pool.Recycle = &recycle.Bool + } + if autoPrune.Valid { + pool.AutoPrune = &autoPrune.Bool + } + if usedBytes.Valid { + pool.UsedBytes = usedBytes.Int64 + } else { + pool.UsedBytes = 0 + } + if totalBytes.Valid { + pool.TotalBytes = totalBytes.Int64 + } else { + pool.TotalBytes = 0 + } + + // Calculate usage percent + if pool.TotalBytes > 0 { + pool.UsagePercent = float64(pool.UsedBytes) / float64(pool.TotalBytes) * 100 + } else if pool.UsedBytes > 0 { + pool.TotalBytes = pool.UsedBytes + pool.UsagePercent = 100.0 + } else { + pool.UsagePercent = 0.0 + } + + s.logger.Debug("Loaded pool", "pool_id", pool.PoolID, "name", pool.Name, "type", pool.PoolType, "volumes", pool.VolumeCount) + pools = append(pools, pool) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating pool rows: %w", err) + } + + return pools, nil +} + +// ListStorageVolumes lists all storage volumes from Bacula database +func (s *Service) ListStorageVolumes(ctx context.Context, poolName string) ([]StorageVolume, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + query := ` + SELECT + v.VolumeId, + v.MediaId, + v.VolumeName, + COALESCE(p.Name, 'Unknown') as pool_name, + m.MediaType, + v.VolStatus, + COALESCE(v.VolBytes, 0) as vol_bytes, + COALESCE(v.MaxVolBytes, 0) as max_vol_bytes, + COALESCE(v.VolFiles, 0) as vol_files, + v.VolRetention, + v.LastWritten, + COALESCE(v.RecycleCount, 0) as recycle_count + FROM Volumes v + LEFT JOIN Media m ON v.MediaId = m.MediaId + LEFT JOIN Pool p ON m.PoolId = p.PoolId + WHERE 1=1 + ` + args := []interface{}{} + argIndex := 1 + + if poolName != "" { + query += fmt.Sprintf(" AND p.Name = $%d", argIndex) + args = append(args, poolName) + argIndex++ + } + + query += " ORDER BY v.LastWritten DESC NULLS LAST, v.VolumeName" + + rows, err := s.baculaDB.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("failed to query storage volumes: %w", err) + } + defer rows.Close() + + var volumes []StorageVolume + for rows.Next() { + var vol StorageVolume + var volRetention, lastWritten sql.NullTime + + err := rows.Scan( + &vol.VolumeID, &vol.MediaID, &vol.VolumeName, &vol.PoolName, + &vol.MediaType, &vol.VolStatus, &vol.VolBytes, &vol.MaxVolBytes, + &vol.VolFiles, &volRetention, &lastWritten, &vol.RecycleCount, + ) + if err != nil { + s.logger.Error("Failed to scan volume row", "error", err) + continue + } + + if volRetention.Valid { + vol.VolRetention = &volRetention.Time + } + if lastWritten.Valid { + vol.LastWritten = &lastWritten.Time + } + + volumes = append(volumes, vol) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating volume rows: %w", err) + } + + return volumes, nil +} + +// ListStorageDaemons lists all storage daemons from Bacula database +func (s *Service) ListStorageDaemons(ctx context.Context) ([]StorageDaemon, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + // Query only columns that exist in Storage table + query := ` + SELECT + s.StorageId, + s.Name, + s.Autochanger + FROM Storage s + ORDER BY s.Name + ` + + rows, err := s.baculaDB.QueryContext(ctx, query) + if err != nil { + return nil, fmt.Errorf("failed to query storage daemons: %w", err) + } + defer rows.Close() + + var daemons []StorageDaemon + for rows.Next() { + var daemon StorageDaemon + var autochanger sql.NullInt64 + + err := rows.Scan( + &daemon.StorageID, &daemon.Name, &autochanger, + ) + if err != nil { + s.logger.Error("Failed to scan storage daemon row", "error", err) + continue + } + + // Get detailed information from bconsole + details, err := s.getStorageDaemonDetails(ctx, daemon.Name) + if err != nil { + s.logger.Warn("Failed to get storage daemon details from bconsole", "name", daemon.Name, "error", err) + // Continue with defaults + daemon.Status = "Unknown" + } else { + daemon.Address = details.Address + daemon.Port = details.Port + daemon.DeviceName = details.DeviceName + daemon.MediaType = details.MediaType + daemon.Status = details.Status + } + + daemons = append(daemons, daemon) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating storage daemon rows: %w", err) + } + + return daemons, nil +} + +// getStorageDaemonDetails retrieves detailed information about a storage daemon using bconsole +func (s *Service) getStorageDaemonDetails(ctx context.Context, storageName string) (*StorageDaemon, error) { + bconsoleConfig := "/opt/calypso/conf/bacula/bconsole.conf" + cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("echo -e 'show storage=%s\nquit' | bconsole -c %s", storageName, bconsoleConfig)) + + output, err := cmd.CombinedOutput() + if err != nil { + return nil, fmt.Errorf("failed to execute bconsole: %w", err) + } + + // Parse bconsole output + // Example output: + // Autochanger: name=File1 address=localhost SDport=9103 MaxJobs=10 NumJobs=0 + // DeviceName=FileChgr1 MediaType=File1 StorageId=1 Autochanger=1 + outputStr := string(output) + + daemon := &StorageDaemon{ + Name: storageName, + Status: "Online", // Default, could check connection status + } + + // Parse address + if idx := strings.Index(outputStr, "address="); idx != -1 { + addrStart := idx + len("address=") + addrEnd := strings.IndexAny(outputStr[addrStart:], " \n") + if addrEnd == -1 { + addrEnd = len(outputStr) - addrStart + } + daemon.Address = strings.TrimSpace(outputStr[addrStart : addrStart+addrEnd]) + } + + // Parse port (SDport) + if idx := strings.Index(outputStr, "SDport="); idx != -1 { + portStart := idx + len("SDport=") + portEnd := strings.IndexAny(outputStr[portStart:], " \n") + if portEnd == -1 { + portEnd = len(outputStr) - portStart + } + if port, err := strconv.Atoi(strings.TrimSpace(outputStr[portStart : portStart+portEnd])); err == nil { + daemon.Port = port + } + } + + // Parse DeviceName + if idx := strings.Index(outputStr, "DeviceName="); idx != -1 { + devStart := idx + len("DeviceName=") + devEnd := strings.IndexAny(outputStr[devStart:], " \n") + if devEnd == -1 { + devEnd = len(outputStr) - devStart + } + daemon.DeviceName = strings.TrimSpace(outputStr[devStart : devStart+devEnd]) + } + + // Parse MediaType + if idx := strings.Index(outputStr, "MediaType="); idx != -1 { + mediaStart := idx + len("MediaType=") + mediaEnd := strings.IndexAny(outputStr[mediaStart:], " \n") + if mediaEnd == -1 { + mediaEnd = len(outputStr) - mediaStart + } + daemon.MediaType = strings.TrimSpace(outputStr[mediaStart : mediaStart+mediaEnd]) + } + + // Check if storage is online by checking for connection errors in output + if strings.Contains(outputStr, "ERR") || strings.Contains(outputStr, "Error") { + daemon.Status = "Offline" + } + + return daemon, nil +} + +// CreatePoolRequest represents a request to create a new storage pool +type CreatePoolRequest struct { + Name string `json:"name" binding:"required"` + PoolType string `json:"pool_type"` // Backup, Scratch, Recycle + LabelFormat *string `json:"label_format,omitempty"` + Recycle *bool `json:"recycle,omitempty"` + AutoPrune *bool `json:"auto_prune,omitempty"` +} + +// CreateStoragePool creates a new storage pool in Bacula database +func (s *Service) CreateStoragePool(ctx context.Context, req CreatePoolRequest) (*StoragePool, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + // Validate pool name + if req.Name == "" { + return nil, fmt.Errorf("pool name is required") + } + + // Check if pool already exists + var existingID int + err := s.baculaDB.QueryRowContext(ctx, "SELECT PoolId FROM Pool WHERE Name = $1", req.Name).Scan(&existingID) + if err == nil { + return nil, fmt.Errorf("pool with name %s already exists", req.Name) + } else if err != sql.ErrNoRows { + return nil, fmt.Errorf("failed to check existing pool: %w", err) + } + + // Set defaults + poolType := req.PoolType + if poolType == "" { + poolType = "Backup" // Default to Backup pool + } + + // Insert new pool + query := ` + INSERT INTO Pool (Name, PoolType, LabelFormat, Recycle, AutoPrune) + VALUES ($1, $2, $3, $4, $5) + RETURNING PoolId, Name, PoolType, LabelFormat, Recycle, AutoPrune + ` + + var pool StoragePool + var labelFormat sql.NullString + var recycle, autoPrune sql.NullBool + + err = s.baculaDB.QueryRowContext(ctx, query, + req.Name, poolType, req.LabelFormat, req.Recycle, req.AutoPrune, + ).Scan( + &pool.PoolID, &pool.Name, &pool.PoolType, &labelFormat, &recycle, &autoPrune, + ) + if err != nil { + return nil, fmt.Errorf("failed to create pool: %w", err) + } + + if labelFormat.Valid { + pool.LabelFormat = &labelFormat.String + } + if recycle.Valid { + pool.Recycle = &recycle.Bool + } + if autoPrune.Valid { + pool.AutoPrune = &autoPrune.Bool + } + + pool.VolumeCount = 0 + pool.UsedBytes = 0 + pool.TotalBytes = 0 + pool.UsagePercent = 0 + + s.logger.Info("Storage pool created", "pool_id", pool.PoolID, "name", pool.Name, "type", pool.PoolType) + return &pool, nil +} + +// DeleteStoragePool deletes a storage pool from Bacula database +func (s *Service) DeleteStoragePool(ctx context.Context, poolID int) error { + if s.baculaDB == nil { + return fmt.Errorf("Bacula database connection not configured") + } + + // Check if pool exists and get name + var poolName string + err := s.baculaDB.QueryRowContext(ctx, "SELECT Name FROM Pool WHERE PoolId = $1", poolID).Scan(&poolName) + if err == sql.ErrNoRows { + return fmt.Errorf("pool not found") + } else if err != nil { + return fmt.Errorf("failed to check pool: %w", err) + } + + // Check if pool has volumes + var volumeCount int + err = s.baculaDB.QueryRowContext(ctx, ` + SELECT COUNT(*) FROM Media m + INNER JOIN Pool p ON m.PoolId = p.PoolId + WHERE p.PoolId = $1 + `, poolID).Scan(&volumeCount) + if err != nil { + return fmt.Errorf("failed to check pool volumes: %w", err) + } + + if volumeCount > 0 { + return fmt.Errorf("cannot delete pool %s: pool contains %d volumes. Please remove or move volumes first", poolName, volumeCount) + } + + // Delete pool + _, err = s.baculaDB.ExecContext(ctx, "DELETE FROM Pool WHERE PoolId = $1", poolID) + if err != nil { + return fmt.Errorf("failed to delete pool: %w", err) + } + + s.logger.Info("Storage pool deleted", "pool_id", poolID, "name", poolName) + return nil +} + +// CreateVolumeRequest represents a request to create a new storage volume +type CreateVolumeRequest struct { + VolumeName string `json:"volume_name" binding:"required"` + PoolName string `json:"pool_name" binding:"required"` + MediaType string `json:"media_type"` // File, Tape, etc. + MaxVolBytes *int64 `json:"max_vol_bytes,omitempty"` + VolRetention *int `json:"vol_retention,omitempty"` // Retention period in days +} + +// CreateStorageVolume creates a new storage volume in Bacula database +func (s *Service) CreateStorageVolume(ctx context.Context, req CreateVolumeRequest) (*StorageVolume, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + // Validate volume name + if req.VolumeName == "" { + return nil, fmt.Errorf("volume name is required") + } + + // Get pool ID + var poolID int + err := s.baculaDB.QueryRowContext(ctx, "SELECT PoolId FROM Pool WHERE Name = $1", req.PoolName).Scan(&poolID) + if err == sql.ErrNoRows { + return nil, fmt.Errorf("pool %s not found", req.PoolName) + } else if err != nil { + return nil, fmt.Errorf("failed to get pool: %w", err) + } + + // Set defaults + mediaType := req.MediaType + if mediaType == "" { + mediaType = "File" // Default to File for disk volumes + } + + // Create Media entry first (Volumes table references Media) + var mediaID int + mediaQuery := ` + INSERT INTO Media (PoolId, MediaType, VolumeName, VolBytes, VolFiles, VolStatus, LastWritten) + VALUES ($1, $2, $3, 0, 0, 'Append', NOW()) + RETURNING MediaId + ` + err = s.baculaDB.QueryRowContext(ctx, mediaQuery, poolID, mediaType, req.VolumeName).Scan(&mediaID) + if err != nil { + return nil, fmt.Errorf("failed to create media entry: %w", err) + } + + // Create Volume entry + var maxVolBytes sql.NullInt64 + if req.MaxVolBytes != nil { + maxVolBytes = sql.NullInt64{Int64: *req.MaxVolBytes, Valid: true} + } + + var volRetention sql.NullTime + if req.VolRetention != nil { + retentionTime := time.Now().AddDate(0, 0, *req.VolRetention) + volRetention = sql.NullTime{Time: retentionTime, Valid: true} + } + + volumeQuery := ` + INSERT INTO Volumes (MediaId, VolumeName, VolBytes, MaxVolBytes, VolFiles, VolStatus, VolRetention, LastWritten) + VALUES ($1, $2, 0, $3, 0, 'Append', $4, NOW()) + RETURNING VolumeId, MediaId, VolumeName, VolBytes, MaxVolBytes, VolFiles, VolRetention, LastWritten + ` + + var vol StorageVolume + var lastWritten sql.NullTime + + err = s.baculaDB.QueryRowContext(ctx, volumeQuery, + mediaID, req.VolumeName, maxVolBytes, volRetention, + ).Scan( + &vol.VolumeID, &vol.MediaID, &vol.VolumeName, &vol.VolBytes, &vol.MaxVolBytes, + &vol.VolFiles, &volRetention, &lastWritten, + ) + if err != nil { + // Cleanup: delete media if volume creation fails + s.baculaDB.ExecContext(ctx, "DELETE FROM Media WHERE MediaId = $1", mediaID) + return nil, fmt.Errorf("failed to create volume: %w", err) + } + + vol.PoolName = req.PoolName + vol.MediaType = mediaType + vol.VolStatus = "Append" + vol.RecycleCount = 0 + + if volRetention.Valid { + vol.VolRetention = &volRetention.Time + } + if lastWritten.Valid { + vol.LastWritten = &lastWritten.Time + } + + s.logger.Info("Storage volume created", "volume_id", vol.VolumeID, "name", vol.VolumeName, "pool", req.PoolName) + return &vol, nil +} + +// UpdateVolumeRequest represents a request to update a storage volume +type UpdateVolumeRequest struct { + MaxVolBytes *int64 `json:"max_vol_bytes,omitempty"` + VolRetention *int `json:"vol_retention,omitempty"` // Retention period in days +} + +// UpdateStorageVolume updates a storage volume's meta-data in Bacula database +func (s *Service) UpdateStorageVolume(ctx context.Context, volumeID int, req UpdateVolumeRequest) (*StorageVolume, error) { + if s.baculaDB == nil { + return nil, fmt.Errorf("Bacula database connection not configured") + } + + // Check if volume exists + var volumeName string + err := s.baculaDB.QueryRowContext(ctx, "SELECT VolumeName FROM Volumes WHERE VolumeId = $1", volumeID).Scan(&volumeName) + if err == sql.ErrNoRows { + return nil, fmt.Errorf("volume not found") + } else if err != nil { + return nil, fmt.Errorf("failed to check volume: %w", err) + } + + // Build update query dynamically + updates := []string{} + args := []interface{}{} + argIndex := 1 + + if req.MaxVolBytes != nil { + updates = append(updates, fmt.Sprintf("MaxVolBytes = $%d", argIndex)) + args = append(args, *req.MaxVolBytes) + argIndex++ + } + + if req.VolRetention != nil { + retentionTime := time.Now().AddDate(0, 0, *req.VolRetention) + updates = append(updates, fmt.Sprintf("VolRetention = $%d", argIndex)) + args = append(args, retentionTime) + argIndex++ + } + + if len(updates) == 0 { + return nil, fmt.Errorf("no fields to update") + } + + args = append(args, volumeID) + query := fmt.Sprintf("UPDATE Volumes SET %s WHERE VolumeId = $%d", strings.Join(updates, ", "), argIndex) + + _, err = s.baculaDB.ExecContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("failed to update volume: %w", err) + } + + // Get updated volume + volumes, err := s.ListStorageVolumes(ctx, "") + if err != nil { + return nil, fmt.Errorf("failed to get updated volume: %w", err) + } + + for _, vol := range volumes { + if vol.VolumeID == volumeID { + s.logger.Info("Storage volume updated", "volume_id", volumeID, "name", volumeName) + return &vol, nil + } + } + + return nil, fmt.Errorf("updated volume not found") +} + +// DeleteStorageVolume deletes a storage volume from Bacula database +func (s *Service) DeleteStorageVolume(ctx context.Context, volumeID int) error { + if s.baculaDB == nil { + return fmt.Errorf("Bacula database connection not configured") + } + + // Check if volume exists and get name + var volumeName string + var mediaID int + err := s.baculaDB.QueryRowContext(ctx, "SELECT VolumeName, MediaId FROM Volumes WHERE VolumeId = $1", volumeID).Scan(&volumeName, &mediaID) + if err == sql.ErrNoRows { + return fmt.Errorf("volume not found") + } else if err != nil { + return fmt.Errorf("failed to check volume: %w", err) + } + + // Check if volume has data + var volBytes int64 + err = s.baculaDB.QueryRowContext(ctx, "SELECT VolBytes FROM Volumes WHERE VolumeId = $1", volumeID).Scan(&volBytes) + if err != nil { + return fmt.Errorf("failed to check volume data: %w", err) + } + + if volBytes > 0 { + return fmt.Errorf("cannot delete volume %s: volume contains data. Please purge or truncate first", volumeName) + } + + // Delete volume + _, err = s.baculaDB.ExecContext(ctx, "DELETE FROM Volumes WHERE VolumeId = $1", volumeID) + if err != nil { + return fmt.Errorf("failed to delete volume: %w", err) + } + + // Delete associated media entry + _, err = s.baculaDB.ExecContext(ctx, "DELETE FROM Media WHERE MediaId = $1", mediaID) + if err != nil { + s.logger.Warn("Failed to delete media entry", "media_id", mediaID, "error", err) + // Continue anyway, volume is deleted + } + + s.logger.Info("Storage volume deleted", "volume_id", volumeID, "name", volumeName) + return nil +} + +// Media represents a media entry from bconsole "list media" +type Media struct { + MediaID int `json:"media_id"` + VolumeName string `json:"volume_name"` + PoolName string `json:"pool_name"` + MediaType string `json:"media_type"` + Status string `json:"status"` + VolBytes int64 `json:"vol_bytes"` + MaxVolBytes int64 `json:"max_vol_bytes"` + VolFiles int `json:"vol_files"` + LastWritten string `json:"last_written,omitempty"` + RecycleCount int `json:"recycle_count"` + Slot int `json:"slot,omitempty"` // Slot number in library + InChanger int `json:"in_changer,omitempty"` // 1 if in changer, 0 if not + LibraryName string `json:"library_name,omitempty"` // Library name (for tape media) +} + +// ListMedia lists all media from bconsole "list media" command +func (s *Service) ListMedia(ctx context.Context) ([]Media, error) { + // Execute bconsole command to list media + s.logger.Debug("Executing bconsole list media command") + output, err := s.ExecuteBconsoleCommand(ctx, "list media") + if err != nil { + s.logger.Error("Failed to execute bconsole list media", "error", err) + return nil, fmt.Errorf("failed to execute bconsole list media: %w", err) + } + + previewLen := 500 + if len(output) < previewLen { + previewLen = len(output) + } + s.logger.Debug("bconsole list media output", "output_length", len(output), "output_preview", output[:previewLen]) + + // Parse bconsole output + media := s.parseBconsoleMediaOutput(output) + s.logger.Debug("Parsed media from bconsole", "count", len(media)) + + // Enrich with pool names from database + if s.baculaDB != nil && len(media) > 0 { + media = s.enrichMediaWithPoolNames(ctx, media) + } + + return media, nil +} + +// enrichMediaWithPoolNames enriches media list with pool names from database +func (s *Service) enrichMediaWithPoolNames(ctx context.Context, media []Media) []Media { + // Create maps of media_id to pool_name and library_name + poolMap := make(map[int]string) + libraryMap := make(map[int]string) + + if len(media) == 0 { + return media + } + + // Query database to get pool names for all media + mediaIDs := make([]interface{}, len(media)) + for i, m := range media { + mediaIDs[i] = m.MediaID + } + + // Build query with placeholders + placeholders := make([]string, len(mediaIDs)) + args := make([]interface{}, len(mediaIDs)) + for i := range mediaIDs { + placeholders[i] = fmt.Sprintf("$%d", i+1) + args[i] = mediaIDs[i] + } + + // First, get pool names + query := fmt.Sprintf(` + SELECT m.MediaId, COALESCE(p.Name, 'Unknown') as pool_name + FROM Media m + LEFT JOIN Pool p ON m.PoolId = p.PoolId + WHERE m.MediaId IN (%s) + `, strings.Join(placeholders, ",")) + + rows, err := s.baculaDB.QueryContext(ctx, query, args...) + if err != nil { + s.logger.Warn("Failed to query pool names for media", "error", err) + } else { + defer rows.Close() + for rows.Next() { + var mediaID int + var poolName string + if err := rows.Scan(&mediaID, &poolName); err == nil { + poolMap[mediaID] = poolName + } + } + } + + // Get storage names for tape media + // Since Storage table doesn't have MediaType column, we'll use bconsole to match + // For each storage, check which media belong to it using "list volumes storage=" + storageQuery := ` + SELECT Name + FROM Storage + ORDER BY Name + ` + storageRows, err := s.baculaDB.QueryContext(ctx, storageQuery) + if err == nil { + defer storageRows.Close() + var storageNames []string + for storageRows.Next() { + var storageName string + if err := storageRows.Scan(&storageName); err == nil { + storageNames = append(storageNames, storageName) + } + } + + // For each storage, use bconsole to get list of media volumes + // This will tell us which media belong to which storage + for _, storageName := range storageNames { + // Skip file storages (File1, File2) + if strings.Contains(strings.ToLower(storageName), "file") { + continue + } + + // Use bconsole to list volumes for this storage + cmd := fmt.Sprintf("list volumes storage=%s", storageName) + output, err := s.ExecuteBconsoleCommand(ctx, cmd) + if err != nil { + s.logger.Debug("Failed to get volumes for storage", "storage", storageName, "error", err) + continue + } + + // Parse output to get media IDs + mediaIDs := s.parseMediaIDsFromBconsoleOutput(output) + for _, mediaID := range mediaIDs { + if mediaID > 0 { + libraryMap[mediaID] = storageName + } + } + } + } + + // Update media with pool names and library names + for i := range media { + if poolName, ok := poolMap[media[i].MediaID]; ok { + media[i].PoolName = poolName + } + // Set library name for tape media that are in changer + if media[i].MediaType != "" && (strings.Contains(strings.ToLower(media[i].MediaType), "lto") || strings.Contains(strings.ToLower(media[i].MediaType), "tape")) { + if libraryName, ok := libraryMap[media[i].MediaID]; ok && libraryName != "" { + media[i].LibraryName = libraryName + } else if media[i].InChanger > 0 { + // If in changer but no storage name, use generic name + media[i].LibraryName = "Unknown Library" + } + } + } + + return media +} + +// parseMediaIDsFromBconsoleOutput parses media IDs from bconsole "list volumes storage=..." output +func (s *Service) parseMediaIDsFromBconsoleOutput(output string) []int { + var mediaIDs []int + lines := strings.Split(output, "\n") + + inTable := false + headerFound := false + mediaIDColIndex := -1 + + for _, line := range lines { + line = strings.TrimSpace(line) + + // Skip connection messages + if strings.Contains(line, "Connecting to Director") || + strings.Contains(line, "Enter a period") || + strings.Contains(line, "list volumes") || + strings.Contains(line, "quit") || + strings.Contains(line, "You have messages") || + strings.Contains(line, "Automatically selected") || + strings.Contains(line, "Using Catalog") || + strings.Contains(line, "Pool:") { + continue + } + + // Detect table header + if !headerFound && strings.Contains(line, "|") && strings.Contains(strings.ToLower(line), "mediaid") { + parts := strings.Split(line, "|") + for i, part := range parts { + if strings.Contains(strings.ToLower(strings.TrimSpace(part)), "mediaid") { + mediaIDColIndex = i + break + } + } + headerFound = true + inTable = true + continue + } + + // Detect table separator + if strings.HasPrefix(line, "+") && strings.Contains(line, "-") { + continue + } + + // Skip empty lines + if line == "" { + continue + } + + // Parse table rows + if inTable && strings.Contains(line, "|") && mediaIDColIndex >= 0 { + parts := strings.Split(line, "|") + if mediaIDColIndex < len(parts) { + mediaIDStr := strings.TrimSpace(parts[mediaIDColIndex]) + // Remove commas + mediaIDStr = strings.ReplaceAll(mediaIDStr, ",", "") + if mediaID, err := strconv.Atoi(mediaIDStr); err == nil && mediaID > 0 { + // Skip header row + if mediaIDStr != "mediaid" && mediaIDStr != "MediaId" { + mediaIDs = append(mediaIDs, mediaID) + } + } + } + } + } + + return mediaIDs +} + +// parseBconsoleMediaOutput parses bconsole "list media" output +func (s *Service) parseBconsoleMediaOutput(output string) []Media { + var mediaList []Media + lines := strings.Split(output, "\n") + + inTable := false + headerFound := false + headerMap := make(map[string]int) // Map header name to column index + + for _, line := range lines { + line = strings.TrimSpace(line) + + // Skip connection messages and command echo + if strings.Contains(line, "Connecting to Director") || + strings.Contains(line, "Enter a period") || + strings.Contains(line, "list media") || + strings.Contains(line, "quit") || + strings.Contains(line, "You have messages") || + strings.Contains(line, "Automatically selected") || + strings.Contains(line, "Using Catalog") || + strings.Contains(line, "Pool:") { + continue + } + + // Detect table header - format: | mediaid | volumename | volstatus | ... + if !headerFound && strings.Contains(line, "|") && (strings.Contains(strings.ToLower(line), "mediaid") || strings.Contains(strings.ToLower(line), "volumename")) { + // Parse header to get column positions + parts := strings.Split(line, "|") + for i, part := range parts { + headerName := strings.ToLower(strings.TrimSpace(part)) + if headerName != "" { + headerMap[headerName] = i + } + } + headerFound = true + inTable = true + s.logger.Debug("Found media table header", "headers", headerMap) + continue + } + + // Detect table separator + if strings.HasPrefix(line, "+") && strings.Contains(line, "-") { + continue + } + + // Skip empty lines + if line == "" { + continue + } + + // Parse table rows + if inTable && strings.Contains(line, "|") { + parts := strings.Split(line, "|") + if len(parts) > 1 { + // Helper to get string value safely + getString := func(colName string) string { + if idx, ok := headerMap[colName]; ok && idx < len(parts) { + return strings.TrimSpace(parts[idx]) + } + return "" + } + + // Helper to get int value safely + getInt := func(colName string) int { + valStr := getString(colName) + // Remove commas from numbers + valStr = strings.ReplaceAll(valStr, ",", "") + if val, e := strconv.Atoi(valStr); e == nil { + return val + } + return 0 + } + + // Helper to get int64 value safely + getInt64 := func(colName string) int64 { + valStr := getString(colName) + // Remove commas from numbers + valStr = strings.ReplaceAll(valStr, ",", "") + if val, e := strconv.ParseInt(valStr, 10, 64); e == nil { + return val + } + return 0 + } + + mediaID := getInt("mediaid") + volumeName := getString("volumename") + volStatus := getString("volstatus") + volBytes := getInt64("volbytes") + volFiles := getInt("volfiles") + mediaType := getString("mediatype") + lastWritten := getString("lastwritten") + recycleCount := getInt("recycle") + slot := getInt("slot") + inChanger := getInt("inchanger") + + // Skip header row or invalid rows + if mediaID == 0 || volumeName == "" || volumeName == "volumename" { + continue + } + + // Get pool name - it's not in the table, we'll need to get it from database or set default + // For now, we'll use "Default" as pool name since bconsole list media doesn't show pool + poolName := "Default" + + // MaxVolBytes is not in the output, we'll set to 0 for now + maxVolBytes := int64(0) + + media := Media{ + MediaID: mediaID, + VolumeName: volumeName, + PoolName: poolName, + MediaType: mediaType, + Status: volStatus, + VolBytes: volBytes, + MaxVolBytes: maxVolBytes, + VolFiles: volFiles, + LastWritten: lastWritten, + RecycleCount: recycleCount, + Slot: slot, + InChanger: inChanger, + } + + mediaList = append(mediaList, media) + } + } + } + + s.logger.Debug("Parsed media from bconsole", "count", len(mediaList)) + return mediaList +} diff --git a/backend/internal/bacula/handler.go b/backend/internal/bacula/handler.go new file mode 100644 index 0000000..e36089a --- /dev/null +++ b/backend/internal/bacula/handler.go @@ -0,0 +1,676 @@ +package bacula + +import ( + "context" + "database/sql" + "encoding/json" + "net/http" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/atlasos/calypso/internal/iam" + "github.com/gin-gonic/gin" + "github.com/lib/pq" + "go.uber.org/zap" +) + +const ( + requestTimeout = 5 * time.Second + maxHistoryEntries = 10 +) + +type Handler struct { + db *database.DB + logger *logger.Logger +} + +func NewHandler(db *database.DB, log *logger.Logger) *Handler { + return &Handler{db: db, logger: log.WithFields(zap.String("component", "bacula-handler"))} +} + +type RegisterRequest struct { + Hostname string `json:"hostname" binding:"required"` + IPAddress string `json:"ip_address" binding:"required"` + AgentVersion string `json:"agent_version"` + Status string `json:"status"` + BackupTypes []string `json:"backup_types" binding:"required"` + Metadata map[string]string `json:"metadata"` +} + +type UpdateCapabilitiesRequest struct { + BackupTypes []string `json:"backup_types" binding:"required"` + Notes string `json:"notes"` +} + +type PingRequest struct { + Status string `json:"status"` +} + +type ClientResponse struct { + ID string `json:"id"` + Hostname string `json:"hostname"` + IPAddress string `json:"ip_address"` + AgentVersion string `json:"agent_version"` + Status string `json:"status"` + BackupTypes []string `json:"backup_types"` + PendingBackupTypes []string `json:"pending_backup_types,omitempty"` + PendingRequestedBy string `json:"pending_requested_by,omitempty"` + PendingRequestedAt *time.Time `json:"pending_requested_at,omitempty"` + PendingNotes string `json:"pending_notes,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + RegisteredBy string `json:"registered_by"` + LastSeen *time.Time `json:"last_seen,omitempty"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + CapabilityHistory []CapabilityHistoryEntry `json:"capability_history,omitempty"` +} + +type CapabilityHistoryEntry struct { + BackupTypes []string `json:"backup_types"` + Source string `json:"source"` + RequestedBy string `json:"requested_by,omitempty"` + RequestedAt time.Time `json:"requested_at"` + Notes string `json:"notes,omitempty"` +} + +type PendingUpdateResponse struct { + BackupTypes []string `json:"backup_types"` + RequestedBy string `json:"requested_by,omitempty"` + RequestedAt time.Time `json:"requested_at"` + Notes string `json:"notes,omitempty"` +} + +func (h *Handler) Register(c *gin.Context) { + var req RegisterRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request payload"}) + return + } + + if len(req.BackupTypes) == 0 { + c.JSON(http.StatusBadRequest, gin.H{"error": "backup_types is required"}) + return + } + + user, err := currentUser(c) + if err != nil { + c.JSON(http.StatusUnauthorized, gin.H{"error": "authentication required"}) + return + } + + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + backupPayload, err := json.Marshal(req.BackupTypes) + if err != nil { + h.logger.Error("failed to marshal backup types", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to encode backup types"}) + return + } + + var metadataPayload []byte + if len(req.Metadata) > 0 { + metadataPayload, err = json.Marshal(req.Metadata) + if err != nil { + h.logger.Error("failed to marshal metadata", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to encode metadata"}) + return + } + } + + status := req.Status + if status == "" { + status = "online" + } + + tx, err := h.db.BeginTx(ctx, nil) + if err != nil { + h.logger.Error("failed to begin database transaction", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to register client"}) + return + } + defer tx.Rollback() + + var row clientRow + err = tx.QueryRowContext(ctx, ` + INSERT INTO bacula_clients ( + hostname, ip_address, agent_version, status, backup_types, metadata, + registered_by_user_id, last_seen, updated_at + ) VALUES ($1, $2, $3, $4, $5, $6, $7, NOW(), NOW()) + ON CONFLICT (hostname) DO UPDATE SET + ip_address = EXCLUDED.ip_address, + agent_version = EXCLUDED.agent_version, + status = EXCLUDED.status, + backup_types = EXCLUDED.backup_types, + metadata = COALESCE(EXCLUDED.metadata, bacula_clients.metadata), + registered_by_user_id = EXCLUDED.registered_by_user_id, + last_seen = EXCLUDED.last_seen, + updated_at = NOW() + RETURNING id, hostname, ip_address, agent_version, status, backup_types, metadata, + pending_backup_types, pending_requested_by, pending_requested_at, pending_notes, + registered_by_user_id, last_seen, created_at, updated_at + `, req.Hostname, req.IPAddress, req.AgentVersion, status, backupPayload, metadataPayload, user.ID).Scan( + &row.ID, &row.Hostname, &row.IPAddress, &row.AgentVersion, &row.Status, &row.BackupJSON, + &row.MetadataJSON, &row.PendingBackupJSON, &row.PendingRequestedBy, &row.PendingRequestedAt, + &row.PendingNotes, &row.RegisteredBy, &row.LastSeen, &row.CreatedAt, &row.UpdatedAt, + ) + if err != nil { + h.logger.Error("failed to ensure bacula client", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to register client"}) + return + } + + resp, err := buildClientResponse(&row) + if err != nil { + h.logger.Error("failed to marshal client response", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to build response"}) + return + } + + if err := insertCapabilityHistory(ctx, tx, row.ID, req.BackupTypes, "agent", user.ID, "agent registration"); err != nil { + h.logger.Error("failed to record capability history", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to record capability history"}) + return + } + + if len(resp.PendingBackupTypes) > 0 && stringSlicesEqual(resp.PendingBackupTypes, resp.BackupTypes) { + if _, err := tx.ExecContext(ctx, ` + UPDATE bacula_clients + SET pending_backup_types = NULL, + pending_requested_by = NULL, + pending_requested_at = NULL, + pending_notes = NULL, + updated_at = NOW() + WHERE id = $1 + `, resp.ID); err != nil { + h.logger.Error("failed to clear pending capability update", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update client"}) + return + } + resp.PendingBackupTypes = nil + resp.PendingRequestedBy = "" + resp.PendingRequestedAt = nil + resp.PendingNotes = "" + } + + if err := tx.Commit(); err != nil { + h.logger.Error("failed to commit client registration", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to register client"}) + return + } + + c.JSON(http.StatusOK, resp) +} + +func (h *Handler) UpdateCapabilities(c *gin.Context) { + var req UpdateCapabilitiesRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request payload"}) + return + } + + if len(req.BackupTypes) == 0 { + c.JSON(http.StatusBadRequest, gin.H{"error": "backup_types is required"}) + return + } + + user, err := currentUser(c) + if err != nil { + c.JSON(http.StatusUnauthorized, gin.H{"error": "authentication required"}) + return + } + + clientID := c.Param("id") + if clientID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "client id is required"}) + return + } + + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + tx, err := h.db.BeginTx(ctx, nil) + if err != nil { + h.logger.Error("failed to begin transaction", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "unable to update capabilities"}) + return + } + defer tx.Rollback() + + var exists bool + if err := tx.QueryRowContext(ctx, `SELECT EXISTS (SELECT 1 FROM bacula_clients WHERE id = $1)`, clientID).Scan(&exists); err != nil { + h.logger.Error("failed to verify client", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "unable to update client"}) + return + } + if !exists { + c.JSON(http.StatusNotFound, gin.H{"error": "client not found"}) + return + } + + backupPayload, err := json.Marshal(req.BackupTypes) + if err != nil { + h.logger.Error("failed to marshal backup types", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to encode backup types"}) + return + } + + if _, err := tx.ExecContext(ctx, ` + UPDATE bacula_clients + SET pending_backup_types = $1, + pending_requested_by = $2, + pending_requested_at = NOW(), + pending_notes = $3, + updated_at = NOW() + WHERE id = $4 + `, backupPayload, user.ID, req.Notes, clientID); err != nil { + h.logger.Error("failed to mark pending update", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update client"}) + return + } + + if err := insertCapabilityHistory(ctx, tx, clientID, req.BackupTypes, "ui", user.ID, req.Notes); err != nil { + h.logger.Error("failed to insert capability history", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to record capability change"}) + return + } + + if err := tx.Commit(); err != nil { + h.logger.Error("failed to commit capability update", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update client"}) + return + } + + c.JSON(http.StatusOK, PendingUpdateResponse{ + BackupTypes: req.BackupTypes, + RequestedBy: user.ID, + RequestedAt: time.Now(), + Notes: req.Notes, + }) +} + +func (h *Handler) GetPendingUpdate(c *gin.Context) { + clientID := c.Param("id") + if clientID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "client id is required"}) + return + } + + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + var pendingJSON []byte + var requestedBy sql.NullString + var requestedAt sql.NullTime + var notes sql.NullString + + err := h.db.QueryRowContext(ctx, ` + SELECT pending_backup_types, pending_requested_by, pending_requested_at, pending_notes + FROM bacula_clients + WHERE id = $1 + `, clientID).Scan(&pendingJSON, &requestedBy, &requestedAt, ¬es) + if err != nil { + if err == sql.ErrNoRows { + c.JSON(http.StatusNotFound, gin.H{"error": "client not found"}) + return + } + h.logger.Error("failed to fetch pending update", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to read pending update"}) + return + } + + if len(pendingJSON) == 0 { + c.Status(http.StatusNoContent) + return + } + + var backupTypes []string + if err := json.Unmarshal(pendingJSON, &backupTypes); err != nil { + h.logger.Error("failed to unmarshal pending backup types", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to read pending update"}) + return + } + + response := PendingUpdateResponse{ + BackupTypes: backupTypes, + Notes: notes.String, + } + if requestedBy.Valid { + response.RequestedBy = requestedBy.String + } + if requestedAt.Valid { + response.RequestedAt = requestedAt.Time + } + + c.JSON(http.StatusOK, response) +} + +func (h *Handler) Ping(c *gin.Context) { + clientID := c.Param("id") + if clientID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "client id is required"}) + return + } + + var req PingRequest + if err := c.ShouldBindJSON(&req); err != nil { + // swallow body if absent + } + + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + query := ` + UPDATE bacula_clients + SET last_seen = NOW(), + status = COALESCE(NULLIF($2, ''), status), + updated_at = NOW() + WHERE id = $1 + RETURNING id + ` + + var id string + err := h.db.QueryRowContext(ctx, query, clientID, req.Status).Scan(&id) + if err != nil { + if err == sql.ErrNoRows { + c.JSON(http.StatusNotFound, gin.H{"error": "client not found"}) + return + } + h.logger.Error("failed to update heartbeat", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update client"}) + return + } + + c.Status(http.StatusNoContent) +} + +func (h *Handler) ListClients(c *gin.Context) { + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + rows, err := h.db.QueryContext(ctx, ` + SELECT id, hostname, ip_address, agent_version, status, backup_types, metadata, + pending_backup_types, pending_requested_by, pending_requested_at, pending_notes, + registered_by_user_id, last_seen, created_at, updated_at + FROM bacula_clients + ORDER BY created_at DESC + `) + if err != nil { + h.logger.Error("failed to query clients", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch clients"}) + return + } + defer rows.Close() + + var clients []*ClientResponse + var ids []string + for rows.Next() { + row := clientRow{} + if err := rows.Scan(&row.ID, &row.Hostname, &row.IPAddress, &row.AgentVersion, &row.Status, + &row.BackupJSON, &row.MetadataJSON, &row.PendingBackupJSON, &row.PendingRequestedBy, + &row.PendingRequestedAt, &row.PendingNotes, &row.RegisteredBy, &row.LastSeen, + &row.CreatedAt, &row.UpdatedAt); err != nil { + h.logger.Error("failed to scan client row", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch clients"}) + return + } + resp, err := buildClientResponse(&row) + if err != nil { + h.logger.Error("failed to build client response", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch clients"}) + return + } + clients = append(clients, resp) + ids = append(ids, resp.ID) + } + + if len(ids) > 0 { + if err := h.attachHistory(ctx, ids, clients); err != nil { + h.logger.Error("failed to attach history", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch client history"}) + return + } + } + + c.JSON(http.StatusOK, clients) +} + +func (h *Handler) GetClient(c *gin.Context) { + clientID := c.Param("id") + if clientID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "client id is required"}) + return + } + + ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) + defer cancel() + + var row clientRow + err := h.db.QueryRowContext(ctx, ` + SELECT id, hostname, ip_address, agent_version, status, backup_types, metadata, + pending_backup_types, pending_requested_by, pending_requested_at, pending_notes, + registered_by_user_id, last_seen, created_at, updated_at + FROM bacula_clients + WHERE id = $1 + `, clientID).Scan(&row.ID, &row.Hostname, &row.IPAddress, &row.AgentVersion, &row.Status, + &row.BackupJSON, &row.MetadataJSON, &row.PendingBackupJSON, &row.PendingRequestedBy, + &row.PendingRequestedAt, &row.PendingNotes, &row.RegisteredBy, &row.LastSeen, + &row.CreatedAt, &row.UpdatedAt) + if err != nil { + if err == sql.ErrNoRows { + c.JSON(http.StatusNotFound, gin.H{"error": "client not found"}) + return + } + h.logger.Error("failed to read client", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch client"}) + return + } + + resp, err := buildClientResponse(&row) + if err != nil { + h.logger.Error("failed to build client response", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch client"}) + return + } + + if err := h.attachHistory(ctx, []string{resp.ID}, []*ClientResponse{resp}); err != nil { + h.logger.Error("failed to attach history", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to fetch client history"}) + return + } + + c.JSON(http.StatusOK, resp) +} + +func (h *Handler) attachHistory(ctx context.Context, ids []string, clients []*ClientResponse) error { + if len(ids) == 0 { + return nil + } + + rows, err := h.db.QueryContext(ctx, ` + SELECT client_id, backup_types, source, requested_by_user_id, requested_at, notes + FROM bacula_client_capability_history + WHERE client_id = ANY($1) + ORDER BY requested_at DESC + `, pq.Array(ids)) + if err != nil { + return err + } + defer rows.Close() + + clientMap := make(map[string]*ClientResponse) + for _, client := range clients { + clientMap[client.ID] = client + } + + for rows.Next() { + var clientID string + var backupJSON []byte + var source string + var requestedBy sql.NullString + var requestedAt time.Time + var notes sql.NullString + + if err := rows.Scan(&clientID, &backupJSON, &source, &requestedBy, &requestedAt, ¬es); err != nil { + return err + } + + resp, ok := clientMap[clientID] + if !ok { + continue + } + + if len(resp.CapabilityHistory) >= maxHistoryEntries { + continue + } + + var backupTypes []string + if err := json.Unmarshal(backupJSON, &backupTypes); err != nil { + return err + } + + entry := CapabilityHistoryEntry{ + BackupTypes: backupTypes, + Source: source, + RequestedAt: requestedAt, + } + if requestedBy.Valid { + entry.RequestedBy = requestedBy.String + } + if notes.Valid { + entry.Notes = notes.String + } + + resp.CapabilityHistory = append(resp.CapabilityHistory, entry) + } + + return nil +} + +type clientRow struct { + ID string + Hostname string + IPAddress string + AgentVersion string + Status string + BackupJSON []byte + MetadataJSON []byte + PendingBackupJSON []byte + PendingRequestedBy sql.NullString + PendingRequestedAt sql.NullTime + PendingNotes sql.NullString + RegisteredBy string + LastSeen sql.NullTime + CreatedAt time.Time + UpdatedAt time.Time +} + +func buildClientResponse(row *clientRow) (*ClientResponse, error) { + backupTypes, err := decodeStringSlice(row.BackupJSON) + if err != nil { + return nil, err + } + + pendingTypes, err := decodeStringSlice(row.PendingBackupJSON) + if err != nil { + return nil, err + } + + metadata, err := decodeMetadata(row.MetadataJSON) + if err != nil { + return nil, err + } + + resp := &ClientResponse{ + ID: row.ID, + Hostname: row.Hostname, + IPAddress: row.IPAddress, + AgentVersion: row.AgentVersion, + Status: row.Status, + BackupTypes: backupTypes, + Metadata: metadata, + RegisteredBy: row.RegisteredBy, + CreatedAt: row.CreatedAt, + UpdatedAt: row.UpdatedAt, + } + + if len(pendingTypes) > 0 { + resp.PendingBackupTypes = pendingTypes + if row.PendingRequestedBy.Valid { + resp.PendingRequestedBy = row.PendingRequestedBy.String + } + if row.PendingRequestedAt.Valid { + resp.PendingRequestedAt = &row.PendingRequestedAt.Time + } + if row.PendingNotes.Valid { + resp.PendingNotes = row.PendingNotes.String + } + } + + if row.LastSeen.Valid { + resp.LastSeen = &row.LastSeen.Time + } + + return resp, nil +} + +func currentUser(c *gin.Context) (*iam.User, error) { + user, exists := c.Get("user") + if !exists { + return nil, sql.ErrNoRows + } + authUser, ok := user.(*iam.User) + if !ok { + return nil, sql.ErrNoRows + } + return authUser, nil +} + +func decodeStringSlice(data []byte) ([]string, error) { + if len(data) == 0 { + return []string{}, nil + } + var dst []string + if err := json.Unmarshal(data, &dst); err != nil { + return nil, err + } + return dst, nil +} + +func decodeMetadata(data []byte) (map[string]interface{}, error) { + if len(data) == 0 { + return nil, nil + } + var metadata map[string]interface{} + if err := json.Unmarshal(data, &metadata); err != nil { + return nil, err + } + return metadata, nil +} + +func insertCapabilityHistory(ctx context.Context, tx *sql.Tx, clientID string, backupTypes []string, source, requestedBy, notes string) error { + payload, err := json.Marshal(backupTypes) + if err != nil { + return err + } + + _, err = tx.ExecContext(ctx, ` + INSERT INTO bacula_client_capability_history ( + client_id, backup_types, source, requested_by_user_id, notes + ) VALUES ($1, $2, $3, $4, $5) + `, clientID, payload, source, requestedBy, notes) + return err +} + +func stringSlicesEqual(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} diff --git a/backend/internal/common/config/config.go b/backend/internal/common/config/config.go index 69e2e91..edac290 100644 --- a/backend/internal/common/config/config.go +++ b/backend/internal/common/config/config.go @@ -10,11 +10,12 @@ import ( // Config represents the application configuration type Config struct { - Server ServerConfig `yaml:"server"` - Database DatabaseConfig `yaml:"database"` - Auth AuthConfig `yaml:"auth"` - Logging LoggingConfig `yaml:"logging"` - Security SecurityConfig `yaml:"security"` + Server ServerConfig `yaml:"server"` + Database DatabaseConfig `yaml:"database"` + Auth AuthConfig `yaml:"auth"` + Logging LoggingConfig `yaml:"logging"` + Security SecurityConfig `yaml:"security"` + ObjectStorage ObjectStorageConfig `yaml:"object_storage"` } // ServerConfig holds HTTP server configuration @@ -96,6 +97,14 @@ type SecurityHeadersConfig struct { Enabled bool `yaml:"enabled"` } +// ObjectStorageConfig holds MinIO configuration +type ObjectStorageConfig struct { + Endpoint string `yaml:"endpoint"` + AccessKey string `yaml:"access_key"` + SecretKey string `yaml:"secret_key"` + UseSSL bool `yaml:"use_ssl"` +} + // Load reads configuration from file and environment variables func Load(path string) (*Config, error) { cfg := DefaultConfig() diff --git a/backend/internal/common/database/migrations/003_object_storage_config.sql b/backend/internal/common/database/migrations/003_object_storage_config.sql new file mode 100644 index 0000000..9a6c80c --- /dev/null +++ b/backend/internal/common/database/migrations/003_object_storage_config.sql @@ -0,0 +1,22 @@ +-- Migration: Object Storage Configuration +-- Description: Creates table for storing MinIO object storage configuration +-- Date: 2026-01-09 + +CREATE TABLE IF NOT EXISTS object_storage_config ( + id SERIAL PRIMARY KEY, + dataset_path VARCHAR(255) NOT NULL UNIQUE, + mount_point VARCHAR(512) NOT NULL, + pool_name VARCHAR(255) NOT NULL, + dataset_name VARCHAR(255) NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_object_storage_config_pool_name ON object_storage_config(pool_name); +CREATE INDEX IF NOT EXISTS idx_object_storage_config_updated_at ON object_storage_config(updated_at); + +COMMENT ON TABLE object_storage_config IS 'Stores MinIO object storage configuration, linking to ZFS datasets'; +COMMENT ON COLUMN object_storage_config.dataset_path IS 'Full ZFS dataset path (e.g., pool/dataset)'; +COMMENT ON COLUMN object_storage_config.mount_point IS 'Mount point path for the dataset'; +COMMENT ON COLUMN object_storage_config.pool_name IS 'ZFS pool name'; +COMMENT ON COLUMN object_storage_config.dataset_name IS 'ZFS dataset name'; diff --git a/backend/internal/common/database/migrations/012_add_snapshot_schedules_table.sql b/backend/internal/common/database/migrations/012_add_snapshot_schedules_table.sql new file mode 100644 index 0000000..8e36c2a --- /dev/null +++ b/backend/internal/common/database/migrations/012_add_snapshot_schedules_table.sql @@ -0,0 +1,23 @@ +-- Snapshot schedules table for automated snapshot creation +CREATE TABLE IF NOT EXISTS snapshot_schedules ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL, + dataset VARCHAR(255) NOT NULL, + snapshot_name_template VARCHAR(255) NOT NULL, -- e.g., "auto-%Y-%m-%d-%H%M" or "daily-backup" + schedule_type VARCHAR(50) NOT NULL, -- 'hourly', 'daily', 'weekly', 'monthly', 'cron' + schedule_config JSONB NOT NULL, -- For cron: {"cron": "0 0 * * *"}, for others: {"time": "00:00", "day": 1, etc.} + recursive BOOLEAN NOT NULL DEFAULT false, + enabled BOOLEAN NOT NULL DEFAULT true, + retention_count INTEGER, -- Keep last N snapshots (null = unlimited) + retention_days INTEGER, -- Keep snapshots for N days (null = unlimited) + last_run_at TIMESTAMP, + next_run_at TIMESTAMP, + created_by UUID REFERENCES users(id), + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(name) +); + +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_enabled ON snapshot_schedules(enabled); +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_next_run ON snapshot_schedules(next_run_at); +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_dataset ON snapshot_schedules(dataset); diff --git a/backend/internal/common/database/migrations/013_add_replication_tasks_table.sql b/backend/internal/common/database/migrations/013_add_replication_tasks_table.sql new file mode 100644 index 0000000..556d362 --- /dev/null +++ b/backend/internal/common/database/migrations/013_add_replication_tasks_table.sql @@ -0,0 +1,76 @@ +-- ZFS Replication Tasks Table +-- Supports both outbound (sender) and inbound (receiver) replication +CREATE TABLE IF NOT EXISTS replication_tasks ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL, + direction VARCHAR(20) NOT NULL, -- 'outbound' (sender) or 'inbound' (receiver) + + -- For outbound replication (sender) + source_dataset VARCHAR(512), -- Source dataset on this system (outbound) or remote system (inbound) + target_host VARCHAR(255), -- Target host IP or hostname (for outbound) + target_port INTEGER DEFAULT 22, -- SSH port (default 22, for outbound) + target_user VARCHAR(255) DEFAULT 'root', -- SSH user (for outbound) + target_dataset VARCHAR(512), -- Target dataset on remote system (for outbound) + target_ssh_key_path TEXT, -- Path to SSH private key (for outbound) + + -- For inbound replication (receiver) + source_host VARCHAR(255), -- Source host IP or hostname (for inbound) + source_port INTEGER DEFAULT 22, -- SSH port (for inbound) + source_user VARCHAR(255) DEFAULT 'root', -- SSH user (for inbound) + local_dataset VARCHAR(512), -- Local dataset to receive snapshots (for inbound) + + -- Common settings + schedule_type VARCHAR(50), -- 'manual', 'hourly', 'daily', 'weekly', 'monthly', 'cron' + schedule_config JSONB, -- Schedule configuration (similar to snapshot schedules) + compression VARCHAR(50) DEFAULT 'lz4', -- 'off', 'lz4', 'gzip', 'zstd' + encryption BOOLEAN DEFAULT false, -- Enable encryption during transfer + recursive BOOLEAN DEFAULT false, -- Replicate recursively + incremental BOOLEAN DEFAULT true, -- Use incremental replication + auto_snapshot BOOLEAN DEFAULT true, -- Auto-create snapshot before replication + + -- Status and tracking + enabled BOOLEAN NOT NULL DEFAULT true, + status VARCHAR(50) DEFAULT 'idle', -- 'idle', 'running', 'failed', 'paused' + last_run_at TIMESTAMP, + last_run_status VARCHAR(50), -- 'success', 'failed', 'partial' + last_run_error TEXT, + next_run_at TIMESTAMP, + last_snapshot_sent VARCHAR(512), -- Last snapshot successfully sent (for outbound) + last_snapshot_received VARCHAR(512), -- Last snapshot successfully received (for inbound) + + -- Statistics + total_runs INTEGER DEFAULT 0, + successful_runs INTEGER DEFAULT 0, + failed_runs INTEGER DEFAULT 0, + bytes_sent BIGINT DEFAULT 0, -- Total bytes sent (for outbound) + bytes_received BIGINT DEFAULT 0, -- Total bytes received (for inbound) + + created_by UUID REFERENCES users(id), + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + + -- Validation: ensure required fields based on direction + CONSTRAINT chk_direction CHECK (direction IN ('outbound', 'inbound')), + CONSTRAINT chk_outbound_fields CHECK ( + direction != 'outbound' OR ( + source_dataset IS NOT NULL AND + target_host IS NOT NULL AND + target_dataset IS NOT NULL + ) + ), + CONSTRAINT chk_inbound_fields CHECK ( + direction != 'inbound' OR ( + source_host IS NOT NULL AND + source_dataset IS NOT NULL AND + local_dataset IS NOT NULL + ) + ) +); + +-- Create indexes +CREATE INDEX IF NOT EXISTS idx_replication_tasks_direction ON replication_tasks(direction); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_enabled ON replication_tasks(enabled); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_status ON replication_tasks(status); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_next_run ON replication_tasks(next_run_at); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_source_dataset ON replication_tasks(source_dataset); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_target_host ON replication_tasks(target_host); diff --git a/backend/internal/common/database/migrations/014_add_client_categories_table.sql b/backend/internal/common/database/migrations/014_add_client_categories_table.sql new file mode 100644 index 0000000..4fad7d1 --- /dev/null +++ b/backend/internal/common/database/migrations/014_add_client_categories_table.sql @@ -0,0 +1,30 @@ +-- AtlasOS - Calypso +-- Client Categories Schema +-- Version: 14.0 +-- Adds category support for backup clients (File, Database, Virtual) + +-- Client metadata table to store additional information about clients +-- This extends the Bacula Client table with Calypso-specific metadata +CREATE TABLE IF NOT EXISTS client_metadata ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + client_id INTEGER NOT NULL, -- Bacula Client.ClientId + client_name VARCHAR(255) NOT NULL, -- Bacula Client.Name (for reference) + category VARCHAR(50) NOT NULL DEFAULT 'File', -- 'File', 'Database', 'Virtual' + description TEXT, + tags JSONB, -- Additional tags/metadata as JSON + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + + -- Ensure one metadata entry per client + CONSTRAINT unique_client_id UNIQUE (client_id), + CONSTRAINT chk_category CHECK (category IN ('File', 'Database', 'Virtual')) +); + +-- Indexes for performance +CREATE INDEX IF NOT EXISTS idx_client_metadata_client_id ON client_metadata(client_id); +CREATE INDEX IF NOT EXISTS idx_client_metadata_client_name ON client_metadata(client_name); +CREATE INDEX IF NOT EXISTS idx_client_metadata_category ON client_metadata(category); + +-- Add comment +COMMENT ON TABLE client_metadata IS 'Stores Calypso-specific metadata for backup clients, including category classification'; +COMMENT ON COLUMN client_metadata.category IS 'Client category: File (file system backups), Database (database backups), Virtual (virtual machine backups)'; diff --git a/backend/internal/common/database/migrations/015_add_bacula_clients_table.sql b/backend/internal/common/database/migrations/015_add_bacula_clients_table.sql new file mode 100644 index 0000000..add67e0 --- /dev/null +++ b/backend/internal/common/database/migrations/015_add_bacula_clients_table.sql @@ -0,0 +1,44 @@ +-- AtlasOS - Calypso +-- Migration 015: Add Bacula clients and capability history tables +-- +-- Adds tables for tracking registered Bacula agents, their backup capabilities, +-- and a history log for UI- or agent-triggered capability changes. Pending +-- updates are stored on the client row until the agent pulls them. + +CREATE TABLE IF NOT EXISTS bacula_clients ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + hostname TEXT NOT NULL, + ip_address TEXT, + agent_version TEXT, + status TEXT NOT NULL DEFAULT 'online', + backup_types JSONB NOT NULL, + pending_backup_types JSONB, + pending_requested_by UUID, + pending_requested_at TIMESTAMPTZ, + pending_notes TEXT, + metadata JSONB, + registered_by_user_id UUID NOT NULL, + last_seen TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + CONSTRAINT uniq_bacula_clients_hostname UNIQUE (hostname) +); + +CREATE INDEX IF NOT EXISTS idx_bacula_clients_registered_by ON bacula_clients (registered_by_user_id); +CREATE INDEX IF NOT EXISTS idx_bacula_clients_status ON bacula_clients (status); + +CREATE TABLE IF NOT EXISTS bacula_client_capability_history ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + client_id UUID NOT NULL REFERENCES bacula_clients (id) ON DELETE CASCADE, + backup_types JSONB NOT NULL, + source TEXT NOT NULL, + requested_by_user_id UUID, + requested_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + notes TEXT +); + +CREATE INDEX IF NOT EXISTS idx_bacula_client_capability_history_client ON bacula_client_capability_history (client_id); +CREATE INDEX IF NOT EXISTS idx_bacula_client_capability_history_requested_at ON bacula_client_capability_history (requested_at); + +COMMENT ON TABLE bacula_clients IS 'Tracks Bacula clients registered with Calypso, including pending capability pushes.'; +COMMENT ON TABLE bacula_client_capability_history IS 'Audit history of backup capability changes per client.'; diff --git a/backend/internal/common/router/middleware.go b/backend/internal/common/router/middleware.go index f2c4641..eaee78f 100644 --- a/backend/internal/common/router/middleware.go +++ b/backend/internal/common/router/middleware.go @@ -13,24 +13,30 @@ import ( // authMiddleware validates JWT tokens and sets user context func authMiddleware(authHandler *auth.Handler) gin.HandlerFunc { return func(c *gin.Context) { - // Extract token from Authorization header + var token string + + // Try to extract token from Authorization header first authHeader := c.GetHeader("Authorization") - if authHeader == "" { - c.JSON(http.StatusUnauthorized, gin.H{"error": "missing authorization header"}) + if authHeader != "" { + // Parse Bearer token + parts := strings.SplitN(authHeader, " ", 2) + if len(parts) == 2 && parts[0] == "Bearer" { + token = parts[1] + } + } + + // If no token from header, try query parameter (for WebSocket) + if token == "" { + token = c.Query("token") + } + + // If still no token, return error + if token == "" { + c.JSON(http.StatusUnauthorized, gin.H{"error": "missing authorization token"}) c.Abort() return } - // Parse Bearer token - parts := strings.SplitN(authHeader, " ", 2) - if len(parts) != 2 || parts[0] != "Bearer" { - c.JSON(http.StatusUnauthorized, gin.H{"error": "invalid authorization header format"}) - c.Abort() - return - } - - token := parts[1] - // Validate token and get user user, err := authHandler.ValidateToken(token) if err != nil { diff --git a/backend/internal/common/router/router.go b/backend/internal/common/router/router.go index d963935..0335cf3 100644 --- a/backend/internal/common/router/router.go +++ b/backend/internal/common/router/router.go @@ -7,13 +7,17 @@ import ( "github.com/atlasos/calypso/internal/audit" "github.com/atlasos/calypso/internal/auth" "github.com/atlasos/calypso/internal/backup" + "github.com/atlasos/calypso/internal/bacula" + "github.com/atlasos/calypso/internal/common/cache" "github.com/atlasos/calypso/internal/common/config" "github.com/atlasos/calypso/internal/common/database" "github.com/atlasos/calypso/internal/common/logger" "github.com/atlasos/calypso/internal/iam" "github.com/atlasos/calypso/internal/monitoring" + "github.com/atlasos/calypso/internal/object_storage" "github.com/atlasos/calypso/internal/scst" + "github.com/atlasos/calypso/internal/shares" "github.com/atlasos/calypso/internal/storage" "github.com/atlasos/calypso/internal/system" "github.com/atlasos/calypso/internal/tape_physical" @@ -174,6 +178,11 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng zfsPoolMonitor := storage.NewZFSPoolMonitor(db, log, 2*time.Minute) go zfsPoolMonitor.Start(context.Background()) + // Start snapshot schedule worker in background (checks schedules every 1 minute) + snapshotService := storage.NewSnapshotService(db, log) + snapshotScheduleWorker := storage.NewSnapshotScheduleWorker(db, log, snapshotService, 1*time.Minute) + go snapshotScheduleWorker.Start(context.Background()) + storageGroup := protected.Group("/storage") storageGroup.Use(requirePermission("storage", "read")) { @@ -194,10 +203,83 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng storageGroup.GET("/zfs/pools/:id/datasets", storageHandler.ListZFSDatasets) storageGroup.POST("/zfs/pools/:id/datasets", requirePermission("storage", "write"), storageHandler.CreateZFSDataset) storageGroup.DELETE("/zfs/pools/:id/datasets/:dataset", requirePermission("storage", "write"), storageHandler.DeleteZFSDataset) + // ZFS Snapshots + storageGroup.GET("/zfs/snapshots", storageHandler.ListSnapshots) + storageGroup.POST("/zfs/snapshots", requirePermission("storage", "write"), storageHandler.CreateSnapshot) + storageGroup.DELETE("/zfs/snapshots/:name", requirePermission("storage", "write"), storageHandler.DeleteSnapshot) + storageGroup.POST("/zfs/snapshots/:name/rollback", requirePermission("storage", "write"), storageHandler.RollbackSnapshot) + storageGroup.POST("/zfs/snapshots/:name/clone", requirePermission("storage", "write"), storageHandler.CloneSnapshot) + // Snapshot Schedules + storageGroup.GET("/zfs/snapshot-schedules", storageHandler.ListSnapshotSchedules) + storageGroup.GET("/zfs/snapshot-schedules/:id", storageHandler.GetSnapshotSchedule) + storageGroup.POST("/zfs/snapshot-schedules", requirePermission("storage", "write"), storageHandler.CreateSnapshotSchedule) + storageGroup.PUT("/zfs/snapshot-schedules/:id", requirePermission("storage", "write"), storageHandler.UpdateSnapshotSchedule) + storageGroup.DELETE("/zfs/snapshot-schedules/:id", requirePermission("storage", "write"), storageHandler.DeleteSnapshotSchedule) + storageGroup.POST("/zfs/snapshot-schedules/:id/toggle", requirePermission("storage", "write"), storageHandler.ToggleSnapshotSchedule) + + // Replication Tasks + storageGroup.GET("/zfs/replication-tasks", storageHandler.ListReplicationTasks) + storageGroup.GET("/zfs/replication-tasks/:id", storageHandler.GetReplicationTask) + storageGroup.POST("/zfs/replication-tasks", requirePermission("storage", "write"), storageHandler.CreateReplicationTask) + storageGroup.PUT("/zfs/replication-tasks/:id", requirePermission("storage", "write"), storageHandler.UpdateReplicationTask) + storageGroup.DELETE("/zfs/replication-tasks/:id", requirePermission("storage", "write"), storageHandler.DeleteReplicationTask) // ZFS ARC Stats storageGroup.GET("/zfs/arc/stats", storageHandler.GetARCStats) } + // Shares (CIFS/NFS) + sharesHandler := shares.NewHandler(db, log) + sharesGroup := protected.Group("/shares") + sharesGroup.Use(requirePermission("storage", "read")) + { + sharesGroup.GET("", sharesHandler.ListShares) + sharesGroup.GET("/:id", sharesHandler.GetShare) + sharesGroup.POST("", requirePermission("storage", "write"), sharesHandler.CreateShare) + sharesGroup.PUT("/:id", requirePermission("storage", "write"), sharesHandler.UpdateShare) + sharesGroup.DELETE("/:id", requirePermission("storage", "write"), sharesHandler.DeleteShare) + } + + // Object Storage (MinIO) + // Initialize MinIO service if configured + if cfg.ObjectStorage.Endpoint != "" { + objectStorageService, err := object_storage.NewService( + cfg.ObjectStorage.Endpoint, + cfg.ObjectStorage.AccessKey, + cfg.ObjectStorage.SecretKey, + log, + ) + if err != nil { + log.Error("Failed to initialize MinIO service", "error", err) + } else { + objectStorageHandler := object_storage.NewHandler(objectStorageService, db, log) + objectStorageGroup := protected.Group("/object-storage") + objectStorageGroup.Use(requirePermission("storage", "read")) + { + // Setup endpoints + objectStorageGroup.GET("/setup/datasets", objectStorageHandler.GetAvailableDatasets) + objectStorageGroup.GET("/setup/current", objectStorageHandler.GetCurrentSetup) + objectStorageGroup.POST("/setup", requirePermission("storage", "write"), objectStorageHandler.SetupObjectStorage) + objectStorageGroup.PUT("/setup", requirePermission("storage", "write"), objectStorageHandler.UpdateObjectStorage) + + // Bucket endpoints + // IMPORTANT: More specific routes must come BEFORE less specific ones + objectStorageGroup.GET("/buckets", objectStorageHandler.ListBuckets) + objectStorageGroup.GET("/buckets/:name/objects", objectStorageHandler.ListObjects) + objectStorageGroup.GET("/buckets/:name", objectStorageHandler.GetBucket) + objectStorageGroup.POST("/buckets", requirePermission("storage", "write"), objectStorageHandler.CreateBucket) + objectStorageGroup.DELETE("/buckets/:name", requirePermission("storage", "write"), objectStorageHandler.DeleteBucket) + // User management routes + objectStorageGroup.GET("/users", objectStorageHandler.ListUsers) + objectStorageGroup.POST("/users", requirePermission("storage", "write"), objectStorageHandler.CreateUser) + objectStorageGroup.DELETE("/users/:access_key", requirePermission("storage", "write"), objectStorageHandler.DeleteUser) + // Service account (access key) management routes + objectStorageGroup.GET("/service-accounts", objectStorageHandler.ListServiceAccounts) + objectStorageGroup.POST("/service-accounts", requirePermission("storage", "write"), objectStorageHandler.CreateServiceAccount) + objectStorageGroup.DELETE("/service-accounts/:access_key", requirePermission("storage", "write"), objectStorageHandler.DeleteServiceAccount) + } + } + } + // SCST scstHandler := scst.NewHandler(db, log) scstGroup := protected.Group("/scst") @@ -206,10 +288,12 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng scstGroup.GET("/targets", scstHandler.ListTargets) scstGroup.GET("/targets/:id", scstHandler.GetTarget) scstGroup.POST("/targets", scstHandler.CreateTarget) - scstGroup.POST("/targets/:id/luns", scstHandler.AddLUN) + scstGroup.POST("/targets/:id/luns", requirePermission("iscsi", "write"), scstHandler.AddLUN) + scstGroup.DELETE("/targets/:id/luns/:lunId", requirePermission("iscsi", "write"), scstHandler.RemoveLUN) scstGroup.POST("/targets/:id/initiators", scstHandler.AddInitiator) scstGroup.POST("/targets/:id/enable", scstHandler.EnableTarget) scstGroup.POST("/targets/:id/disable", scstHandler.DisableTarget) + scstGroup.DELETE("/targets/:id", requirePermission("iscsi", "write"), scstHandler.DeleteTarget) scstGroup.GET("/initiators", scstHandler.ListAllInitiators) scstGroup.GET("/initiators/:id", scstHandler.GetInitiator) scstGroup.DELETE("/initiators/:id", scstHandler.RemoveInitiator) @@ -223,6 +307,16 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng scstGroup.POST("/portals", scstHandler.CreatePortal) scstGroup.PUT("/portals/:id", scstHandler.UpdatePortal) scstGroup.DELETE("/portals/:id", scstHandler.DeletePortal) + // Initiator Groups routes + scstGroup.GET("/initiator-groups", scstHandler.ListAllInitiatorGroups) + scstGroup.GET("/initiator-groups/:id", scstHandler.GetInitiatorGroup) + scstGroup.POST("/initiator-groups", requirePermission("iscsi", "write"), scstHandler.CreateInitiatorGroup) + scstGroup.PUT("/initiator-groups/:id", requirePermission("iscsi", "write"), scstHandler.UpdateInitiatorGroup) + scstGroup.DELETE("/initiator-groups/:id", requirePermission("iscsi", "write"), scstHandler.DeleteInitiatorGroup) + scstGroup.POST("/initiator-groups/:id/initiators", requirePermission("iscsi", "write"), scstHandler.AddInitiatorToGroup) + // Config file management + scstGroup.GET("/config/file", requirePermission("iscsi", "read"), scstHandler.GetConfigFile) + scstGroup.PUT("/config/file", requirePermission("iscsi", "write"), scstHandler.UpdateConfigFile) } // Physical Tape Libraries @@ -260,7 +354,18 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng } // System Management + systemService := system.NewService(log) systemHandler := system.NewHandler(log, tasks.NewEngine(db, log)) + // Set service in handler (if handler needs direct access) + // Note: Handler already has service via NewHandler, but we need to ensure it's the same instance + + // Start network monitoring with RRD + if err := systemService.StartNetworkMonitoring(context.Background()); err != nil { + log.Warn("Failed to start network monitoring", "error", err) + } else { + log.Info("Network monitoring started with RRD") + } + systemGroup := protected.Group("/system") systemGroup.Use(requirePermission("system", "read")) { @@ -268,8 +373,15 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng systemGroup.GET("/services/:name", systemHandler.GetServiceStatus) systemGroup.POST("/services/:name/restart", systemHandler.RestartService) systemGroup.GET("/services/:name/logs", systemHandler.GetServiceLogs) + systemGroup.GET("/logs", systemHandler.GetSystemLogs) + systemGroup.GET("/network/throughput", systemHandler.GetNetworkThroughput) systemGroup.POST("/support-bundle", systemHandler.GenerateSupportBundle) systemGroup.GET("/interfaces", systemHandler.ListNetworkInterfaces) + systemGroup.GET("/management-ip", systemHandler.GetManagementIPAddress) + systemGroup.PUT("/interfaces/:name", systemHandler.UpdateNetworkInterface) + systemGroup.GET("/ntp", systemHandler.GetNTPSettings) + systemGroup.POST("/ntp", systemHandler.SaveNTPSettings) + systemGroup.POST("/execute", requirePermission("system", "write"), systemHandler.ExecuteCommand) } // IAM routes - GetUser can be accessed by user viewing own profile or admin @@ -330,9 +442,33 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng backupGroup := protected.Group("/backup") backupGroup.Use(requirePermission("backup", "read")) { + backupGroup.GET("/dashboard/stats", backupHandler.GetDashboardStats) backupGroup.GET("/jobs", backupHandler.ListJobs) backupGroup.GET("/jobs/:id", backupHandler.GetJob) backupGroup.POST("/jobs", requirePermission("backup", "write"), backupHandler.CreateJob) + backupGroup.GET("/clients", backupHandler.ListClients) + backupGroup.GET("/storage/pools", backupHandler.ListStoragePools) + backupGroup.POST("/storage/pools", requirePermission("backup", "write"), backupHandler.CreateStoragePool) + backupGroup.DELETE("/storage/pools/:id", requirePermission("backup", "write"), backupHandler.DeleteStoragePool) + backupGroup.GET("/storage/volumes", backupHandler.ListStorageVolumes) + backupGroup.POST("/storage/volumes", requirePermission("backup", "write"), backupHandler.CreateStorageVolume) + backupGroup.PUT("/storage/volumes/:id", requirePermission("backup", "write"), backupHandler.UpdateStorageVolume) + backupGroup.DELETE("/storage/volumes/:id", requirePermission("backup", "write"), backupHandler.DeleteStorageVolume) + backupGroup.GET("/media", backupHandler.ListMedia) + backupGroup.GET("/storage/daemons", backupHandler.ListStorageDaemons) + backupGroup.POST("/console/execute", requirePermission("backup", "write"), backupHandler.ExecuteBconsoleCommand) + } + + baculaHandler := bacula.NewHandler(db, log) + baculaGroup := protected.Group("/bacula/clients") + baculaGroup.Use(requireRole("bacula-admin")) + { + baculaGroup.POST("/register", baculaHandler.Register) + baculaGroup.POST("/:id/capabilities", baculaHandler.UpdateCapabilities) + baculaGroup.GET("/:id/pending-update", baculaHandler.GetPendingUpdate) + baculaGroup.POST("/:id/ping", baculaHandler.Ping) + baculaGroup.GET("", baculaHandler.ListClients) + baculaGroup.GET("/:id", baculaHandler.GetClient) } // Monitoring diff --git a/backend/internal/iam/group.go b/backend/internal/iam/group.go index b64243b..4f4acd4 100644 --- a/backend/internal/iam/group.go +++ b/backend/internal/iam/group.go @@ -88,11 +88,14 @@ func GetUserGroups(db *database.DB, userID string) ([]string, error) { for rows.Next() { var groupName string if err := rows.Scan(&groupName); err != nil { - return nil, err + return []string{}, err } groups = append(groups, groupName) } + if groups == nil { + groups = []string{} + } return groups, rows.Err() } diff --git a/backend/internal/iam/handler.go b/backend/internal/iam/handler.go index 7ca67dc..4360d93 100644 --- a/backend/internal/iam/handler.go +++ b/backend/internal/iam/handler.go @@ -69,6 +69,17 @@ func (h *Handler) ListUsers(c *gin.Context) { permissions, _ := GetUserPermissions(h.db, u.ID) groups, _ := GetUserGroups(h.db, u.ID) + // Ensure arrays are never nil (use empty slice instead) + if roles == nil { + roles = []string{} + } + if permissions == nil { + permissions = []string{} + } + if groups == nil { + groups = []string{} + } + users = append(users, map[string]interface{}{ "id": u.ID, "username": u.Username, @@ -138,6 +149,17 @@ func (h *Handler) GetUser(c *gin.Context) { permissions, _ := GetUserPermissions(h.db, userID) groups, _ := GetUserGroups(h.db, userID) + // Ensure arrays are never nil (use empty slice instead) + if roles == nil { + roles = []string{} + } + if permissions == nil { + permissions = []string{} + } + if groups == nil { + groups = []string{} + } + c.JSON(http.StatusOK, gin.H{ "id": user.ID, "username": user.Username, @@ -236,6 +258,8 @@ func (h *Handler) UpdateUser(c *gin.Context) { } // Allow update if roles or groups are provided, even if no other fields are updated + // Note: req.Roles and req.Groups can be empty arrays ([]), which is different from nil + // Empty array means "remove all roles/groups", nil means "don't change roles/groups" if len(updates) == 1 && req.Roles == nil && req.Groups == nil { c.JSON(http.StatusBadRequest, gin.H{"error": "no fields to update"}) return @@ -259,13 +283,14 @@ func (h *Handler) UpdateUser(c *gin.Context) { // Update roles if provided if req.Roles != nil { - h.logger.Info("Updating user roles", "user_id", userID, "roles", *req.Roles) + h.logger.Info("Updating user roles", "user_id", userID, "requested_roles", *req.Roles) currentRoles, err := GetUserRoles(h.db, userID) if err != nil { h.logger.Error("Failed to get current roles for user", "user_id", userID, "error", err) c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to process user roles"}) return } + h.logger.Info("Current user roles", "user_id", userID, "current_roles", currentRoles) rolesToAdd := []string{} rolesToRemove := []string{} @@ -298,8 +323,15 @@ func (h *Handler) UpdateUser(c *gin.Context) { } } + h.logger.Info("Roles to add", "user_id", userID, "roles_to_add", rolesToAdd, "count", len(rolesToAdd)) + h.logger.Info("Roles to remove", "user_id", userID, "roles_to_remove", rolesToRemove, "count", len(rolesToRemove)) + // Add new roles + if len(rolesToAdd) == 0 { + h.logger.Info("No roles to add", "user_id", userID) + } for _, roleName := range rolesToAdd { + h.logger.Info("Processing role to add", "user_id", userID, "role_name", roleName) roleID, err := GetRoleIDByName(h.db, roleName) if err != nil { if err == sql.ErrNoRows { @@ -311,12 +343,13 @@ func (h *Handler) UpdateUser(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to process roles"}) return } + h.logger.Info("Attempting to add role", "user_id", userID, "role_id", roleID, "role_name", roleName, "assigned_by", currentUser.ID) if err := AddUserRole(h.db, userID, roleID, currentUser.ID); err != nil { - h.logger.Error("Failed to add role to user", "user_id", userID, "role_id", roleID, "error", err) - // Don't return early, continue with other roles - continue + h.logger.Error("Failed to add role to user", "user_id", userID, "role_id", roleID, "role_name", roleName, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to add role '%s': %v", roleName, err)}) + return } - h.logger.Info("Role added to user", "user_id", userID, "role_name", roleName) + h.logger.Info("Role successfully added to user", "user_id", userID, "role_id", roleID, "role_name", roleName) } // Remove old roles @@ -415,8 +448,48 @@ func (h *Handler) UpdateUser(c *gin.Context) { } } - h.logger.Info("User updated", "user_id", userID) - c.JSON(http.StatusOK, gin.H{"message": "user updated successfully"}) + // Fetch updated user data to return + updatedUser, err := GetUserByID(h.db, userID) + if err != nil { + h.logger.Error("Failed to fetch updated user", "user_id", userID, "error", err) + c.JSON(http.StatusOK, gin.H{"message": "user updated successfully"}) + return + } + + // Get updated roles, permissions, and groups + updatedRoles, _ := GetUserRoles(h.db, userID) + updatedPermissions, _ := GetUserPermissions(h.db, userID) + updatedGroups, _ := GetUserGroups(h.db, userID) + + // Ensure arrays are never nil + if updatedRoles == nil { + updatedRoles = []string{} + } + if updatedPermissions == nil { + updatedPermissions = []string{} + } + if updatedGroups == nil { + updatedGroups = []string{} + } + + h.logger.Info("User updated", "user_id", userID, "roles", updatedRoles, "groups", updatedGroups) + c.JSON(http.StatusOK, gin.H{ + "message": "user updated successfully", + "user": gin.H{ + "id": updatedUser.ID, + "username": updatedUser.Username, + "email": updatedUser.Email, + "full_name": updatedUser.FullName, + "is_active": updatedUser.IsActive, + "is_system": updatedUser.IsSystem, + "roles": updatedRoles, + "permissions": updatedPermissions, + "groups": updatedGroups, + "created_at": updatedUser.CreatedAt, + "updated_at": updatedUser.UpdatedAt, + "last_login_at": updatedUser.LastLoginAt, + }, + }) } // DeleteUser deletes a user diff --git a/backend/internal/iam/user.go b/backend/internal/iam/user.go index 8bea90e..2c343fc 100644 --- a/backend/internal/iam/user.go +++ b/backend/internal/iam/user.go @@ -2,6 +2,7 @@ package iam import ( "database/sql" + "fmt" "time" "github.com/atlasos/calypso/internal/common/database" @@ -90,11 +91,14 @@ func GetUserRoles(db *database.DB, userID string) ([]string, error) { for rows.Next() { var role string if err := rows.Scan(&role); err != nil { - return nil, err + return []string{}, err } roles = append(roles, role) } + if roles == nil { + roles = []string{} + } return roles, rows.Err() } @@ -118,11 +122,14 @@ func GetUserPermissions(db *database.DB, userID string) ([]string, error) { for rows.Next() { var perm string if err := rows.Scan(&perm); err != nil { - return nil, err + return []string{}, err } permissions = append(permissions, perm) } + if permissions == nil { + permissions = []string{} + } return permissions, rows.Err() } @@ -133,8 +140,23 @@ func AddUserRole(db *database.DB, userID, roleID, assignedBy string) error { VALUES ($1, $2, $3) ON CONFLICT (user_id, role_id) DO NOTHING ` - _, err := db.Exec(query, userID, roleID, assignedBy) - return err + result, err := db.Exec(query, userID, roleID, assignedBy) + if err != nil { + return fmt.Errorf("failed to insert user role: %w", err) + } + + // Check if row was actually inserted (not just skipped due to conflict) + rowsAffected, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + // Row already exists, this is not an error but we should know about it + return nil // ON CONFLICT DO NOTHING means this is expected + } + + return nil } // RemoveUserRole removes a role from a user diff --git a/backend/internal/object_storage/handler.go b/backend/internal/object_storage/handler.go new file mode 100644 index 0000000..49fb4d4 --- /dev/null +++ b/backend/internal/object_storage/handler.go @@ -0,0 +1,300 @@ +package object_storage + +import ( + "net/http" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/gin-gonic/gin" +) + +// Handler handles HTTP requests for object storage +type Handler struct { + service *Service + setupService *SetupService + logger *logger.Logger +} + +// NewHandler creates a new object storage handler +func NewHandler(service *Service, db *database.DB, log *logger.Logger) *Handler { + return &Handler{ + service: service, + setupService: NewSetupService(db, log), + logger: log, + } +} + +// ListBuckets lists all buckets +func (h *Handler) ListBuckets(c *gin.Context) { + buckets, err := h.service.ListBuckets(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list buckets", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list buckets: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"buckets": buckets}) +} + +// GetBucket gets bucket information +func (h *Handler) GetBucket(c *gin.Context) { + bucketName := c.Param("name") + + bucket, err := h.service.GetBucketStats(c.Request.Context(), bucketName) + if err != nil { + h.logger.Error("Failed to get bucket", "bucket", bucketName, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get bucket: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, bucket) +} + +// CreateBucketRequest represents a request to create a bucket +type CreateBucketRequest struct { + Name string `json:"name" binding:"required"` +} + +// CreateBucket creates a new bucket +func (h *Handler) CreateBucket(c *gin.Context) { + var req CreateBucketRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create bucket request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + if err := h.service.CreateBucket(c.Request.Context(), req.Name); err != nil { + h.logger.Error("Failed to create bucket", "bucket", req.Name, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create bucket: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, gin.H{"message": "bucket created successfully", "name": req.Name}) +} + +// DeleteBucket deletes a bucket +func (h *Handler) DeleteBucket(c *gin.Context) { + bucketName := c.Param("name") + + if err := h.service.DeleteBucket(c.Request.Context(), bucketName); err != nil { + h.logger.Error("Failed to delete bucket", "bucket", bucketName, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete bucket: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "bucket deleted successfully"}) +} + +// GetAvailableDatasets gets all available pools and datasets for object storage setup +func (h *Handler) GetAvailableDatasets(c *gin.Context) { + datasets, err := h.setupService.GetAvailableDatasets(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to get available datasets", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get available datasets: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"pools": datasets}) +} + +// SetupObjectStorageRequest represents a request to setup object storage +type SetupObjectStorageRequest struct { + PoolName string `json:"pool_name" binding:"required"` + DatasetName string `json:"dataset_name" binding:"required"` + CreateNew bool `json:"create_new"` +} + +// SetupObjectStorage configures object storage with a ZFS dataset +func (h *Handler) SetupObjectStorage(c *gin.Context) { + var req SetupObjectStorageRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid setup request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + setupReq := SetupRequest{ + PoolName: req.PoolName, + DatasetName: req.DatasetName, + CreateNew: req.CreateNew, + } + + result, err := h.setupService.SetupObjectStorage(c.Request.Context(), setupReq) + if err != nil { + h.logger.Error("Failed to setup object storage", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to setup object storage: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, result) +} + +// GetCurrentSetup gets the current object storage configuration +func (h *Handler) GetCurrentSetup(c *gin.Context) { + setup, err := h.setupService.GetCurrentSetup(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to get current setup", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get current setup: " + err.Error()}) + return + } + + if setup == nil { + c.JSON(http.StatusOK, gin.H{"configured": false}) + return + } + + c.JSON(http.StatusOK, gin.H{"configured": true, "setup": setup}) +} + +// UpdateObjectStorage updates the object storage configuration +func (h *Handler) UpdateObjectStorage(c *gin.Context) { + var req SetupObjectStorageRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid update request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + setupReq := SetupRequest{ + PoolName: req.PoolName, + DatasetName: req.DatasetName, + CreateNew: req.CreateNew, + } + + result, err := h.setupService.UpdateObjectStorage(c.Request.Context(), setupReq) + if err != nil { + h.logger.Error("Failed to update object storage", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update object storage: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, result) +} + +// ListUsers lists all IAM users +func (h *Handler) ListUsers(c *gin.Context) { + users, err := h.service.ListUsers(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list users", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list users: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"users": users}) +} + +// CreateUserRequest represents a request to create a user +type CreateUserRequest struct { + AccessKey string `json:"access_key" binding:"required"` + SecretKey string `json:"secret_key" binding:"required"` +} + +// CreateUser creates a new IAM user +func (h *Handler) CreateUser(c *gin.Context) { + var req CreateUserRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create user request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + if err := h.service.CreateUser(c.Request.Context(), req.AccessKey, req.SecretKey); err != nil { + h.logger.Error("Failed to create user", "access_key", req.AccessKey, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create user: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, gin.H{"message": "user created successfully", "access_key": req.AccessKey}) +} + +// DeleteUser deletes an IAM user +func (h *Handler) DeleteUser(c *gin.Context) { + accessKey := c.Param("access_key") + + if err := h.service.DeleteUser(c.Request.Context(), accessKey); err != nil { + h.logger.Error("Failed to delete user", "access_key", accessKey, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete user: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "user deleted successfully"}) +} + +// ListServiceAccounts lists all service accounts (access keys) +func (h *Handler) ListServiceAccounts(c *gin.Context) { + accounts, err := h.service.ListServiceAccounts(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list service accounts", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list service accounts: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"service_accounts": accounts}) +} + +// CreateServiceAccountRequest represents a request to create a service account +type CreateServiceAccountRequest struct { + ParentUser string `json:"parent_user" binding:"required"` + Policy string `json:"policy,omitempty"` + Expiration *string `json:"expiration,omitempty"` // ISO 8601 format +} + +// CreateServiceAccount creates a new service account (access key) +func (h *Handler) CreateServiceAccount(c *gin.Context) { + var req CreateServiceAccountRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create service account request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + var expiration *time.Time + if req.Expiration != nil { + exp, err := time.Parse(time.RFC3339, *req.Expiration) + if err != nil { + h.logger.Error("Invalid expiration format", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid expiration format, use ISO 8601 (RFC3339)"}) + return + } + expiration = &exp + } + + account, err := h.service.CreateServiceAccount(c.Request.Context(), req.ParentUser, req.Policy, expiration) + if err != nil { + h.logger.Error("Failed to create service account", "parent_user", req.ParentUser, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create service account: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, account) +} + +// DeleteServiceAccount deletes a service account +func (h *Handler) DeleteServiceAccount(c *gin.Context) { + accessKey := c.Param("access_key") + + if err := h.service.DeleteServiceAccount(c.Request.Context(), accessKey); err != nil { + h.logger.Error("Failed to delete service account", "access_key", accessKey, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete service account: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "service account deleted successfully"}) +} + +// ListObjects lists objects in a bucket +func (h *Handler) ListObjects(c *gin.Context) { + bucketName := c.Param("name") // Changed from "bucket" to "name" to match route + prefix := c.DefaultQuery("prefix", "") // Optional prefix (folder path) + + objects, err := h.service.ListObjects(c.Request.Context(), bucketName, prefix) + if err != nil { + h.logger.Error("Failed to list objects", "bucket", bucketName, "prefix", prefix, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list objects: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"objects": objects}) +} diff --git a/backend/internal/object_storage/service.go b/backend/internal/object_storage/service.go new file mode 100644 index 0000000..d1d807b --- /dev/null +++ b/backend/internal/object_storage/service.go @@ -0,0 +1,373 @@ +package object_storage + +import ( + "context" + "encoding/json" + "fmt" + "sort" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/logger" + madmin "github.com/minio/madmin-go/v3" + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" +) + +// Service handles MinIO object storage operations +type Service struct { + client *minio.Client + adminClient *madmin.AdminClient + logger *logger.Logger + endpoint string + accessKey string + secretKey string +} + +// NewService creates a new MinIO service +func NewService(endpoint, accessKey, secretKey string, log *logger.Logger) (*Service, error) { + // Create MinIO client + minioClient, err := minio.New(endpoint, &minio.Options{ + Creds: credentials.NewStaticV4(accessKey, secretKey, ""), + Secure: false, // Set to true if using HTTPS + }) + if err != nil { + return nil, fmt.Errorf("failed to create MinIO client: %w", err) + } + + // Create MinIO Admin client + adminClient, err := madmin.New(endpoint, accessKey, secretKey, false) + if err != nil { + return nil, fmt.Errorf("failed to create MinIO admin client: %w", err) + } + + return &Service{ + client: minioClient, + adminClient: adminClient, + logger: log, + endpoint: endpoint, + accessKey: accessKey, + secretKey: secretKey, + }, nil +} + +// Bucket represents a MinIO bucket +type Bucket struct { + Name string `json:"name"` + CreationDate time.Time `json:"creation_date"` + Size int64 `json:"size"` // Total size in bytes + Objects int64 `json:"objects"` // Number of objects + AccessPolicy string `json:"access_policy"` // private, public-read, public-read-write +} + +// ListBuckets lists all buckets in MinIO +func (s *Service) ListBuckets(ctx context.Context) ([]*Bucket, error) { + buckets, err := s.client.ListBuckets(ctx) + if err != nil { + return nil, fmt.Errorf("failed to list buckets: %w", err) + } + + result := make([]*Bucket, 0, len(buckets)) + for _, bucket := range buckets { + bucketInfo, err := s.getBucketInfo(ctx, bucket.Name) + if err != nil { + s.logger.Warn("Failed to get bucket info", "bucket", bucket.Name, "error", err) + // Continue with basic info + result = append(result, &Bucket{ + Name: bucket.Name, + CreationDate: bucket.CreationDate, + Size: 0, + Objects: 0, + AccessPolicy: "private", + }) + continue + } + + result = append(result, bucketInfo) + } + + return result, nil +} + +// getBucketInfo gets detailed information about a bucket +func (s *Service) getBucketInfo(ctx context.Context, bucketName string) (*Bucket, error) { + // Get bucket creation date + buckets, err := s.client.ListBuckets(ctx) + if err != nil { + return nil, err + } + + var creationDate time.Time + for _, b := range buckets { + if b.Name == bucketName { + creationDate = b.CreationDate + break + } + } + + // Get bucket size and object count by listing objects + var size int64 + var objects int64 + + // List objects in bucket to calculate size and count + objectCh := s.client.ListObjects(ctx, bucketName, minio.ListObjectsOptions{ + Recursive: true, + }) + + for object := range objectCh { + if object.Err != nil { + s.logger.Warn("Error listing object", "bucket", bucketName, "error", object.Err) + continue + } + objects++ + size += object.Size + } + + return &Bucket{ + Name: bucketName, + CreationDate: creationDate, + Size: size, + Objects: objects, + AccessPolicy: s.getBucketPolicy(ctx, bucketName), + }, nil +} + +// getBucketPolicy gets the access policy for a bucket +func (s *Service) getBucketPolicy(ctx context.Context, bucketName string) string { + policy, err := s.client.GetBucketPolicy(ctx, bucketName) + if err != nil { + return "private" + } + + // Parse policy JSON to determine access type + // For simplicity, check if policy allows public read + if policy != "" { + // Check if policy contains public read access + if strings.Contains(policy, "s3:GetObject") && strings.Contains(policy, "Principal") && strings.Contains(policy, "*") { + if strings.Contains(policy, "s3:PutObject") { + return "public-read-write" + } + return "public-read" + } + } + + return "private" +} + +// CreateBucket creates a new bucket +func (s *Service) CreateBucket(ctx context.Context, bucketName string) error { + err := s.client.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{}) + if err != nil { + return fmt.Errorf("failed to create bucket: %w", err) + } + return nil +} + +// DeleteBucket deletes a bucket +func (s *Service) DeleteBucket(ctx context.Context, bucketName string) error { + err := s.client.RemoveBucket(ctx, bucketName) + if err != nil { + return fmt.Errorf("failed to delete bucket: %w", err) + } + return nil +} + +// GetBucketStats gets statistics for a bucket +func (s *Service) GetBucketStats(ctx context.Context, bucketName string) (*Bucket, error) { + return s.getBucketInfo(ctx, bucketName) +} + +// Object represents a MinIO object (file or folder) +type Object struct { + Name string `json:"name"` + Key string `json:"key"` // Full path/key + Size int64 `json:"size"` // Size in bytes (0 for folders) + LastModified time.Time `json:"last_modified"` + IsDir bool `json:"is_dir"` // True if this is a folder/prefix + ETag string `json:"etag,omitempty"` +} + +// ListObjects lists objects in a bucket with optional prefix (folder path) +func (s *Service) ListObjects(ctx context.Context, bucketName, prefix string) ([]*Object, error) { + // Ensure prefix ends with / if it's not empty and doesn't already end with / + if prefix != "" && !strings.HasSuffix(prefix, "/") { + prefix += "/" + } + + // List objects with prefix + objectCh := s.client.ListObjects(ctx, bucketName, minio.ListObjectsOptions{ + Prefix: prefix, + Recursive: false, // Don't recurse, show folders as separate items + }) + + var objects []*Object + seenFolders := make(map[string]bool) + + for object := range objectCh { + if object.Err != nil { + s.logger.Warn("Error listing object", "bucket", bucketName, "prefix", prefix, "error", object.Err) + continue + } + + // Extract folder name from object key + relativeKey := strings.TrimPrefix(object.Key, prefix) + + // Check if this is a folder (has / in relative path) + if strings.Contains(relativeKey, "/") { + // Extract folder name (first part before /) + folderName := strings.Split(relativeKey, "/")[0] + folderKey := prefix + folderName + "/" + + // Only add folder once + if !seenFolders[folderKey] { + seenFolders[folderKey] = true + objects = append(objects, &Object{ + Name: folderName, + Key: folderKey, + Size: 0, + LastModified: time.Time{}, + IsDir: true, + }) + } + } else { + // This is a file in the current directory + objects = append(objects, &Object{ + Name: relativeKey, + Key: object.Key, + Size: object.Size, + LastModified: object.LastModified, + IsDir: false, + ETag: object.ETag, + }) + } + } + + // Sort: folders first, then files, both alphabetically + sort.Slice(objects, func(i, j int) bool { + if objects[i].IsDir != objects[j].IsDir { + return objects[i].IsDir // Folders first + } + return objects[i].Name < objects[j].Name + }) + + return objects, nil +} + +// User represents a MinIO IAM user +type User struct { + AccessKey string `json:"access_key"` + Status string `json:"status"` // "enabled" or "disabled" + CreatedAt time.Time `json:"created_at"` +} + +// ListUsers lists all IAM users in MinIO +func (s *Service) ListUsers(ctx context.Context) ([]*User, error) { + users, err := s.adminClient.ListUsers(ctx) + if err != nil { + return nil, fmt.Errorf("failed to list users: %w", err) + } + + result := make([]*User, 0, len(users)) + for accessKey, userInfo := range users { + status := "enabled" + if userInfo.Status == madmin.AccountDisabled { + status = "disabled" + } + + // MinIO doesn't provide creation date, use current time + result = append(result, &User{ + AccessKey: accessKey, + Status: status, + CreatedAt: time.Now(), + }) + } + + return result, nil +} + +// CreateUser creates a new IAM user in MinIO +func (s *Service) CreateUser(ctx context.Context, accessKey, secretKey string) error { + err := s.adminClient.AddUser(ctx, accessKey, secretKey) + if err != nil { + return fmt.Errorf("failed to create user: %w", err) + } + return nil +} + +// DeleteUser deletes an IAM user from MinIO +func (s *Service) DeleteUser(ctx context.Context, accessKey string) error { + err := s.adminClient.RemoveUser(ctx, accessKey) + if err != nil { + return fmt.Errorf("failed to delete user: %w", err) + } + return nil +} + +// ServiceAccount represents a MinIO service account (access key) +type ServiceAccount struct { + AccessKey string `json:"access_key"` + SecretKey string `json:"secret_key,omitempty"` // Only returned on creation + ParentUser string `json:"parent_user"` + Expiration time.Time `json:"expiration,omitempty"` + CreatedAt time.Time `json:"created_at"` +} + +// ListServiceAccounts lists all service accounts in MinIO +func (s *Service) ListServiceAccounts(ctx context.Context) ([]*ServiceAccount, error) { + accounts, err := s.adminClient.ListServiceAccounts(ctx, "") + if err != nil { + return nil, fmt.Errorf("failed to list service accounts: %w", err) + } + + result := make([]*ServiceAccount, 0, len(accounts.Accounts)) + for _, account := range accounts.Accounts { + var expiration time.Time + if account.Expiration != nil { + expiration = *account.Expiration + } + + result = append(result, &ServiceAccount{ + AccessKey: account.AccessKey, + ParentUser: account.ParentUser, + Expiration: expiration, + CreatedAt: time.Now(), // MinIO doesn't provide creation date + }) + } + + return result, nil +} + +// CreateServiceAccount creates a new service account (access key) in MinIO +func (s *Service) CreateServiceAccount(ctx context.Context, parentUser string, policy string, expiration *time.Time) (*ServiceAccount, error) { + opts := madmin.AddServiceAccountReq{ + TargetUser: parentUser, + } + if policy != "" { + opts.Policy = json.RawMessage(policy) + } + if expiration != nil { + opts.Expiration = expiration + } + + creds, err := s.adminClient.AddServiceAccount(ctx, opts) + if err != nil { + return nil, fmt.Errorf("failed to create service account: %w", err) + } + + return &ServiceAccount{ + AccessKey: creds.AccessKey, + SecretKey: creds.SecretKey, + ParentUser: parentUser, + Expiration: creds.Expiration, + CreatedAt: time.Now(), + }, nil +} + +// DeleteServiceAccount deletes a service account from MinIO +func (s *Service) DeleteServiceAccount(ctx context.Context, accessKey string) error { + err := s.adminClient.DeleteServiceAccount(ctx, accessKey) + if err != nil { + return fmt.Errorf("failed to delete service account: %w", err) + } + return nil +} diff --git a/backend/internal/object_storage/setup.go b/backend/internal/object_storage/setup.go new file mode 100644 index 0000000..47ded35 --- /dev/null +++ b/backend/internal/object_storage/setup.go @@ -0,0 +1,511 @@ +package object_storage + +import ( + "context" + "database/sql" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" +) + +// SetupService handles object storage setup operations +type SetupService struct { + db *database.DB + logger *logger.Logger +} + +// NewSetupService creates a new setup service +func NewSetupService(db *database.DB, log *logger.Logger) *SetupService { + return &SetupService{ + db: db, + logger: log, + } +} + +// PoolDatasetInfo represents a pool with its datasets +type PoolDatasetInfo struct { + PoolID string `json:"pool_id"` + PoolName string `json:"pool_name"` + Datasets []DatasetInfo `json:"datasets"` +} + +// DatasetInfo represents a dataset that can be used for object storage +type DatasetInfo struct { + ID string `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` // pool/dataset + MountPoint string `json:"mount_point"` + Type string `json:"type"` + UsedBytes int64 `json:"used_bytes"` + AvailableBytes int64 `json:"available_bytes"` +} + +// GetAvailableDatasets returns all pools with their datasets that can be used for object storage +func (s *SetupService) GetAvailableDatasets(ctx context.Context) ([]PoolDatasetInfo, error) { + // Get all pools + poolsQuery := ` + SELECT id, name + FROM zfs_pools + WHERE is_active = true + ORDER BY name + ` + + rows, err := s.db.QueryContext(ctx, poolsQuery) + if err != nil { + return nil, fmt.Errorf("failed to query pools: %w", err) + } + defer rows.Close() + + var pools []PoolDatasetInfo + for rows.Next() { + var pool PoolDatasetInfo + if err := rows.Scan(&pool.PoolID, &pool.PoolName); err != nil { + s.logger.Warn("Failed to scan pool", "error", err) + continue + } + + // Get datasets for this pool + datasetsQuery := ` + SELECT id, name, type, mount_point, used_bytes, available_bytes + FROM zfs_datasets + WHERE pool_name = $1 AND type = 'filesystem' + ORDER BY name + ` + + datasetRows, err := s.db.QueryContext(ctx, datasetsQuery, pool.PoolName) + if err != nil { + s.logger.Warn("Failed to query datasets", "pool", pool.PoolName, "error", err) + pool.Datasets = []DatasetInfo{} + pools = append(pools, pool) + continue + } + + var datasets []DatasetInfo + for datasetRows.Next() { + var ds DatasetInfo + var mountPoint sql.NullString + + if err := datasetRows.Scan(&ds.ID, &ds.Name, &ds.Type, &mountPoint, &ds.UsedBytes, &ds.AvailableBytes); err != nil { + s.logger.Warn("Failed to scan dataset", "error", err) + continue + } + + ds.FullName = fmt.Sprintf("%s/%s", pool.PoolName, ds.Name) + if mountPoint.Valid { + ds.MountPoint = mountPoint.String + } else { + ds.MountPoint = "" + } + + datasets = append(datasets, ds) + } + datasetRows.Close() + + pool.Datasets = datasets + pools = append(pools, pool) + } + + return pools, nil +} + +// SetupRequest represents a request to setup object storage +type SetupRequest struct { + PoolName string `json:"pool_name" binding:"required"` + DatasetName string `json:"dataset_name" binding:"required"` + CreateNew bool `json:"create_new"` // If true, create new dataset instead of using existing +} + +// SetupResponse represents the response after setup +type SetupResponse struct { + DatasetPath string `json:"dataset_path"` + MountPoint string `json:"mount_point"` + Message string `json:"message"` +} + +// SetupObjectStorage configures MinIO to use a specific ZFS dataset +func (s *SetupService) SetupObjectStorage(ctx context.Context, req SetupRequest) (*SetupResponse, error) { + var datasetPath, mountPoint string + + // Normalize dataset name - if it already contains pool name, use it as-is + var fullDatasetName string + if strings.HasPrefix(req.DatasetName, req.PoolName+"/") { + // Dataset name already includes pool name (e.g., "pool/dataset") + fullDatasetName = req.DatasetName + } else { + // Dataset name is just the name (e.g., "dataset"), combine with pool + fullDatasetName = fmt.Sprintf("%s/%s", req.PoolName, req.DatasetName) + } + + if req.CreateNew { + // Create new dataset for object storage + + // Check if dataset already exists + checkCmd := exec.CommandContext(ctx, "sudo", "zfs", "list", "-H", "-o", "name", fullDatasetName) + if err := checkCmd.Run(); err == nil { + return nil, fmt.Errorf("dataset %s already exists", fullDatasetName) + } + + // Create dataset + createCmd := exec.CommandContext(ctx, "sudo", "zfs", "create", fullDatasetName) + if output, err := createCmd.CombinedOutput(); err != nil { + return nil, fmt.Errorf("failed to create dataset: %s - %w", string(output), err) + } + + // Get mount point + getMountCmd := exec.CommandContext(ctx, "sudo", "zfs", "get", "-H", "-o", "value", "mountpoint", fullDatasetName) + mountOutput, err := getMountCmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to get mount point: %w", err) + } + mountPoint = strings.TrimSpace(string(mountOutput)) + + datasetPath = fullDatasetName + s.logger.Info("Created new dataset for object storage", "dataset", fullDatasetName, "mount_point", mountPoint) + } else { + // Use existing dataset + // fullDatasetName already set above + + // Verify dataset exists + checkCmd := exec.CommandContext(ctx, "sudo", "zfs", "list", "-H", "-o", "name", fullDatasetName) + if err := checkCmd.Run(); err != nil { + return nil, fmt.Errorf("dataset %s does not exist", fullDatasetName) + } + + // Get mount point + getMountCmd := exec.CommandContext(ctx, "sudo", "zfs", "get", "-H", "-o", "value", "mountpoint", fullDatasetName) + mountOutput, err := getMountCmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to get mount point: %w", err) + } + mountPoint = strings.TrimSpace(string(mountOutput)) + + datasetPath = fullDatasetName + s.logger.Info("Using existing dataset for object storage", "dataset", fullDatasetName, "mount_point", mountPoint) + } + + // Ensure mount point directory exists + if mountPoint != "none" && mountPoint != "" { + if err := os.MkdirAll(mountPoint, 0755); err != nil { + return nil, fmt.Errorf("failed to create mount point directory: %w", err) + } + } else { + // If no mount point, use default path + mountPoint = filepath.Join("/opt/calypso/data/pool", req.PoolName, req.DatasetName) + if err := os.MkdirAll(mountPoint, 0755); err != nil { + return nil, fmt.Errorf("failed to create default directory: %w", err) + } + } + + // Update MinIO configuration to use the selected dataset + if err := s.updateMinIOConfig(ctx, mountPoint); err != nil { + s.logger.Warn("Failed to update MinIO configuration", "error", err) + // Continue anyway, configuration is saved to database + } + + // Save configuration to database + _, err := s.db.ExecContext(ctx, ` + INSERT INTO object_storage_config (dataset_path, mount_point, pool_name, dataset_name, created_at, updated_at) + VALUES ($1, $2, $3, $4, NOW(), NOW()) + ON CONFLICT (id) DO UPDATE + SET dataset_path = $1, mount_point = $2, pool_name = $3, dataset_name = $4, updated_at = NOW() + `, datasetPath, mountPoint, req.PoolName, req.DatasetName) + + if err != nil { + // If table doesn't exist, just log warning + s.logger.Warn("Failed to save configuration to database (table may not exist)", "error", err) + } + + return &SetupResponse{ + DatasetPath: datasetPath, + MountPoint: mountPoint, + Message: fmt.Sprintf("Object storage configured to use dataset %s at %s. MinIO service needs to be restarted to use the new dataset.", datasetPath, mountPoint), + }, nil +} + +// GetCurrentSetup returns the current object storage configuration +func (s *SetupService) GetCurrentSetup(ctx context.Context) (*SetupResponse, error) { + // Check if table exists first + var tableExists bool + checkQuery := ` + SELECT EXISTS ( + SELECT FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name = 'object_storage_config' + ) + ` + err := s.db.QueryRowContext(ctx, checkQuery).Scan(&tableExists) + if err != nil { + s.logger.Warn("Failed to check if object_storage_config table exists", "error", err) + return nil, nil // Return nil if can't check + } + + if !tableExists { + s.logger.Debug("object_storage_config table does not exist") + return nil, nil // No table, no configuration + } + + query := ` + SELECT dataset_path, mount_point, pool_name, dataset_name + FROM object_storage_config + ORDER BY updated_at DESC + LIMIT 1 + ` + + var resp SetupResponse + var poolName, datasetName string + err = s.db.QueryRowContext(ctx, query).Scan(&resp.DatasetPath, &resp.MountPoint, &poolName, &datasetName) + if err == sql.ErrNoRows { + s.logger.Debug("No configuration found in database") + return nil, nil // No configuration found + } + if err != nil { + // Check if error is due to table not existing or permission denied + errStr := err.Error() + if strings.Contains(errStr, "does not exist") || strings.Contains(errStr, "permission denied") { + s.logger.Debug("Table does not exist or permission denied, returning nil", "error", errStr) + return nil, nil // Return nil instead of error + } + s.logger.Error("Failed to scan current setup", "error", err) + return nil, fmt.Errorf("failed to get current setup: %w", err) + } + + s.logger.Debug("Found current setup", "dataset_path", resp.DatasetPath, "mount_point", resp.MountPoint, "pool", poolName, "dataset", datasetName) + // Use dataset_path directly since it already contains the full path + resp.Message = fmt.Sprintf("Using dataset %s at %s", resp.DatasetPath, resp.MountPoint) + return &resp, nil +} + +// UpdateObjectStorage updates the object storage configuration to use a different dataset +// This will update the configuration but won't migrate existing data +func (s *SetupService) UpdateObjectStorage(ctx context.Context, req SetupRequest) (*SetupResponse, error) { + // First check if there's existing configuration + currentSetup, err := s.GetCurrentSetup(ctx) + if err != nil { + return nil, fmt.Errorf("failed to check current setup: %w", err) + } + + if currentSetup == nil { + // No existing setup, just do normal setup + return s.SetupObjectStorage(ctx, req) + } + + // There's existing setup, proceed with update + var datasetPath, mountPoint string + + // Normalize dataset name - if it already contains pool name, use it as-is + var fullDatasetName string + if strings.HasPrefix(req.DatasetName, req.PoolName+"/") { + // Dataset name already includes pool name (e.g., "pool/dataset") + fullDatasetName = req.DatasetName + } else { + // Dataset name is just the name (e.g., "dataset"), combine with pool + fullDatasetName = fmt.Sprintf("%s/%s", req.PoolName, req.DatasetName) + } + + if req.CreateNew { + // Create new dataset for object storage + + // Check if dataset already exists + checkCmd := exec.CommandContext(ctx, "sudo", "zfs", "list", "-H", "-o", "name", fullDatasetName) + if err := checkCmd.Run(); err == nil { + return nil, fmt.Errorf("dataset %s already exists", fullDatasetName) + } + + // Create dataset + createCmd := exec.CommandContext(ctx, "sudo", "zfs", "create", fullDatasetName) + if output, err := createCmd.CombinedOutput(); err != nil { + return nil, fmt.Errorf("failed to create dataset: %s - %w", string(output), err) + } + + // Get mount point + getMountCmd := exec.CommandContext(ctx, "sudo", "zfs", "get", "-H", "-o", "value", "mountpoint", fullDatasetName) + mountOutput, err := getMountCmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to get mount point: %w", err) + } + mountPoint = strings.TrimSpace(string(mountOutput)) + + datasetPath = fullDatasetName + s.logger.Info("Created new dataset for object storage update", "dataset", fullDatasetName, "mount_point", mountPoint) + } else { + // Use existing dataset + // fullDatasetName already set above + + // Verify dataset exists + checkCmd := exec.CommandContext(ctx, "sudo", "zfs", "list", "-H", "-o", "name", fullDatasetName) + if err := checkCmd.Run(); err != nil { + return nil, fmt.Errorf("dataset %s does not exist", fullDatasetName) + } + + // Get mount point + getMountCmd := exec.CommandContext(ctx, "sudo", "zfs", "get", "-H", "-o", "value", "mountpoint", fullDatasetName) + mountOutput, err := getMountCmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to get mount point: %w", err) + } + mountPoint = strings.TrimSpace(string(mountOutput)) + + datasetPath = fullDatasetName + s.logger.Info("Using existing dataset for object storage update", "dataset", fullDatasetName, "mount_point", mountPoint) + } + + // Ensure mount point directory exists + if mountPoint != "none" && mountPoint != "" { + if err := os.MkdirAll(mountPoint, 0755); err != nil { + return nil, fmt.Errorf("failed to create mount point directory: %w", err) + } + } else { + // If no mount point, use default path + mountPoint = filepath.Join("/opt/calypso/data/pool", req.PoolName, req.DatasetName) + if err := os.MkdirAll(mountPoint, 0755); err != nil { + return nil, fmt.Errorf("failed to create default directory: %w", err) + } + } + + // Update configuration in database + _, err = s.db.ExecContext(ctx, ` + UPDATE object_storage_config + SET dataset_path = $1, mount_point = $2, pool_name = $3, dataset_name = $4, updated_at = NOW() + WHERE id = (SELECT id FROM object_storage_config ORDER BY updated_at DESC LIMIT 1) + `, datasetPath, mountPoint, req.PoolName, req.DatasetName) + + if err != nil { + // If update fails, try insert + _, err = s.db.ExecContext(ctx, ` + INSERT INTO object_storage_config (dataset_path, mount_point, pool_name, dataset_name, created_at, updated_at) + VALUES ($1, $2, $3, $4, NOW(), NOW()) + ON CONFLICT (dataset_path) DO UPDATE + SET mount_point = $2, pool_name = $3, dataset_name = $4, updated_at = NOW() + `, datasetPath, mountPoint, req.PoolName, req.DatasetName) + if err != nil { + s.logger.Warn("Failed to update configuration in database", "error", err) + } + } + + // Update MinIO configuration to use the selected dataset + if err := s.updateMinIOConfig(ctx, mountPoint); err != nil { + s.logger.Warn("Failed to update MinIO configuration", "error", err) + // Continue anyway, configuration is saved to database + } else { + // Restart MinIO service to apply new configuration + if err := s.restartMinIOService(ctx); err != nil { + s.logger.Warn("Failed to restart MinIO service", "error", err) + // Continue anyway, user can restart manually + } + } + + return &SetupResponse{ + DatasetPath: datasetPath, + MountPoint: mountPoint, + Message: fmt.Sprintf("Object storage updated to use dataset %s at %s. Note: Existing data in previous dataset (%s) is not migrated automatically. MinIO service has been restarted.", datasetPath, mountPoint, currentSetup.DatasetPath), + }, nil +} + +// updateMinIOConfig updates MinIO configuration file to use dataset mount point directly +// Note: MinIO erasure coding requires direct directory paths, not symlinks +func (s *SetupService) updateMinIOConfig(ctx context.Context, datasetMountPoint string) error { + configFile := "/opt/calypso/conf/minio/minio.conf" + + // Ensure dataset mount point directory exists and has correct ownership + if err := os.MkdirAll(datasetMountPoint, 0755); err != nil { + return fmt.Errorf("failed to create dataset mount point directory: %w", err) + } + + // Set ownership to minio-user so MinIO can write to it + if err := exec.CommandContext(ctx, "sudo", "chown", "-R", "minio-user:minio-user", datasetMountPoint).Run(); err != nil { + s.logger.Warn("Failed to set ownership on dataset mount point", "path", datasetMountPoint, "error", err) + // Continue anyway, might already have correct ownership + } + + // Set permissions + if err := exec.CommandContext(ctx, "sudo", "chmod", "755", datasetMountPoint).Run(); err != nil { + s.logger.Warn("Failed to set permissions on dataset mount point", "path", datasetMountPoint, "error", err) + } + + s.logger.Info("Prepared dataset mount point for MinIO", "path", datasetMountPoint) + + // Read current config file + configContent, err := os.ReadFile(configFile) + if err != nil { + // If file doesn't exist, create it + if os.IsNotExist(err) { + configContent = []byte(fmt.Sprintf("MINIO_ROOT_USER=admin\nMINIO_ROOT_PASSWORD=HqBX1IINqFynkWFa\nMINIO_VOLUMES=%s\n", datasetMountPoint)) + } else { + return fmt.Errorf("failed to read MinIO config file: %w", err) + } + } else { + // Update MINIO_VOLUMES in config + lines := strings.Split(string(configContent), "\n") + updated := false + for i, line := range lines { + if strings.HasPrefix(strings.TrimSpace(line), "MINIO_VOLUMES=") { + lines[i] = fmt.Sprintf("MINIO_VOLUMES=%s", datasetMountPoint) + updated = true + break + } + } + if !updated { + // Add MINIO_VOLUMES if not found + lines = append(lines, fmt.Sprintf("MINIO_VOLUMES=%s", datasetMountPoint)) + } + configContent = []byte(strings.Join(lines, "\n")) + } + + // Write updated config using sudo + // Write temp file to a location we can write to + userTempFile := fmt.Sprintf("/tmp/minio.conf.%d.tmp", os.Getpid()) + if err := os.WriteFile(userTempFile, configContent, 0644); err != nil { + return fmt.Errorf("failed to write temp config file: %w", err) + } + defer os.Remove(userTempFile) // Cleanup + + // Copy temp file to config location with sudo + if err := exec.CommandContext(ctx, "sudo", "cp", userTempFile, configFile).Run(); err != nil { + return fmt.Errorf("failed to update config file: %w", err) + } + + // Set proper ownership and permissions + if err := exec.CommandContext(ctx, "sudo", "chown", "minio-user:minio-user", configFile).Run(); err != nil { + s.logger.Warn("Failed to set config file ownership", "error", err) + } + if err := exec.CommandContext(ctx, "sudo", "chmod", "644", configFile).Run(); err != nil { + s.logger.Warn("Failed to set config file permissions", "error", err) + } + + s.logger.Info("Updated MinIO configuration", "config_file", configFile, "volumes", datasetMountPoint) + + return nil +} + +// restartMinIOService restarts the MinIO service to apply new configuration +func (s *SetupService) restartMinIOService(ctx context.Context) error { + // Restart MinIO service using sudo + cmd := exec.CommandContext(ctx, "sudo", "systemctl", "restart", "minio.service") + if err := cmd.Run(); err != nil { + return fmt.Errorf("failed to restart MinIO service: %w", err) + } + + // Wait a moment for service to start + time.Sleep(2 * time.Second) + + // Verify service is running + checkCmd := exec.CommandContext(ctx, "sudo", "systemctl", "is-active", "minio.service") + output, err := checkCmd.Output() + if err != nil { + return fmt.Errorf("failed to check MinIO service status: %w", err) + } + + status := strings.TrimSpace(string(output)) + if status != "active" { + return fmt.Errorf("MinIO service is not active after restart, status: %s", status) + } + + s.logger.Info("MinIO service restarted successfully") + return nil +} diff --git a/backend/internal/scst/handler.go b/backend/internal/scst/handler.go index 1a3349e..a218fd5 100644 --- a/backend/internal/scst/handler.go +++ b/backend/internal/scst/handler.go @@ -3,11 +3,13 @@ package scst import ( "fmt" "net/http" + "strings" "github.com/atlasos/calypso/internal/common/database" "github.com/atlasos/calypso/internal/common/logger" "github.com/atlasos/calypso/internal/tasks" "github.com/gin-gonic/gin" + "github.com/go-playground/validator/v10" ) // Handler handles SCST-related API requests @@ -37,6 +39,11 @@ func (h *Handler) ListTargets(c *gin.Context) { return } + // Ensure we return an empty array instead of null + if targets == nil { + targets = []Target{} + } + c.JSON(http.StatusOK, gin.H{"targets": targets}) } @@ -112,6 +119,11 @@ func (h *Handler) CreateTarget(c *gin.Context) { return } + // Set alias to name for frontend compatibility (same as ListTargets) + target.Alias = target.Name + // LUNCount will be 0 for newly created target + target.LUNCount = 0 + c.JSON(http.StatusCreated, target) } @@ -119,7 +131,7 @@ func (h *Handler) CreateTarget(c *gin.Context) { type AddLUNRequest struct { DeviceName string `json:"device_name" binding:"required"` DevicePath string `json:"device_path" binding:"required"` - LUNNumber int `json:"lun_number" binding:"required"` + LUNNumber int `json:"lun_number"` // Note: cannot use binding:"required" for int as 0 is valid HandlerType string `json:"handler_type" binding:"required"` } @@ -136,17 +148,45 @@ func (h *Handler) AddLUN(c *gin.Context) { var req AddLUNRequest if err := c.ShouldBindJSON(&req); err != nil { h.logger.Error("Failed to bind AddLUN request", "error", err) - c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("invalid request: %v", err)}) + // Provide more detailed error message + if validationErr, ok := err.(validator.ValidationErrors); ok { + var errorMessages []string + for _, fieldErr := range validationErr { + errorMessages = append(errorMessages, fmt.Sprintf("%s is required", fieldErr.Field())) + } + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("validation failed: %s", strings.Join(errorMessages, ", "))}) + } else { + // Extract error message without full struct name + errMsg := err.Error() + if idx := strings.Index(errMsg, "Key: '"); idx >= 0 { + // Extract field name from error message + fieldStart := idx + 6 // Length of "Key: '" + if fieldEnd := strings.Index(errMsg[fieldStart:], "'"); fieldEnd >= 0 { + fieldName := errMsg[fieldStart : fieldStart+fieldEnd] + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("invalid or missing field: %s", fieldName)}) + } else { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request format"}) + } + } else { + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("invalid request: %v", err)}) + } + } return } - // Validate required fields + // Validate required fields (additional check in case binding doesn't catch it) if req.DeviceName == "" || req.DevicePath == "" || req.HandlerType == "" { h.logger.Error("Missing required fields in AddLUN request", "device_name", req.DeviceName, "device_path", req.DevicePath, "handler_type", req.HandlerType) c.JSON(http.StatusBadRequest, gin.H{"error": "device_name, device_path, and handler_type are required"}) return } + // Validate LUN number range + if req.LUNNumber < 0 || req.LUNNumber > 255 { + c.JSON(http.StatusBadRequest, gin.H{"error": "lun_number must be between 0 and 255"}) + return + } + if err := h.service.AddLUN(c.Request.Context(), target.IQN, req.DeviceName, req.DevicePath, req.LUNNumber, req.HandlerType); err != nil { h.logger.Error("Failed to add LUN", "error", err) c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) @@ -156,6 +196,48 @@ func (h *Handler) AddLUN(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "LUN added successfully"}) } +// RemoveLUN removes a LUN from a target +func (h *Handler) RemoveLUN(c *gin.Context) { + targetID := c.Param("id") + lunID := c.Param("lunId") + + // Get target + target, err := h.service.GetTarget(c.Request.Context(), targetID) + if err != nil { + c.JSON(http.StatusNotFound, gin.H{"error": "target not found"}) + return + } + + // Get LUN to get the LUN number + var lunNumber int + err = h.db.QueryRowContext(c.Request.Context(), + "SELECT lun_number FROM scst_luns WHERE id = $1 AND target_id = $2", + lunID, targetID, + ).Scan(&lunNumber) + if err != nil { + if strings.Contains(err.Error(), "no rows") { + // LUN already deleted from database - check if it still exists in SCST + // Try to get LUN number from URL or try common LUN numbers + // For now, return success since it's already deleted (idempotent) + h.logger.Info("LUN not found in database, may already be deleted", "lun_id", lunID, "target_id", targetID) + c.JSON(http.StatusOK, gin.H{"message": "LUN already removed or not found"}) + return + } + h.logger.Error("Failed to get LUN", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get LUN"}) + return + } + + // Remove LUN + if err := h.service.RemoveLUN(c.Request.Context(), target.IQN, lunNumber); err != nil { + h.logger.Error("Failed to remove LUN", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "LUN removed successfully"}) +} + // AddInitiatorRequest represents an initiator addition request type AddInitiatorRequest struct { InitiatorIQN string `json:"initiator_iqn" binding:"required"` @@ -186,6 +268,45 @@ func (h *Handler) AddInitiator(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "Initiator added successfully"}) } +// AddInitiatorToGroupRequest represents a request to add an initiator to a group +type AddInitiatorToGroupRequest struct { + InitiatorIQN string `json:"initiator_iqn" binding:"required"` +} + +// AddInitiatorToGroup adds an initiator to a specific group +func (h *Handler) AddInitiatorToGroup(c *gin.Context) { + groupID := c.Param("id") + + var req AddInitiatorToGroupRequest + if err := c.ShouldBindJSON(&req); err != nil { + validationErrors := make(map[string]string) + if ve, ok := err.(validator.ValidationErrors); ok { + for _, fe := range ve { + field := strings.ToLower(fe.Field()) + validationErrors[field] = fmt.Sprintf("Field '%s' is required", field) + } + } + c.JSON(http.StatusBadRequest, gin.H{ + "error": "invalid request", + "validation_errors": validationErrors, + }) + return + } + + err := h.service.AddInitiatorToGroup(c.Request.Context(), groupID, req.InitiatorIQN) + if err != nil { + if strings.Contains(err.Error(), "not found") || strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "single initiator only") { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + h.logger.Error("Failed to add initiator to group", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to add initiator to group"}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "Initiator added to group successfully"}) +} + // ListAllInitiators lists all initiators across all targets func (h *Handler) ListAllInitiators(c *gin.Context) { initiators, err := h.service.ListAllInitiators(c.Request.Context()) @@ -440,6 +561,23 @@ func (h *Handler) DisableTarget(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "Target disabled successfully"}) } +// DeleteTarget deletes a target +func (h *Handler) DeleteTarget(c *gin.Context) { + targetID := c.Param("id") + + if err := h.service.DeleteTarget(c.Request.Context(), targetID); err != nil { + if err.Error() == "target not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "target not found"}) + return + } + h.logger.Error("Failed to delete target", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "Target deleted successfully"}) +} + // DeletePortal deletes a portal func (h *Handler) DeletePortal(c *gin.Context) { id := c.Param("id") @@ -474,3 +612,182 @@ func (h *Handler) GetPortal(c *gin.Context) { c.JSON(http.StatusOK, portal) } + +// CreateInitiatorGroupRequest represents a request to create an initiator group +type CreateInitiatorGroupRequest struct { + TargetID string `json:"target_id" binding:"required"` + GroupName string `json:"group_name" binding:"required"` +} + +// CreateInitiatorGroup creates a new initiator group +func (h *Handler) CreateInitiatorGroup(c *gin.Context) { + var req CreateInitiatorGroupRequest + if err := c.ShouldBindJSON(&req); err != nil { + validationErrors := make(map[string]string) + if ve, ok := err.(validator.ValidationErrors); ok { + for _, fe := range ve { + field := strings.ToLower(fe.Field()) + validationErrors[field] = fmt.Sprintf("Field '%s' is required", field) + } + } + c.JSON(http.StatusBadRequest, gin.H{ + "error": "invalid request", + "validation_errors": validationErrors, + }) + return + } + + group, err := h.service.CreateInitiatorGroup(c.Request.Context(), req.TargetID, req.GroupName) + if err != nil { + if strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "not found") { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + h.logger.Error("Failed to create initiator group", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create initiator group"}) + return + } + + c.JSON(http.StatusOK, group) +} + +// UpdateInitiatorGroupRequest represents a request to update an initiator group +type UpdateInitiatorGroupRequest struct { + GroupName string `json:"group_name" binding:"required"` +} + +// UpdateInitiatorGroup updates an initiator group +func (h *Handler) UpdateInitiatorGroup(c *gin.Context) { + groupID := c.Param("id") + + var req UpdateInitiatorGroupRequest + if err := c.ShouldBindJSON(&req); err != nil { + validationErrors := make(map[string]string) + if ve, ok := err.(validator.ValidationErrors); ok { + for _, fe := range ve { + field := strings.ToLower(fe.Field()) + validationErrors[field] = fmt.Sprintf("Field '%s' is required", field) + } + } + c.JSON(http.StatusBadRequest, gin.H{ + "error": "invalid request", + "validation_errors": validationErrors, + }) + return + } + + group, err := h.service.UpdateInitiatorGroup(c.Request.Context(), groupID, req.GroupName) + if err != nil { + if strings.Contains(err.Error(), "not found") || strings.Contains(err.Error(), "already exists") { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + h.logger.Error("Failed to update initiator group", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update initiator group"}) + return + } + + c.JSON(http.StatusOK, group) +} + +// DeleteInitiatorGroup deletes an initiator group +func (h *Handler) DeleteInitiatorGroup(c *gin.Context) { + groupID := c.Param("id") + + err := h.service.DeleteInitiatorGroup(c.Request.Context(), groupID) + if err != nil { + if strings.Contains(err.Error(), "not found") { + c.JSON(http.StatusNotFound, gin.H{"error": err.Error()}) + return + } + if strings.Contains(err.Error(), "cannot delete") || strings.Contains(err.Error(), "contains") { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + h.logger.Error("Failed to delete initiator group", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete initiator group"}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "initiator group deleted successfully"}) +} + +// GetInitiatorGroup retrieves an initiator group by ID +func (h *Handler) GetInitiatorGroup(c *gin.Context) { + groupID := c.Param("id") + + group, err := h.service.GetInitiatorGroup(c.Request.Context(), groupID) + if err != nil { + if strings.Contains(err.Error(), "not found") { + c.JSON(http.StatusNotFound, gin.H{"error": "initiator group not found"}) + return + } + h.logger.Error("Failed to get initiator group", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get initiator group"}) + return + } + + c.JSON(http.StatusOK, group) +} + +// ListAllInitiatorGroups lists all initiator groups +func (h *Handler) ListAllInitiatorGroups(c *gin.Context) { + groups, err := h.service.ListAllInitiatorGroups(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list initiator groups", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list initiator groups"}) + return + } + + if groups == nil { + groups = []InitiatorGroup{} + } + + c.JSON(http.StatusOK, gin.H{"groups": groups}) +} + +// GetConfigFile reads the SCST configuration file content +func (h *Handler) GetConfigFile(c *gin.Context) { + configPath := c.DefaultQuery("path", "/etc/scst.conf") + + content, err := h.service.ReadConfigFile(c.Request.Context(), configPath) + if err != nil { + h.logger.Error("Failed to read config file", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "content": content, + "path": configPath, + }) +} + +// UpdateConfigFile writes content to SCST configuration file +func (h *Handler) UpdateConfigFile(c *gin.Context) { + var req struct { + Content string `json:"content" binding:"required"` + Path string `json:"path"` + } + + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"}) + return + } + + configPath := req.Path + if configPath == "" { + configPath = "/etc/scst.conf" + } + + if err := h.service.WriteConfigFile(c.Request.Context(), configPath, req.Content); err != nil { + h.logger.Error("Failed to write config file", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "message": "Configuration file updated successfully", + "path": configPath, + }) +} diff --git a/backend/internal/scst/service.go b/backend/internal/scst/service.go index 8ec7e55..4be0ebc 100644 --- a/backend/internal/scst/service.go +++ b/backend/internal/scst/service.go @@ -31,7 +31,8 @@ func NewService(db *database.DB, log *logger.Logger) *Service { type Target struct { ID string `json:"id"` IQN string `json:"iqn"` - TargetType string `json:"target_type"` // 'disk', 'vtl', 'physical_tape' + Alias string `json:"alias,omitempty"` // Alias for frontend compatibility (uses name) + TargetType string `json:"target_type"` // 'disk', 'vtl', 'physical_tape' Name string `json:"name"` Description string `json:"description"` IsActive bool `json:"is_active"` @@ -101,7 +102,7 @@ func (s *Service) CreateTarget(ctx context.Context, target *Target) error { } // Create target in SCST - cmd := exec.CommandContext(ctx, "scstadmin", "-add_target", target.IQN, "-driver", "iscsi") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_target", target.IQN, "-driver", "iscsi") output, err := cmd.CombinedOutput() outputStr := string(output) @@ -151,44 +152,73 @@ func (s *Service) CreateTarget(ctx context.Context, target *Target) error { ).Scan(&target.ID, &target.CreatedAt, &target.UpdatedAt) if err != nil { // Rollback: remove from SCST - exec.CommandContext(ctx, "scstadmin", "-remove_target", target.IQN, "-driver", "iscsi").Run() + exec.CommandContext(ctx, "sudo", "scstadmin", "-remove_target", target.IQN, "-driver", "iscsi").Run() return fmt.Errorf("failed to save target to database: %w", err) } s.logger.Info("SCST target created", "iqn", target.IQN, "type", target.TargetType) + + // Apply active portals to the new target + if err := s.applyPortalsToTarget(ctx, target.IQN); err != nil { + s.logger.Warn("Failed to apply portals to new target", "iqn", target.IQN, "error", err) + // Don't fail target creation if portal application fails + } + return nil } -// AddLUN adds a LUN to a target +// AddLUN assigns an extent (device) to initiator groups as a LUN +// Note: The device/extent should already be created and opened in SCST +// This function only assigns the LUN to initiator groups, not to the target itself func (s *Service) AddLUN(ctx context.Context, targetIQN, deviceName, devicePath string, lunNumber int, handlerType string) error { - // Open device in SCST - openCmd := exec.CommandContext(ctx, "scstadmin", "-open_dev", deviceName, - "-handler", handlerType, - "-attributes", fmt.Sprintf("filename=%s", devicePath)) - output, err := openCmd.CombinedOutput() - if err != nil { - if !strings.Contains(string(output), "already exists") { - return fmt.Errorf("failed to open device in SCST: %s: %w", string(output), err) - } - } - - // Add LUN to target - addCmd := exec.CommandContext(ctx, "scstadmin", "-add_lun", fmt.Sprintf("%d", lunNumber), - "-target", targetIQN, - "-driver", "iscsi", - "-device", deviceName) - output, err = addCmd.CombinedOutput() - if err != nil { - return fmt.Errorf("failed to add LUN to target: %s: %w", string(output), err) - } - // Get target ID var targetID string - err = s.db.QueryRowContext(ctx, "SELECT id FROM scst_targets WHERE iqn = $1", targetIQN).Scan(&targetID) + err := s.db.QueryRowContext(ctx, "SELECT id FROM scst_targets WHERE iqn = $1", targetIQN).Scan(&targetID) if err != nil { return fmt.Errorf("failed to get target ID: %w", err) } + // Get all initiator groups for this target + groups, err := s.GetTargetInitiatorGroups(ctx, targetID) + if err != nil { + return fmt.Errorf("failed to get initiator groups: %w", err) + } + + if len(groups) == 0 { + return fmt.Errorf("no initiator groups found for target %s. Please create an initiator group first", targetIQN) + } + + // Assign LUN to each group + // Command format: scstadmin -add_lun -driver iscsi -target -group -device + for _, group := range groups { + assignCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_lun", fmt.Sprintf("%d", lunNumber), + "-driver", "iscsi", + "-target", targetIQN, + "-group", group.GroupName, + "-device", deviceName) + output, err := assignCmd.CombinedOutput() + outputStr := string(output) + + // Log the command output for debugging + s.logger.Info("Assigning LUN to initiator group", + "target", targetIQN, + "group", group.GroupName, + "lun", lunNumber, + "device", deviceName, + "command", fmt.Sprintf("scstadmin -add_lun %d -driver iscsi -target %s -group %s -device %s", lunNumber, targetIQN, group.GroupName, deviceName), + "output", outputStr) + + if err != nil { + return fmt.Errorf("failed to assign LUN to initiator group %s: %s: %w", group.GroupName, outputStr, err) + } + + s.logger.Info("LUN assigned to initiator group", + "target", targetIQN, + "group", group.GroupName, + "lun", lunNumber, + "device", deviceName) + } + // Insert into database _, err = s.db.ExecContext(ctx, ` INSERT INTO scst_luns (target_id, lun_number, device_name, device_path, handler_type) @@ -202,7 +232,76 @@ func (s *Service) AddLUN(ctx context.Context, targetIQN, deviceName, devicePath return fmt.Errorf("failed to save LUN to database: %w", err) } - s.logger.Info("LUN added", "target", targetIQN, "lun", lunNumber, "device", deviceName) + // Write config to persist changes + configPath := "/etc/calypso/scst/generated.conf" + if err := s.WriteConfig(ctx, configPath); err != nil { + s.logger.Warn("Failed to write config after LUN assignment", "error", err) + // Don't fail the assignment if config write fails + } + + s.logger.Info("LUN assigned to initiator groups", "target", targetIQN, "lun", lunNumber, "device", deviceName) + return nil +} + +// RemoveLUN removes a LUN from a target +func (s *Service) RemoveLUN(ctx context.Context, targetIQN string, lunNumber int) error { + // Remove LUN from SCST first + // scstadmin -rem_lun may require interactive confirmation, so we pipe "y" to it + remCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_lun", fmt.Sprintf("%d", lunNumber), + "-driver", "iscsi", + "-target", targetIQN, "-noprompt") + output, err := remCmd.CombinedOutput() + outputStr := string(output) + + // Log the command output for debugging + s.logger.Info("Removing LUN from SCST", "target", targetIQN, "lun", lunNumber, "output", outputStr) + + if err != nil { + // Check if LUN doesn't exist in SCST (not an error, but log it) + if strings.Contains(outputStr, "not found") || strings.Contains(outputStr, "does not exist") { + s.logger.Info("LUN not found in SCST, continuing with database deletion", "target", targetIQN, "lun", lunNumber) + } else { + // Real error - return error to prevent database deletion + s.logger.Error("Failed to remove LUN from SCST", "target", targetIQN, "lun", lunNumber, "output", outputStr, "error", err) + return fmt.Errorf("failed to remove LUN from SCST: %s: %w", outputStr, err) + } + } else { + // Command succeeded - verify by checking output + if strings.Contains(outputStr, "Removing") || strings.Contains(outputStr, "done") || strings.Contains(outputStr, "All done") { + s.logger.Info("LUN removed from SCST successfully", "target", targetIQN, "lun", lunNumber, "output", outputStr) + } else { + // Output doesn't indicate success, but no error - log warning + s.logger.Warn("LUN removal command completed but output unclear", "target", targetIQN, "lun", lunNumber, "output", outputStr) + } + } + + // Get target ID + var targetID string + err = s.db.QueryRowContext(ctx, "SELECT id FROM scst_targets WHERE iqn = $1", targetIQN).Scan(&targetID) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("target not found") + } + return fmt.Errorf("failed to get target ID: %w", err) + } + + // Remove from database + _, err = s.db.ExecContext(ctx, ` + DELETE FROM scst_luns + WHERE target_id = $1 AND lun_number = $2 + `, targetID, lunNumber) + if err != nil { + return fmt.Errorf("failed to remove LUN from database: %w", err) + } + + // Write config to persist changes + configPath := "/etc/calypso/scst/generated.conf" + if err := s.WriteConfig(ctx, configPath); err != nil { + s.logger.Warn("Failed to write config after LUN deletion", "error", err) + // Don't fail the deletion if config write fails + } + + s.logger.Info("LUN removed", "target", targetIQN, "lun", lunNumber) return nil } @@ -241,7 +340,7 @@ func (s *Service) AddInitiator(ctx context.Context, targetIQN, initiatorIQN stri if err == sql.ErrNoRows { // Create group in SCST - cmd := exec.CommandContext(ctx, "scstadmin", "-add_group", groupName, + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_group", groupName, "-target", targetIQN, "-driver", "iscsi") output, err := cmd.CombinedOutput() @@ -262,7 +361,7 @@ func (s *Service) AddInitiator(ctx context.Context, targetIQN, initiatorIQN stri } // Add initiator to group in SCST - cmd := exec.CommandContext(ctx, "scstadmin", "-add_init", initiatorIQN, + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_init", initiatorIQN, "-group", groupName, "-target", targetIQN, "-driver", "iscsi") @@ -369,6 +468,77 @@ func (s *Service) ListAllInitiators(ctx context.Context) ([]InitiatorWithTarget, return initiators, rows.Err() } +// AddInitiatorToGroup adds an initiator to a specific group +func (s *Service) AddInitiatorToGroup(ctx context.Context, groupID, initiatorIQN string) error { + // Get group info + var groupName, targetIQN string + var targetID string + var singleInitiatorOnly bool + err := s.db.QueryRowContext(ctx, ` + SELECT ig.group_name, t.iqn, t.id, t.single_initiator_only + FROM scst_initiator_groups ig + JOIN scst_targets t ON ig.target_id = t.id + WHERE ig.id = $1 + `, groupID).Scan(&groupName, &targetIQN, &targetID, &singleInitiatorOnly) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("initiator group not found") + } + return fmt.Errorf("failed to get initiator group: %w", err) + } + + // Check single initiator policy + if singleInitiatorOnly { + var existingCount int + s.db.QueryRowContext(ctx, + "SELECT COUNT(*) FROM scst_initiators WHERE group_id IN (SELECT id FROM scst_initiator_groups WHERE target_id = $1)", + targetID, + ).Scan(&existingCount) + if existingCount > 0 { + return fmt.Errorf("target enforces single initiator only") + } + } + + // Check if initiator already exists in this group + var existingID string + err = s.db.QueryRowContext(ctx, + "SELECT id FROM scst_initiators WHERE group_id = $1 AND iqn = $2", + groupID, initiatorIQN, + ).Scan(&existingID) + if err == nil { + return fmt.Errorf("initiator '%s' already exists in this group", initiatorIQN) + } else if err != sql.ErrNoRows { + return fmt.Errorf("failed to check existing initiator: %w", err) + } + + // Add initiator to group in SCST + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_init", initiatorIQN, + "-group", groupName, + "-target", targetIQN, + "-driver", "iscsi") + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to add initiator to SCST: %s: %w", string(output), err) + } + + // Insert into database + _, err = s.db.ExecContext(ctx, ` + INSERT INTO scst_initiators (group_id, iqn, is_active) + VALUES ($1, $2, true) + `, groupID, initiatorIQN) + if err != nil { + // Try to remove from SCST if database insert fails + exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_init", initiatorIQN, + "-group", groupName, + "-target", targetIQN, + "-driver", "iscsi").Run() + return fmt.Errorf("failed to save initiator to database: %w", err) + } + + s.logger.Info("Initiator added to group", "group", groupName, "initiator", initiatorIQN, "target", targetIQN) + return nil +} + // RemoveInitiator removes an initiator from a target func (s *Service) RemoveInitiator(ctx context.Context, initiatorID string) error { // Get initiator info @@ -388,7 +558,8 @@ func (s *Service) RemoveInitiator(ctx context.Context, initiatorID string) error } // Remove from SCST - cmd := exec.CommandContext(ctx, "scstadmin", "-remove_init", initiatorIQN, + // Note: scstadmin uses -rem_init (not -remove_init) + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_init", initiatorIQN, "-group", groupName, "-target", targetIQN, "-driver", "iscsi") @@ -468,6 +639,313 @@ func (s *Service) getGroupInitiators(ctx context.Context, groupID string) ([]Ini return initiators, rows.Err() } +// CreateInitiatorGroup creates a new initiator group for a target +func (s *Service) CreateInitiatorGroup(ctx context.Context, targetID, groupName string) (*InitiatorGroup, error) { + // Get target IQN + var targetIQN string + err := s.db.QueryRowContext(ctx, "SELECT iqn FROM scst_targets WHERE id = $1", targetID).Scan(&targetIQN) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("target not found") + } + return nil, fmt.Errorf("failed to get target: %w", err) + } + + // Validate group name + if groupName == "" { + return nil, fmt.Errorf("group name cannot be empty") + } + + // Check if group already exists + var existingID string + err = s.db.QueryRowContext(ctx, + "SELECT id FROM scst_initiator_groups WHERE target_id = $1 AND group_name = $2", + targetID, groupName, + ).Scan(&existingID) + if err == nil { + return nil, fmt.Errorf("initiator group with name '%s' already exists for this target", groupName) + } else if err != sql.ErrNoRows { + return nil, fmt.Errorf("failed to check existing group: %w", err) + } + + // Create group in SCST + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_group", groupName, + "-target", targetIQN, + "-driver", "iscsi") + output, err := cmd.CombinedOutput() + if err != nil { + return nil, fmt.Errorf("failed to create initiator group in SCST: %s: %w", string(output), err) + } + + // Insert into database + var groupID string + err = s.db.QueryRowContext(ctx, + "INSERT INTO scst_initiator_groups (target_id, group_name) VALUES ($1, $2) RETURNING id", + targetID, groupName, + ).Scan(&groupID) + if err != nil { + // Try to remove from SCST if database insert fails + // scstadmin -rem_group requires interactive confirmation, so we pipe "y" to it + rollbackCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_group", groupName, + "-target", targetIQN, + "-driver", "iscsi", "-noprompt") + rollbackCmd.Run() + return nil, fmt.Errorf("failed to save group to database: %w", err) + } + + group := &InitiatorGroup{ + ID: groupID, + TargetID: targetID, + GroupName: groupName, + Initiators: []Initiator{}, + CreatedAt: time.Now(), + } + + s.logger.Info("Initiator group created", "target_id", targetID, "group_name", groupName) + return group, nil +} + +// UpdateInitiatorGroup updates an initiator group (rename) +func (s *Service) UpdateInitiatorGroup(ctx context.Context, groupID, newGroupName string) (*InitiatorGroup, error) { + // Get group info + var targetIQN, oldGroupName string + err := s.db.QueryRowContext(ctx, ` + SELECT ig.group_name, t.iqn + FROM scst_initiator_groups ig + JOIN scst_targets t ON ig.target_id = t.id + WHERE ig.id = $1 + `, groupID).Scan(&oldGroupName, &targetIQN) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("initiator group not found") + } + return nil, fmt.Errorf("failed to get initiator group: %w", err) + } + + // Validate new name + if newGroupName == "" { + return nil, fmt.Errorf("group name cannot be empty") + } + + if newGroupName == oldGroupName { + // No change, just return the group + return s.GetInitiatorGroup(ctx, groupID) + } + + // Check if new name already exists for this target + var targetID string + err = s.db.QueryRowContext(ctx, "SELECT target_id FROM scst_initiator_groups WHERE id = $1", groupID).Scan(&targetID) + if err != nil { + return nil, fmt.Errorf("failed to get target_id: %w", err) + } + + var existingID string + err = s.db.QueryRowContext(ctx, + "SELECT id FROM scst_initiator_groups WHERE target_id = $1 AND group_name = $2 AND id != $3", + targetID, newGroupName, groupID, + ).Scan(&existingID) + if err == nil { + return nil, fmt.Errorf("initiator group with name '%s' already exists for this target", newGroupName) + } else if err != sql.ErrNoRows { + return nil, fmt.Errorf("failed to check existing group: %w", err) + } + + // Update in SCST (remove old, add new) + // Note: SCST doesn't support rename directly, so we need to recreate + // First, get all initiators in this group + initiators, err := s.getGroupInitiators(ctx, groupID) + if err != nil { + return nil, fmt.Errorf("failed to get initiators: %w", err) + } + + // Remove old group from SCST + // scstadmin -rem_group requires interactive confirmation, so we pipe "y" to it + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_group", oldGroupName, + "-target", targetIQN, + "-driver", "iscsi", "-noprompt") + output, err := cmd.CombinedOutput() + if err != nil { + outputStr := string(output) + if !strings.Contains(outputStr, "not found") && !strings.Contains(outputStr, "does not exist") { + return nil, fmt.Errorf("failed to remove old group from SCST: %s: %w", outputStr, err) + } + } + + // Create new group in SCST + cmd = exec.CommandContext(ctx, "sudo", "scstadmin", "-add_group", newGroupName, + "-target", targetIQN, + "-driver", "iscsi") + output, err = cmd.CombinedOutput() + if err != nil { + return nil, fmt.Errorf("failed to create new group in SCST: %s: %w", string(output), err) + } + + // Re-add all initiators to the new group + for _, initiator := range initiators { + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_init", initiator.IQN, + "-group", newGroupName, + "-target", targetIQN, + "-driver", "iscsi") + output, err := cmd.CombinedOutput() + if err != nil { + s.logger.Warn("Failed to re-add initiator to renamed group", + "initiator", initiator.IQN, "group", newGroupName, "error", string(output)) + } + } + + // Update in database + _, err = s.db.ExecContext(ctx, + "UPDATE scst_initiator_groups SET group_name = $1 WHERE id = $2", + newGroupName, groupID) + if err != nil { + // Try to restore old group in SCST + exec.CommandContext(ctx, "sudo", "scstadmin", "-add_group", oldGroupName, + "-target", targetIQN, + "-driver", "iscsi").Run() + return nil, fmt.Errorf("failed to update group in database: %w", err) + } + + s.logger.Info("Initiator group updated", "group_id", groupID, "old_name", oldGroupName, "new_name", newGroupName) + return s.GetInitiatorGroup(ctx, groupID) +} + +// DeleteInitiatorGroup deletes an initiator group +func (s *Service) DeleteInitiatorGroup(ctx context.Context, groupID string) error { + // Get group info + var targetIQN, groupName string + var initiatorCount int + err := s.db.QueryRowContext(ctx, ` + SELECT ig.group_name, t.iqn, COUNT(i.id) + FROM scst_initiator_groups ig + JOIN scst_targets t ON ig.target_id = t.id + LEFT JOIN scst_initiators i ON i.group_id = ig.id + WHERE ig.id = $1 + GROUP BY ig.group_name, t.iqn + `, groupID).Scan(&groupName, &targetIQN, &initiatorCount) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("initiator group not found") + } + return fmt.Errorf("failed to get initiator group: %w", err) + } + + // Prevent deletion if group has initiators + if initiatorCount > 0 { + return fmt.Errorf("cannot delete initiator group: group contains %d initiator(s). Please remove all initiators first", initiatorCount) + } + + // Remove from SCST first - this must succeed before deleting from database + // scstadmin -rem_group requires interactive confirmation, so we pipe "y" to it + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-rem_group", groupName, + "-target", targetIQN, + "-driver", "iscsi", "-noprompt") + output, err := cmd.CombinedOutput() + outputStr := string(output) + + // Log the command output for debugging + s.logger.Info("Removing group from SCST", "group", groupName, "target", targetIQN, "output", outputStr) + + if err != nil { + // Check if group doesn't exist in SCST (not an error, but log it) + if strings.Contains(outputStr, "not found") || strings.Contains(outputStr, "does not exist") { + s.logger.Info("Group not found in SCST, continuing with database deletion", "group", groupName, "target", targetIQN) + } else { + // Real error - return error to prevent database deletion + s.logger.Error("Failed to remove group from SCST", "group", groupName, "target", targetIQN, "output", outputStr, "error", err) + return fmt.Errorf("failed to remove group from SCST: %s: %w", outputStr, err) + } + } else { + // Command succeeded - verify by checking output + if strings.Contains(outputStr, "Removing group") || strings.Contains(outputStr, "done") || strings.Contains(outputStr, "All done") { + s.logger.Info("Group removed from SCST successfully", "group", groupName, "target", targetIQN, "output", outputStr) + } else { + // Output doesn't indicate success, but no error - log warning + s.logger.Warn("Group removal command completed but output unclear", "group", groupName, "target", targetIQN, "output", outputStr) + } + } + + // Delete from database (cascade will handle initiators if any) + _, err = s.db.ExecContext(ctx, "DELETE FROM scst_initiator_groups WHERE id = $1", groupID) + if err != nil { + return fmt.Errorf("failed to delete group from database: %w", err) + } + + // Write config to persist changes + configPath := "/etc/calypso/scst/generated.conf" + if err := s.WriteConfig(ctx, configPath); err != nil { + s.logger.Warn("Failed to write config after group deletion", "error", err) + // Don't fail the deletion if config write fails + } + + s.logger.Info("Initiator group deleted", "group_id", groupID, "group_name", groupName, "target", targetIQN) + return nil +} + +// GetInitiatorGroup retrieves a single initiator group by ID +func (s *Service) GetInitiatorGroup(ctx context.Context, groupID string) (*InitiatorGroup, error) { + var group InitiatorGroup + err := s.db.QueryRowContext(ctx, ` + SELECT id, target_id, group_name, created_at + FROM scst_initiator_groups + WHERE id = $1 + `, groupID).Scan(&group.ID, &group.TargetID, &group.GroupName, &group.CreatedAt) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("initiator group not found") + } + return nil, fmt.Errorf("failed to get initiator group: %w", err) + } + + // Get initiators for this group + initiators, err := s.getGroupInitiators(ctx, groupID) + if err != nil { + s.logger.Warn("Failed to get initiators for group", "group_id", groupID, "error", err) + group.Initiators = []Initiator{} + } else { + group.Initiators = initiators + } + + return &group, nil +} + +// ListAllInitiatorGroups lists all initiator groups across all targets +func (s *Service) ListAllInitiatorGroups(ctx context.Context) ([]InitiatorGroup, error) { + query := ` + SELECT id, target_id, group_name, created_at + FROM scst_initiator_groups + ORDER BY target_id, group_name + ` + + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return nil, fmt.Errorf("failed to list initiator groups: %w", err) + } + defer rows.Close() + + var groups []InitiatorGroup + for rows.Next() { + var group InitiatorGroup + err := rows.Scan(&group.ID, &group.TargetID, &group.GroupName, &group.CreatedAt) + if err != nil { + s.logger.Error("Failed to scan initiator group", "error", err) + continue + } + + // Get initiators for this group + initiators, err := s.getGroupInitiators(ctx, group.ID) + if err != nil { + s.logger.Warn("Failed to get initiators for group", "group_id", group.ID, "error", err) + group.Initiators = []Initiator{} + } else { + group.Initiators = initiators + } + + groups = append(groups, group) + } + + return groups, rows.Err() +} + // ListTargets lists all SCST targets func (s *Service) ListTargets(ctx context.Context) ([]Target, error) { query := ` @@ -505,6 +983,8 @@ func (s *Service) ListTargets(ctx context.Context) ([]Target, error) { if description.Valid { target.Description = description.String } + // Set alias to name for frontend compatibility + target.Alias = target.Name targets = append(targets, target) } @@ -558,7 +1038,7 @@ func (s *Service) GetTarget(ctx context.Context, id string) (*Target, error) { // getTargetEnabledStatus reads enabled status from SCST func (s *Service) getTargetEnabledStatus(ctx context.Context, targetIQN string) (bool, error) { // Read SCST config to check if target is enabled - cmd := exec.CommandContext(ctx, "scstadmin", "-write_config", "/tmp/scst_target_check.conf") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-write_config", "/tmp/scst_target_check.conf") output, err := cmd.CombinedOutput() if err != nil { return false, fmt.Errorf("failed to write config: %s: %w", string(output), err) @@ -607,7 +1087,7 @@ func (s *Service) getTargetEnabledStatus(ctx context.Context, targetIQN string) // EnableTarget enables a target in SCST func (s *Service) EnableTarget(ctx context.Context, targetIQN string) error { - cmd := exec.CommandContext(ctx, "scstadmin", "-enable_target", targetIQN, "-driver", "iscsi") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-enable_target", targetIQN, "-driver", "iscsi") output, err := cmd.CombinedOutput() if err != nil { outputStr := string(output) @@ -630,7 +1110,7 @@ func (s *Service) EnableTarget(ctx context.Context, targetIQN string) error { // DisableTarget disables a target in SCST func (s *Service) DisableTarget(ctx context.Context, targetIQN string) error { - cmd := exec.CommandContext(ctx, "scstadmin", "-disable_target", targetIQN, "-driver", "iscsi") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-disable_target", targetIQN, "-driver", "iscsi") output, err := cmd.CombinedOutput() if err != nil { outputStr := string(output) @@ -651,6 +1131,67 @@ func (s *Service) DisableTarget(ctx context.Context, targetIQN string) error { return nil } +// DeleteTarget deletes a target from SCST and database +func (s *Service) DeleteTarget(ctx context.Context, targetID string) error { + // Get target IQN before deletion + var targetIQN string + err := s.db.QueryRowContext(ctx, "SELECT iqn FROM scst_targets WHERE id = $1", targetID).Scan(&targetIQN) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("target not found") + } + return fmt.Errorf("failed to get target: %w", err) + } + + // Check if target has LUNs - warn but allow deletion + var lunCount int + s.db.QueryRowContext(ctx, "SELECT COUNT(*) FROM scst_luns WHERE target_id = $1", targetID).Scan(&lunCount) + if lunCount > 0 { + s.logger.Warn("Deleting target with LUNs", "target", targetIQN, "lun_count", lunCount) + } + + // Check if target has initiators - warn but allow deletion + var initiatorCount int + s.db.QueryRowContext(ctx, ` + SELECT COUNT(*) FROM scst_initiators + WHERE group_id IN (SELECT id FROM scst_initiator_groups WHERE target_id = $1) + `, targetID).Scan(&initiatorCount) + if initiatorCount > 0 { + s.logger.Warn("Deleting target with initiators", "target", targetIQN, "initiator_count", initiatorCount) + } + + // Remove target from SCST first + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-remove_target", targetIQN, "-driver", "iscsi") + output, err := cmd.CombinedOutput() + outputStr := string(output) + + if err != nil { + // Check if target doesn't exist in SCST (not an error) + if strings.Contains(outputStr, "not found") || strings.Contains(outputStr, "does not exist") { + s.logger.Warn("Target not found in SCST, continuing with database deletion", "target", targetIQN) + } else { + // Log error but continue with database deletion + s.logger.Warn("Failed to remove target from SCST", "target", targetIQN, "output", outputStr) + } + } + + // Delete from database (cascade will handle related records) + _, err = s.db.ExecContext(ctx, "DELETE FROM scst_targets WHERE id = $1", targetID) + if err != nil { + return fmt.Errorf("failed to delete target from database: %w", err) + } + + // Write config to persist changes + configPath := "/etc/calypso/scst/generated.conf" + if err := s.WriteConfig(ctx, configPath); err != nil { + s.logger.Warn("Failed to write config after target deletion", "error", err) + // Don't fail the deletion if config write fails + } + + s.logger.Info("Target deleted", "iqn", targetIQN, "id", targetID) + return nil +} + // GetTargetLUNs retrieves all LUNs for a target // It reads from SCST first, then syncs with database func (s *Service) GetTargetLUNs(ctx context.Context, targetID string) ([]LUN, error) { @@ -749,7 +1290,7 @@ func (s *Service) getLUNsFromDatabase(ctx context.Context, targetID string) ([]L // readLUNsFromSCST reads LUNs directly from SCST using scstadmin -list_group func (s *Service) readLUNsFromSCST(ctx context.Context, targetIQN string) ([]LUN, error) { - cmd := exec.CommandContext(ctx, "scstadmin", "-list_group", + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_group", "-target", targetIQN, "-driver", "iscsi") output, err := cmd.CombinedOutput() @@ -770,17 +1311,42 @@ func (s *Service) readLUNsFromSCST(ctx context.Context, targetIQN string) ([]LUN lines := strings.Split(string(output), "\n") var luns []LUN - inLUNSection := false + inTargetLUNSection := false + foundTarget := false for _, line := range lines { line = strings.TrimSpace(line) - // Check if we're in the LUN section - if strings.Contains(line, "Assigned LUNs:") { - inLUNSection = true + // Check if we found our target + if strings.HasPrefix(line, "Target:") { + targetLine := strings.TrimSpace(strings.TrimPrefix(line, "Target:")) + if targetLine == targetIQN { + foundTarget = true + continue + } else { + // Different target, reset + foundTarget = false + inTargetLUNSection = false + continue + } + } + + // Only process if we found our target + if !foundTarget { continue } + // Check if we're in the LUN section for this target + if strings.Contains(line, "Assigned LUNs:") { + inTargetLUNSection = true + continue + } + + // Stop if we hit a Group section (LUNs after this are group-specific) + if strings.HasPrefix(line, "Group:") { + break + } + // Skip separator line if strings.HasPrefix(line, "---") { continue @@ -791,8 +1357,8 @@ func (s *Service) readLUNsFromSCST(ctx context.Context, targetIQN string) ([]LUN continue } - // Parse LUN lines (format: "1 LUN01") - if inLUNSection && line != "" { + // Parse LUN lines (format: "0 pbs-test") + if inTargetLUNSection && line != "" { parts := strings.Fields(line) if len(parts) >= 2 { var lunNumber int @@ -822,7 +1388,7 @@ func (s *Service) readLUNsFromSCST(ctx context.Context, targetIQN string) ([]LUN // we try to get handler type from device list, and device path from database if available func (s *Service) getDeviceInfo(ctx context.Context, deviceName string) (string, string, error) { // Find which handler this device belongs to - listCmd := exec.CommandContext(ctx, "scstadmin", "-list_device") + listCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_device") output, err := listCmd.Output() if err != nil { return "", "", fmt.Errorf("failed to list devices: %w", err) @@ -882,7 +1448,7 @@ func (s *Service) getDeviceInfo(ctx context.Context, deviceName string) (string, // getDevicePathFromConfig reads device path from SCST config file func (s *Service) getDevicePathFromConfig(deviceName, handlerType string) string { // Write current config to temp file - cmd := exec.Command("scstadmin", "-write_config", "/tmp/scst_device_info.conf") + cmd := exec.Command("sudo", "scstadmin", "-write_config", "/tmp/scst_device_info.conf") if err := cmd.Run(); err != nil { s.logger.Warn("Failed to write SCST config", "error", err) return "" @@ -939,7 +1505,7 @@ func (s *Service) getDevicePathFromConfig(deviceName, handlerType string) string // ListExtents lists all device extents (opened devices) in SCST func (s *Service) ListExtents(ctx context.Context) ([]Extent, error) { // List all devices from SCST - cmd := exec.CommandContext(ctx, "scstadmin", "-list_device") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_device") output, err := cmd.Output() if err != nil { return nil, fmt.Errorf("failed to list devices: %w", err) @@ -1041,7 +1607,7 @@ func (s *Service) CreateExtent(ctx context.Context, deviceName, devicePath, hand } // Open device in SCST - openCmd := exec.CommandContext(ctx, "scstadmin", "-open_dev", deviceName, + openCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-open_dev", deviceName, "-handler", handlerType, "-attributes", fmt.Sprintf("filename=%s", devicePath)) output, err := openCmd.CombinedOutput() @@ -1057,6 +1623,70 @@ func (s *Service) CreateExtent(ctx context.Context, deviceName, devicePath, hand return nil } +// getDeviceHandlerType gets the handler type for a device by querying SCST +func (s *Service) getDeviceHandlerType(ctx context.Context, deviceName string) (string, error) { + // First, try to get from database if device was used by a LUN + var handlerType string + err := s.db.QueryRowContext(ctx, + "SELECT handler_type FROM scst_luns WHERE device_name = $1 LIMIT 1", + deviceName, + ).Scan(&handlerType) + if err == nil && handlerType != "" { + return handlerType, nil + } + + // If not in database, query from SCST + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_device") + output, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("failed to list devices: %w", err) + } + + // Parse output to find handler type for this device + lines := strings.Split(string(output), "\n") + inHandlerSection := false + for _, line := range lines { + line = strings.TrimSpace(line) + + // Check if we're in a handler section + if strings.HasPrefix(line, "HANDLER") { + inHandlerSection = true + continue + } + + // Skip separator + if strings.HasPrefix(line, "---") { + continue + } + + // Skip header/footer lines + if strings.Contains(line, "Collecting") || strings.Contains(line, "All done") { + continue + } + + // Parse handler and device lines + if inHandlerSection && line != "" { + parts := strings.Fields(line) + if len(parts) >= 2 { + parsedHandlerType := parts[0] + parsedDeviceName := parts[1] + + // Skip if device is "-" (no device opened for this handler) + if parsedDeviceName == "-" { + continue + } + + // Found the device, return its handler type + if parsedDeviceName == deviceName { + return parsedHandlerType, nil + } + } + } + } + + return "", fmt.Errorf("device %s not found in SCST", deviceName) +} + // DeleteExtent closes a device in SCST (removes an extent) func (s *Service) DeleteExtent(ctx context.Context, deviceName string) error { // Check if device is in use by any LUN @@ -1069,18 +1699,102 @@ func (s *Service) DeleteExtent(ctx context.Context, deviceName string) error { return fmt.Errorf("device %s is in use by %d LUN(s). Remove LUNs first", deviceName, lunCount) } - // Close device in SCST - closeCmd := exec.CommandContext(ctx, "scstadmin", "-close_dev", deviceName) - output, err := closeCmd.CombinedOutput() + // Get handler type for this device + handlerType, err := s.getDeviceHandlerType(ctx, deviceName) if err != nil { - outputStr := string(output) - if strings.Contains(outputStr, "not found") { - return fmt.Errorf("device %s not found", deviceName) + // If device not found, check if it's already closed + if strings.Contains(err.Error(), "not found") { + s.logger.Info("Device not found in SCST, may already be closed", "device", deviceName) + return nil // Idempotent - device already closed + } + return fmt.Errorf("failed to get handler type: %w", err) + } + + // Close device in SCST with handler type + // Command format: scstadmin -close_dev -handler + closeCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-close_dev", deviceName, + "-handler", handlerType) + output, err := closeCmd.CombinedOutput() + outputStr := string(output) + + // Log the command output for debugging + s.logger.Info("Closing device in SCST", "device", deviceName, "handler", handlerType, "command", fmt.Sprintf("scstadmin -close_dev %s -handler %s", deviceName, handlerType), "output", outputStr) + + if err != nil { + // Check if device doesn't exist in SCST (not an error, but log it) + if strings.Contains(outputStr, "not found") || strings.Contains(outputStr, "does not exist") { + s.logger.Info("Device not found in SCST, may already be closed", "device", deviceName) + return nil // Idempotent - device already closed } return fmt.Errorf("failed to close device: %s: %w", outputStr, err) } - s.logger.Info("Extent deleted", "device", deviceName) + // Always verify device is actually closed by checking if it still exists + // This ensures the command really succeeded even if output is unclear + verifyCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_device") + verifyOutput, verifyErr := verifyCmd.CombinedOutput() + if verifyErr == nil { + verifyOutputStr := string(verifyOutput) + // Parse output to check if device still exists + lines := strings.Split(verifyOutputStr, "\n") + inHandlerSection := false + deviceStillExists := false + + for _, line := range lines { + line = strings.TrimSpace(line) + + // Check if we're in a handler section + if strings.HasPrefix(line, "HANDLER") { + inHandlerSection = true + continue + } + + // Skip separator + if strings.HasPrefix(line, "---") { + continue + } + + // Skip header/footer lines + if strings.Contains(line, "Collecting") || strings.Contains(line, "All done") { + continue + } + + // Parse handler and device lines + if inHandlerSection && line != "" { + parts := strings.Fields(line) + if len(parts) >= 2 { + parsedDeviceName := parts[1] + // Skip if device is "-" (no device opened for this handler) + if parsedDeviceName == "-" { + continue + } + // Check if this is the device we're trying to close + if parsedDeviceName == deviceName { + deviceStillExists = true + break + } + } + } + } + + if deviceStillExists { + // Device still exists - command failed + return fmt.Errorf("device %s still exists after close command. Command output: %s", deviceName, outputStr) + } + s.logger.Info("Device verified as closed", "device", deviceName) + } else { + // If verification fails, log warning but don't fail (command may have succeeded) + s.logger.Warn("Failed to verify device closure", "device", deviceName, "error", verifyErr) + } + + // Write config to persist changes + configPath := "/etc/calypso/scst/generated.conf" + if err := s.WriteConfig(ctx, configPath); err != nil { + s.logger.Warn("Failed to write config after extent deletion", "error", err) + // Don't fail the deletion if config write fails + } + + s.logger.Info("Extent deleted successfully", "device", deviceName, "handler", handlerType) return nil } @@ -1106,7 +1820,7 @@ func (s *Service) getDeviceTypeLabel(handlerType string) string { // WriteConfig writes SCST configuration to file func (s *Service) WriteConfig(ctx context.Context, configPath string) error { - cmd := exec.CommandContext(ctx, "scstadmin", "-write_config", configPath) + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-write_config", configPath) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("failed to write SCST config: %s: %w", string(output), err) @@ -1116,6 +1830,59 @@ func (s *Service) WriteConfig(ctx context.Context, configPath string) error { return nil } +// ReadConfigFile reads the SCST configuration file content +func (s *Service) ReadConfigFile(ctx context.Context, configPath string) (string, error) { + // First, write current config to temp file to get the actual config + tempPath := "/tmp/scst_config_read.conf" + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-write_config", tempPath) + output, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("failed to write SCST config: %s: %w", string(output), err) + } + + // Read the config file + configData, err := os.ReadFile(tempPath) + if err != nil { + return "", fmt.Errorf("failed to read config file: %w", err) + } + + return string(configData), nil +} + +// WriteConfigFile writes content to SCST configuration file +func (s *Service) WriteConfigFile(ctx context.Context, configPath string, content string) error { + // Write content to temp file first + tempPath := "/tmp/scst_config_write.conf" + if err := os.WriteFile(tempPath, []byte(content), 0644); err != nil { + return fmt.Errorf("failed to write temp config file: %w", err) + } + + // Use scstadmin to load the config (this validates and applies it) + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-config", tempPath) + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to load SCST config: %s: %w", string(output), err) + } + + // Write to the actual config path using sudo + if configPath != tempPath { + // Use sudo cp to copy temp file to actual config path + cpCmd := exec.CommandContext(ctx, "sudo", "cp", tempPath, configPath) + cpOutput, cpErr := cpCmd.CombinedOutput() + if cpErr != nil { + return fmt.Errorf("failed to copy config file: %s: %w", string(cpOutput), cpErr) + } + // Set proper permissions + chmodCmd := exec.CommandContext(ctx, "sudo", "chmod", "644", configPath) + if chmodErr := chmodCmd.Run(); chmodErr != nil { + s.logger.Warn("Failed to set config file permissions", "error", chmodErr) + } + } + + s.logger.Info("SCST configuration file written", "path", configPath) + return nil +} + // HandlerInfo represents SCST handler information type HandlerInfo struct { Name string `json:"name"` @@ -1125,7 +1892,7 @@ type HandlerInfo struct { // DetectHandlers detects available SCST handlers func (s *Service) DetectHandlers(ctx context.Context) ([]HandlerInfo, error) { - cmd := exec.CommandContext(ctx, "scstadmin", "-list_handler") + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-list_handler") output, err := cmd.Output() if err != nil { return nil, fmt.Errorf("failed to list handlers: %w", err) @@ -1284,6 +2051,15 @@ func (s *Service) CreatePortal(ctx context.Context, portal *Portal) error { } s.logger.Info("Portal created", "ip", portal.IPAddress, "port", portal.Port) + + // Apply portal to all existing targets if active + if portal.IsActive { + if err := s.applyPortalToAllTargets(ctx, portal.IPAddress, portal.Port); err != nil { + s.logger.Warn("Failed to apply portal to targets", "ip", portal.IPAddress, "port", portal.Port, "error", err) + // Don't fail portal creation if application fails + } + } + return nil } @@ -1294,6 +2070,19 @@ func (s *Service) UpdatePortal(ctx context.Context, id string, portal *Portal) e return fmt.Errorf("port must be between 1 and 65535") } + // Get old portal data before update + var oldIPAddress string + var oldPort int + var oldIsActive bool + err := s.db.QueryRowContext(ctx, "SELECT ip_address, port, is_active FROM scst_portals WHERE id = $1", id).Scan(&oldIPAddress, &oldPort, &oldIsActive) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("portal not found") + } + return fmt.Errorf("failed to get portal info: %w", err) + } + + // Update in database query := ` UPDATE scst_portals SET ip_address = $1, port = $2, is_active = $3, updated_at = NOW() @@ -1301,22 +2090,61 @@ func (s *Service) UpdatePortal(ctx context.Context, id string, portal *Portal) e RETURNING updated_at ` - err := s.db.QueryRowContext(ctx, query, + err = s.db.QueryRowContext(ctx, query, portal.IPAddress, portal.Port, portal.IsActive, id, ).Scan(&portal.UpdatedAt) if err != nil { - if err == sql.ErrNoRows { - return fmt.Errorf("portal not found") - } return fmt.Errorf("failed to update portal: %w", err) } s.logger.Info("Portal updated", "id", id, "ip", portal.IPAddress, "port", portal.Port) + + // Handle SCST updates + if portal.IsActive { + // Portal is active - apply to all targets + // Remove old portal if IP or port changed + if oldIPAddress != portal.IPAddress || oldPort != portal.Port { + if err := s.removePortalFromAllTargets(ctx, oldIPAddress, oldPort); err != nil { + s.logger.Warn("Failed to remove old portal from targets", "ip", oldIPAddress, "port", oldPort, "error", err) + } + } + // Apply new portal to all targets + if err := s.applyPortalToAllTargets(ctx, portal.IPAddress, portal.Port); err != nil { + s.logger.Warn("Failed to apply portal to targets", "ip", portal.IPAddress, "port", portal.Port, "error", err) + } + } else { + // Portal is inactive - remove from all targets + // Only remove if it was previously active + if oldIsActive { + if err := s.removePortalFromAllTargets(ctx, oldIPAddress, oldPort); err != nil { + s.logger.Warn("Failed to remove portal from targets", "ip", oldIPAddress, "port", oldPort, "error", err) + } + } + } + return nil } // DeletePortal deletes a portal func (s *Service) DeletePortal(ctx context.Context, id string) error { + // Get portal info before deletion to remove from SCST + var ipAddress string + var port int + err := s.db.QueryRowContext(ctx, "SELECT ip_address, port FROM scst_portals WHERE id = $1", id).Scan(&ipAddress, &port) + if err != nil { + if err == sql.ErrNoRows { + return fmt.Errorf("portal not found") + } + return fmt.Errorf("failed to get portal info: %w", err) + } + + // Remove portal from all targets before deleting from database + if err := s.removePortalFromAllTargets(ctx, ipAddress, port); err != nil { + s.logger.Warn("Failed to remove portal from targets", "ip", ipAddress, "port", port, "error", err) + // Continue with deletion even if removal fails + } + + // Delete from database result, err := s.db.ExecContext(ctx, "DELETE FROM scst_portals WHERE id = $1", id) if err != nil { return fmt.Errorf("failed to delete portal: %w", err) @@ -1357,3 +2185,183 @@ func (s *Service) GetPortal(ctx context.Context, id string) (*Portal, error) { return &portal, nil } + +// applyPortalsToTarget applies all active portals to a specific target +func (s *Service) applyPortalsToTarget(ctx context.Context, targetIQN string) error { + // Get all active portals + query := ` + SELECT ip_address, port + FROM scst_portals + WHERE is_active = true + ORDER BY ip_address, port + ` + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return fmt.Errorf("failed to query portals: %w", err) + } + defer rows.Close() + + var portals []struct { + IPAddress string + Port int + } + for rows.Next() { + var portal struct { + IPAddress string + Port int + } + if err := rows.Scan(&portal.IPAddress, &portal.Port); err != nil { + s.logger.Warn("Failed to scan portal", "error", err) + continue + } + portals = append(portals, portal) + } + + // Apply each portal to the target + for _, portal := range portals { + if err := s.addPortalToTarget(ctx, targetIQN, portal.IPAddress, portal.Port); err != nil { + s.logger.Warn("Failed to add portal to target", "target", targetIQN, "ip", portal.IPAddress, "port", portal.Port, "error", err) + // Continue with other portals even if one fails + } + } + + return nil +} + +// applyPortalToAllTargets applies a portal to all existing targets +func (s *Service) applyPortalToAllTargets(ctx context.Context, ipAddress string, port int) error { + // Ensure the iSCSI target driver is enabled + enableCmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-set_drv_attr", "iscsi", "-attributes", "enabled=1") + if output, err := enableCmd.CombinedOutput(); err != nil { + s.logger.Warn("Could not enable iscsi target driver", "error", string(output)) + // Don't fail here, as it might already be enabled or another issue might be present. + } + + // Get all iSCSI targets + query := ` + SELECT iqn + FROM scst_targets + WHERE target_type IN ('disk', 'vtl', 'physical_tape') + ORDER BY iqn + ` + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return fmt.Errorf("failed to query targets: %w", err) + } + defer rows.Close() + + var targets []string + for rows.Next() { + var iqn string + if err := rows.Scan(&iqn); err != nil { + s.logger.Warn("Failed to scan target", "error", err) + continue + } + targets = append(targets, iqn) + } + + // Apply portal to each target + for _, targetIQN := range targets { + if err := s.addPortalToTarget(ctx, targetIQN, ipAddress, port); err != nil { + s.logger.Warn("Failed to add portal to target", "target", targetIQN, "ip", ipAddress, "port", port, "error", err) + // Continue with other targets even if one fails + } + } + + return nil +} + +// removePortalFromAllTargets removes a portal from all existing targets +func (s *Service) removePortalFromAllTargets(ctx context.Context, ipAddress string, port int) error { + // Get all iSCSI targets + query := ` + SELECT iqn + FROM scst_targets + WHERE target_type IN ('disk', 'vtl', 'physical_tape') + ORDER BY iqn + ` + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return fmt.Errorf("failed to query targets: %w", err) + } + defer rows.Close() + + var targets []string + for rows.Next() { + var iqn string + if err := rows.Scan(&iqn); err != nil { + s.logger.Warn("Failed to scan target", "error", err) + continue + } + targets = append(targets, iqn) + } + + // Remove portal from each target + for _, targetIQN := range targets { + if err := s.removePortalFromTarget(ctx, targetIQN, ipAddress, port); err != nil { + s.logger.Warn("Failed to remove portal from target", "target", targetIQN, "ip", ipAddress, "port", port, "error", err) + // Continue with other targets even if one fails + } + } + + return nil +} + +// addPortalToTarget adds a portal to a specific target in SCST +func (s *Service) addPortalToTarget(ctx context.Context, targetIQN, ipAddress string, port int) error { + // Format: IP:PORT + portalAddr := fmt.Sprintf("%s:%d", ipAddress, port) + + // Use scstadmin to add portal to target + // Note: SCST uses different syntax depending on version + // Try the standard syntax first: -add_portal -target -driver iscsi + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-add_portal", portalAddr, + "-target", targetIQN, + "-driver", "iscsi") + output, err := cmd.CombinedOutput() + outputStr := string(output) + + if err != nil { + // Check if portal already exists (not an error) + if strings.Contains(outputStr, "already exists") || strings.Contains(outputStr, "already added") { + s.logger.Debug("Portal already exists on target", "target", targetIQN, "portal", portalAddr) + return nil + } + + // Some SCST versions use different syntax or portal might be configured differently + // Log warning but don't fail - portal configuration might be handled by iscsi-scstd + s.logger.Warn("Failed to add portal to target (may be handled by iscsi-scstd)", "target", targetIQN, "portal", portalAddr, "output", outputStr) + return fmt.Errorf("failed to add portal: %s: %w", outputStr, err) + } + + s.logger.Info("Portal added to target", "target", targetIQN, "portal", portalAddr) + return nil +} + +// removePortalFromTarget removes a portal from a specific target in SCST +func (s *Service) removePortalFromTarget(ctx context.Context, targetIQN, ipAddress string, port int) error { + // Format: IP:PORT + portalAddr := fmt.Sprintf("%s:%d", ipAddress, port) + + // Use scstadmin to remove portal from target + cmd := exec.CommandContext(ctx, "sudo", "scstadmin", "-remove_portal", portalAddr, + "-target", targetIQN, + "-driver", "iscsi") + output, err := cmd.CombinedOutput() + outputStr := string(output) + + if err != nil { + // Check if portal doesn't exist (not an error) + if strings.Contains(outputStr, "not found") || strings.Contains(outputStr, "does not exist") { + s.logger.Debug("Portal not found on target", "target", targetIQN, "portal", portalAddr) + return nil + } + + // Log warning but don't fail + s.logger.Warn("Failed to remove portal from target", "target", targetIQN, "portal", portalAddr, "output", outputStr) + return fmt.Errorf("failed to remove portal: %s: %w", outputStr, err) + } + + s.logger.Info("Portal removed from target", "target", targetIQN, "portal", portalAddr) + return nil +} diff --git a/backend/internal/shares/handler.go b/backend/internal/shares/handler.go new file mode 100644 index 0000000..4667b40 --- /dev/null +++ b/backend/internal/shares/handler.go @@ -0,0 +1,147 @@ +package shares + +import ( + "net/http" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/gin-gonic/gin" + "github.com/go-playground/validator/v10" +) + +// Handler handles Shares-related API requests +type Handler struct { + service *Service + logger *logger.Logger +} + +// NewHandler creates a new Shares handler +func NewHandler(db *database.DB, log *logger.Logger) *Handler { + return &Handler{ + service: NewService(db, log), + logger: log, + } +} + +// ListShares lists all shares +func (h *Handler) ListShares(c *gin.Context) { + shares, err := h.service.ListShares(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list shares", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list shares"}) + return + } + + // Ensure we return an empty array instead of null + if shares == nil { + shares = []*Share{} + } + + c.JSON(http.StatusOK, gin.H{"shares": shares}) +} + +// GetShare retrieves a share by ID +func (h *Handler) GetShare(c *gin.Context) { + shareID := c.Param("id") + + share, err := h.service.GetShare(c.Request.Context(), shareID) + if err != nil { + if err.Error() == "share not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "share not found"}) + return + } + h.logger.Error("Failed to get share", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get share"}) + return + } + + c.JSON(http.StatusOK, share) +} + +// CreateShare creates a new share +func (h *Handler) CreateShare(c *gin.Context) { + var req CreateShareRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create share request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + // Validate request + validate := validator.New() + if err := validate.Struct(req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "validation failed: " + err.Error()}) + return + } + + // Get user ID from context (set by auth middleware) + userID, exists := c.Get("user_id") + if !exists { + c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"}) + return + } + + share, err := h.service.CreateShare(c.Request.Context(), &req, userID.(string)) + if err != nil { + if err.Error() == "dataset not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "dataset not found"}) + return + } + if err.Error() == "only filesystem datasets can be shared (not volumes)" { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + if err.Error() == "at least one protocol (NFS or SMB) must be enabled" { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + h.logger.Error("Failed to create share", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusCreated, share) +} + +// UpdateShare updates an existing share +func (h *Handler) UpdateShare(c *gin.Context) { + shareID := c.Param("id") + + var req UpdateShareRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid update share request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + share, err := h.service.UpdateShare(c.Request.Context(), shareID, &req) + if err != nil { + if err.Error() == "share not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "share not found"}) + return + } + h.logger.Error("Failed to update share", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, share) +} + +// DeleteShare deletes a share +func (h *Handler) DeleteShare(c *gin.Context) { + shareID := c.Param("id") + + err := h.service.DeleteShare(c.Request.Context(), shareID) + if err != nil { + if err.Error() == "share not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "share not found"}) + return + } + h.logger.Error("Failed to delete share", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "share deleted successfully"}) +} diff --git a/backend/internal/shares/service.go b/backend/internal/shares/service.go new file mode 100644 index 0000000..78432cd --- /dev/null +++ b/backend/internal/shares/service.go @@ -0,0 +1,834 @@ +package shares + +import ( + "context" + "database/sql" + "fmt" + "os" + "os/exec" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/lib/pq" +) + +// Service handles Shares (CIFS/NFS) operations +type Service struct { + db *database.DB + logger *logger.Logger +} + +// NewService creates a new Shares service +func NewService(db *database.DB, log *logger.Logger) *Service { + return &Service{ + db: db, + logger: log, + } +} + +// Share represents a filesystem share (NFS/SMB) +type Share struct { + ID string `json:"id"` + DatasetID string `json:"dataset_id"` + DatasetName string `json:"dataset_name"` + MountPoint string `json:"mount_point"` + ShareType string `json:"share_type"` // 'nfs', 'smb', 'both' + NFSEnabled bool `json:"nfs_enabled"` + NFSOptions string `json:"nfs_options,omitempty"` + NFSClients []string `json:"nfs_clients,omitempty"` + SMBEnabled bool `json:"smb_enabled"` + SMBShareName string `json:"smb_share_name,omitempty"` + SMBPath string `json:"smb_path,omitempty"` + SMBComment string `json:"smb_comment,omitempty"` + SMBGuestOK bool `json:"smb_guest_ok"` + SMBReadOnly bool `json:"smb_read_only"` + SMBBrowseable bool `json:"smb_browseable"` + IsActive bool `json:"is_active"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + CreatedBy string `json:"created_by"` +} + +// ListShares lists all shares +func (s *Service) ListShares(ctx context.Context) ([]*Share, error) { + query := ` + SELECT + zs.id, zs.dataset_id, zd.name as dataset_name, zd.mount_point, + zs.share_type, zs.nfs_enabled, zs.nfs_options, zs.nfs_clients, + zs.smb_enabled, zs.smb_share_name, zs.smb_path, zs.smb_comment, + zs.smb_guest_ok, zs.smb_read_only, zs.smb_browseable, + zs.is_active, zs.created_at, zs.updated_at, zs.created_by + FROM zfs_shares zs + JOIN zfs_datasets zd ON zs.dataset_id = zd.id + ORDER BY zd.name + ` + + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + if strings.Contains(err.Error(), "does not exist") { + s.logger.Warn("zfs_shares table does not exist, returning empty list") + return []*Share{}, nil + } + return nil, fmt.Errorf("failed to list shares: %w", err) + } + defer rows.Close() + + var shares []*Share + for rows.Next() { + var share Share + var mountPoint sql.NullString + var nfsOptions sql.NullString + var smbShareName sql.NullString + var smbPath sql.NullString + var smbComment sql.NullString + var nfsClients []string + + err := rows.Scan( + &share.ID, &share.DatasetID, &share.DatasetName, &mountPoint, + &share.ShareType, &share.NFSEnabled, &nfsOptions, pq.Array(&nfsClients), + &share.SMBEnabled, &smbShareName, &smbPath, &smbComment, + &share.SMBGuestOK, &share.SMBReadOnly, &share.SMBBrowseable, + &share.IsActive, &share.CreatedAt, &share.UpdatedAt, &share.CreatedBy, + ) + + if err != nil { + s.logger.Error("Failed to scan share row", "error", err) + continue + } + + share.NFSClients = nfsClients + + if mountPoint.Valid { + share.MountPoint = mountPoint.String + } + if nfsOptions.Valid { + share.NFSOptions = nfsOptions.String + } + if smbShareName.Valid { + share.SMBShareName = smbShareName.String + } + if smbPath.Valid { + share.SMBPath = smbPath.String + } + if smbComment.Valid { + share.SMBComment = smbComment.String + } + + shares = append(shares, &share) + } + + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("error iterating share rows: %w", err) + } + + return shares, nil +} + +// GetShare retrieves a share by ID +func (s *Service) GetShare(ctx context.Context, shareID string) (*Share, error) { + query := ` + SELECT + zs.id, zs.dataset_id, zd.name as dataset_name, zd.mount_point, + zs.share_type, zs.nfs_enabled, zs.nfs_options, zs.nfs_clients, + zs.smb_enabled, zs.smb_share_name, zs.smb_path, zs.smb_comment, + zs.smb_guest_ok, zs.smb_read_only, zs.smb_browseable, + zs.is_active, zs.created_at, zs.updated_at, zs.created_by + FROM zfs_shares zs + JOIN zfs_datasets zd ON zs.dataset_id = zd.id + WHERE zs.id = $1 + ` + + var share Share + var mountPoint sql.NullString + var nfsOptions sql.NullString + var smbShareName sql.NullString + var smbPath sql.NullString + var smbComment sql.NullString + var nfsClients []string + + err := s.db.QueryRowContext(ctx, query, shareID).Scan( + &share.ID, &share.DatasetID, &share.DatasetName, &mountPoint, + &share.ShareType, &share.NFSEnabled, &nfsOptions, pq.Array(&nfsClients), + &share.SMBEnabled, &smbShareName, &smbPath, &smbComment, + &share.SMBGuestOK, &share.SMBReadOnly, &share.SMBBrowseable, + &share.IsActive, &share.CreatedAt, &share.UpdatedAt, &share.CreatedBy, + ) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("share not found") + } + return nil, fmt.Errorf("failed to get share: %w", err) + } + + share.NFSClients = nfsClients + + if mountPoint.Valid { + share.MountPoint = mountPoint.String + } + if nfsOptions.Valid { + share.NFSOptions = nfsOptions.String + } + if smbShareName.Valid { + share.SMBShareName = smbShareName.String + } + if smbPath.Valid { + share.SMBPath = smbPath.String + } + if smbComment.Valid { + share.SMBComment = smbComment.String + } + + return &share, nil +} + +// CreateShareRequest represents a share creation request +type CreateShareRequest struct { + DatasetID string `json:"dataset_id" binding:"required"` + NFSEnabled bool `json:"nfs_enabled"` + NFSOptions string `json:"nfs_options"` + NFSClients []string `json:"nfs_clients"` + SMBEnabled bool `json:"smb_enabled"` + SMBShareName string `json:"smb_share_name"` + SMBPath string `json:"smb_path"` + SMBComment string `json:"smb_comment"` + SMBGuestOK bool `json:"smb_guest_ok"` + SMBReadOnly bool `json:"smb_read_only"` + SMBBrowseable bool `json:"smb_browseable"` +} + +// CreateShare creates a new share +func (s *Service) CreateShare(ctx context.Context, req *CreateShareRequest, userID string) (*Share, error) { + // Validate dataset exists and is a filesystem (not volume) + // req.DatasetID can be either UUID or dataset name + var datasetID, datasetType, datasetName, mountPoint string + var mountPointNull sql.NullString + + // Try to find by ID first (UUID) + err := s.db.QueryRowContext(ctx, + "SELECT id, type, name, mount_point FROM zfs_datasets WHERE id = $1", + req.DatasetID, + ).Scan(&datasetID, &datasetType, &datasetName, &mountPointNull) + + // If not found by ID, try by name + if err == sql.ErrNoRows { + err = s.db.QueryRowContext(ctx, + "SELECT id, type, name, mount_point FROM zfs_datasets WHERE name = $1", + req.DatasetID, + ).Scan(&datasetID, &datasetType, &datasetName, &mountPointNull) + } + + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("dataset not found") + } + return nil, fmt.Errorf("failed to validate dataset: %w", err) + } + + if mountPointNull.Valid { + mountPoint = mountPointNull.String + } else { + mountPoint = "none" + } + + if datasetType != "filesystem" { + return nil, fmt.Errorf("only filesystem datasets can be shared (not volumes)") + } + + // Determine share type + shareType := "none" + if req.NFSEnabled && req.SMBEnabled { + shareType = "both" + } else if req.NFSEnabled { + shareType = "nfs" + } else if req.SMBEnabled { + shareType = "smb" + } else { + return nil, fmt.Errorf("at least one protocol (NFS or SMB) must be enabled") + } + + // Set default NFS options if not provided + nfsOptions := req.NFSOptions + if nfsOptions == "" { + nfsOptions = "rw,sync,no_subtree_check" + } + + // Set default SMB share name if not provided + smbShareName := req.SMBShareName + if smbShareName == "" { + // Extract dataset name from full path (e.g., "pool/dataset" -> "dataset") + parts := strings.Split(datasetName, "/") + smbShareName = parts[len(parts)-1] + } + + // Set SMB path (use mount_point if available, otherwise use dataset name) + smbPath := req.SMBPath + if smbPath == "" { + if mountPoint != "" && mountPoint != "none" { + smbPath = mountPoint + } else { + smbPath = fmt.Sprintf("/mnt/%s", strings.ReplaceAll(datasetName, "/", "_")) + } + } + + // Insert into database + query := ` + INSERT INTO zfs_shares ( + dataset_id, share_type, nfs_enabled, nfs_options, nfs_clients, + smb_enabled, smb_share_name, smb_path, smb_comment, + smb_guest_ok, smb_read_only, smb_browseable, is_active, created_by + ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) + RETURNING id, created_at, updated_at + ` + + var shareID string + var createdAt, updatedAt time.Time + + // Handle nfs_clients array - use empty array if nil + nfsClients := req.NFSClients + if nfsClients == nil { + nfsClients = []string{} + } + + err = s.db.QueryRowContext(ctx, query, + datasetID, shareType, req.NFSEnabled, nfsOptions, pq.Array(nfsClients), + req.SMBEnabled, smbShareName, smbPath, req.SMBComment, + req.SMBGuestOK, req.SMBReadOnly, req.SMBBrowseable, true, userID, + ).Scan(&shareID, &createdAt, &updatedAt) + if err != nil { + return nil, fmt.Errorf("failed to create share: %w", err) + } + + // Apply NFS export if enabled + if req.NFSEnabled { + if err := s.applyNFSExport(ctx, mountPoint, nfsOptions, req.NFSClients); err != nil { + s.logger.Error("Failed to apply NFS export", "error", err, "share_id", shareID) + // Don't fail the creation, but log the error + } + } + + // Apply SMB share if enabled + if req.SMBEnabled { + if err := s.applySMBShare(ctx, smbShareName, smbPath, req.SMBComment, req.SMBGuestOK, req.SMBReadOnly, req.SMBBrowseable); err != nil { + s.logger.Error("Failed to apply SMB share", "error", err, "share_id", shareID) + // Don't fail the creation, but log the error + } + } + + // Return the created share + return s.GetShare(ctx, shareID) +} + +// UpdateShareRequest represents a share update request +type UpdateShareRequest struct { + NFSEnabled *bool `json:"nfs_enabled"` + NFSOptions *string `json:"nfs_options"` + NFSClients *[]string `json:"nfs_clients"` + SMBEnabled *bool `json:"smb_enabled"` + SMBShareName *string `json:"smb_share_name"` + SMBComment *string `json:"smb_comment"` + SMBGuestOK *bool `json:"smb_guest_ok"` + SMBReadOnly *bool `json:"smb_read_only"` + SMBBrowseable *bool `json:"smb_browseable"` + IsActive *bool `json:"is_active"` +} + +// UpdateShare updates an existing share +func (s *Service) UpdateShare(ctx context.Context, shareID string, req *UpdateShareRequest) (*Share, error) { + // Get current share + share, err := s.GetShare(ctx, shareID) + if err != nil { + return nil, err + } + + // Build update query dynamically + updates := []string{} + args := []interface{}{} + argIndex := 1 + + if req.NFSEnabled != nil { + updates = append(updates, fmt.Sprintf("nfs_enabled = $%d", argIndex)) + args = append(args, *req.NFSEnabled) + argIndex++ + } + if req.NFSOptions != nil { + updates = append(updates, fmt.Sprintf("nfs_options = $%d", argIndex)) + args = append(args, *req.NFSOptions) + argIndex++ + } + if req.NFSClients != nil { + updates = append(updates, fmt.Sprintf("nfs_clients = $%d", argIndex)) + args = append(args, pq.Array(*req.NFSClients)) + argIndex++ + } + if req.SMBEnabled != nil { + updates = append(updates, fmt.Sprintf("smb_enabled = $%d", argIndex)) + args = append(args, *req.SMBEnabled) + argIndex++ + } + if req.SMBShareName != nil { + updates = append(updates, fmt.Sprintf("smb_share_name = $%d", argIndex)) + args = append(args, *req.SMBShareName) + argIndex++ + } + if req.SMBComment != nil { + updates = append(updates, fmt.Sprintf("smb_comment = $%d", argIndex)) + args = append(args, *req.SMBComment) + argIndex++ + } + if req.SMBGuestOK != nil { + updates = append(updates, fmt.Sprintf("smb_guest_ok = $%d", argIndex)) + args = append(args, *req.SMBGuestOK) + argIndex++ + } + if req.SMBReadOnly != nil { + updates = append(updates, fmt.Sprintf("smb_read_only = $%d", argIndex)) + args = append(args, *req.SMBReadOnly) + argIndex++ + } + if req.SMBBrowseable != nil { + updates = append(updates, fmt.Sprintf("smb_browseable = $%d", argIndex)) + args = append(args, *req.SMBBrowseable) + argIndex++ + } + if req.IsActive != nil { + updates = append(updates, fmt.Sprintf("is_active = $%d", argIndex)) + args = append(args, *req.IsActive) + argIndex++ + } + + if len(updates) == 0 { + return share, nil // No changes + } + + // Update share_type based on enabled protocols + nfsEnabled := share.NFSEnabled + smbEnabled := share.SMBEnabled + if req.NFSEnabled != nil { + nfsEnabled = *req.NFSEnabled + } + if req.SMBEnabled != nil { + smbEnabled = *req.SMBEnabled + } + + shareType := "none" + if nfsEnabled && smbEnabled { + shareType = "both" + } else if nfsEnabled { + shareType = "nfs" + } else if smbEnabled { + shareType = "smb" + } + + updates = append(updates, fmt.Sprintf("share_type = $%d", argIndex)) + args = append(args, shareType) + argIndex++ + + updates = append(updates, fmt.Sprintf("updated_at = NOW()")) + args = append(args, shareID) + + query := fmt.Sprintf(` + UPDATE zfs_shares + SET %s + WHERE id = $%d + `, strings.Join(updates, ", "), argIndex) + + _, err = s.db.ExecContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("failed to update share: %w", err) + } + + // Re-apply NFS export if NFS is enabled + if nfsEnabled { + nfsOptions := share.NFSOptions + if req.NFSOptions != nil { + nfsOptions = *req.NFSOptions + } + nfsClients := share.NFSClients + if req.NFSClients != nil { + nfsClients = *req.NFSClients + } + if err := s.applyNFSExport(ctx, share.MountPoint, nfsOptions, nfsClients); err != nil { + s.logger.Error("Failed to apply NFS export", "error", err, "share_id", shareID) + } + } else { + // Remove NFS export if disabled + if err := s.removeNFSExport(ctx, share.MountPoint); err != nil { + s.logger.Error("Failed to remove NFS export", "error", err, "share_id", shareID) + } + } + + // Re-apply SMB share if SMB is enabled + if smbEnabled { + smbShareName := share.SMBShareName + if req.SMBShareName != nil { + smbShareName = *req.SMBShareName + } + smbPath := share.SMBPath + smbComment := share.SMBComment + if req.SMBComment != nil { + smbComment = *req.SMBComment + } + smbGuestOK := share.SMBGuestOK + if req.SMBGuestOK != nil { + smbGuestOK = *req.SMBGuestOK + } + smbReadOnly := share.SMBReadOnly + if req.SMBReadOnly != nil { + smbReadOnly = *req.SMBReadOnly + } + smbBrowseable := share.SMBBrowseable + if req.SMBBrowseable != nil { + smbBrowseable = *req.SMBBrowseable + } + if err := s.applySMBShare(ctx, smbShareName, smbPath, smbComment, smbGuestOK, smbReadOnly, smbBrowseable); err != nil { + s.logger.Error("Failed to apply SMB share", "error", err, "share_id", shareID) + } + } else { + // Remove SMB share if disabled + if err := s.removeSMBShare(ctx, share.SMBShareName); err != nil { + s.logger.Error("Failed to remove SMB share", "error", err, "share_id", shareID) + } + } + + return s.GetShare(ctx, shareID) +} + +// DeleteShare deletes a share +func (s *Service) DeleteShare(ctx context.Context, shareID string) error { + // Get share to get mount point and share name + share, err := s.GetShare(ctx, shareID) + if err != nil { + return err + } + + // Remove NFS export + if share.NFSEnabled { + if err := s.removeNFSExport(ctx, share.MountPoint); err != nil { + s.logger.Error("Failed to remove NFS export", "error", err, "share_id", shareID) + } + } + + // Remove SMB share + if share.SMBEnabled { + if err := s.removeSMBShare(ctx, share.SMBShareName); err != nil { + s.logger.Error("Failed to remove SMB share", "error", err, "share_id", shareID) + } + } + + // Delete from database + _, err = s.db.ExecContext(ctx, "DELETE FROM zfs_shares WHERE id = $1", shareID) + if err != nil { + return fmt.Errorf("failed to delete share: %w", err) + } + + return nil +} + +// applyNFSExport adds or updates an NFS export in /etc/exports +func (s *Service) applyNFSExport(ctx context.Context, mountPoint, options string, clients []string) error { + if mountPoint == "" || mountPoint == "none" { + return fmt.Errorf("mount point is required for NFS export") + } + + // Build client list (default to * if empty) + clientList := "*" + if len(clients) > 0 { + clientList = strings.Join(clients, " ") + } + + // Build export line (format: /path client(options)) + exportLine := fmt.Sprintf("%s %s(%s)", mountPoint, clientList, options) + + // Read current exports file (use actual config file, not symlink) + exportsPath := "/opt/calypso/conf/nfs/exports" + exportsContent, err := os.ReadFile(exportsPath) + if err != nil && !os.IsNotExist(err) { + return fmt.Errorf("failed to read exports file: %w", err) + } + + lines := strings.Split(string(exportsContent), "\n") + var newLines []string + found := false + + // Check if this mount point already exists + for _, line := range lines { + line = strings.TrimSpace(line) + if line == "" || strings.HasPrefix(line, "#") { + newLines = append(newLines, line) + continue + } + + // Check if this line is for our mount point + if strings.HasPrefix(line, mountPoint+" ") { + newLines = append(newLines, exportLine) + found = true + } else { + newLines = append(newLines, line) + } + } + + // Add if not found + if !found { + newLines = append(newLines, exportLine) + } + + // Write back to file (use sudo to ensure proper permissions) + newContent := strings.Join(newLines, "\n") + "\n" + tempFile := exportsPath + ".tmp" + if err := os.WriteFile(tempFile, []byte(newContent), 0644); err != nil { + return fmt.Errorf("failed to write temporary exports file: %w", err) + } + + // Move temp file to actual location using sudo + cmd := exec.CommandContext(ctx, "sudo", "mv", tempFile, exportsPath) + if output, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to move exports file: %s: %w", string(output), err) + } + + // Apply exports (reload NFS exports) + cmd = exec.CommandContext(ctx, "sudo", "exportfs", "-ra") + if output, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to apply exports: %s: %w", string(output), err) + } + + // Restart NFS service to ensure changes are picked up + cmd = exec.CommandContext(ctx, "sudo", "systemctl", "restart", "nfs-kernel-server") + if output, err := cmd.CombinedOutput(); err != nil { + s.logger.Warn("Failed to restart NFS service", "error", string(output)) + // Don't fail, as exportfs -ra should be sufficient + } + + s.logger.Info("NFS export applied", "mount_point", mountPoint, "clients", clientList) + return nil +} + +// removeNFSExport removes an NFS export from exports file +func (s *Service) removeNFSExport(ctx context.Context, mountPoint string) error { + if mountPoint == "" || mountPoint == "none" { + return nil // Nothing to remove + } + + exportsPath := "/opt/calypso/conf/nfs/exports" + exportsContent, err := os.ReadFile(exportsPath) + if err != nil { + if os.IsNotExist(err) { + return nil // File doesn't exist, nothing to remove + } + return fmt.Errorf("failed to read exports file: %w", err) + } + + lines := strings.Split(string(exportsContent), "\n") + var newLines []string + + for _, line := range lines { + line = strings.TrimSpace(line) + if line == "" || strings.HasPrefix(line, "#") { + newLines = append(newLines, line) + continue + } + + // Skip lines for this mount point + if strings.HasPrefix(line, mountPoint+" ") { + continue + } + + newLines = append(newLines, line) + } + + // Write back to file (use sudo to ensure proper permissions) + newContent := strings.Join(newLines, "\n") + if newContent != "" && !strings.HasSuffix(newContent, "\n") { + newContent += "\n" + } + tempFile := exportsPath + ".tmp" + if err := os.WriteFile(tempFile, []byte(newContent), 0644); err != nil { + return fmt.Errorf("failed to write temporary exports file: %w", err) + } + + // Move temp file to actual location using sudo + cmd := exec.CommandContext(ctx, "sudo", "mv", tempFile, exportsPath) + if output, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to move exports file: %s: %w", string(output), err) + } + + // Apply exports (reload NFS exports) + cmd = exec.CommandContext(ctx, "sudo", "exportfs", "-ra") + if output, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("failed to apply exports: %s: %w", string(output), err) + } + + // Restart NFS service to ensure changes are picked up + cmd = exec.CommandContext(ctx, "sudo", "systemctl", "restart", "nfs-kernel-server") + if output, err := cmd.CombinedOutput(); err != nil { + s.logger.Warn("Failed to restart NFS service", "error", string(output)) + // Don't fail, as exportfs -ra should be sufficient + } + + s.logger.Info("NFS export removed", "mount_point", mountPoint) + return nil +} + +// applySMBShare adds or updates an SMB share in /etc/samba/smb.conf +func (s *Service) applySMBShare(ctx context.Context, shareName, path, comment string, guestOK, readOnly, browseable bool) error { + if shareName == "" { + return fmt.Errorf("SMB share name is required") + } + if path == "" { + return fmt.Errorf("SMB path is required") + } + + smbConfPath := "/etc/samba/smb.conf" + smbContent, err := os.ReadFile(smbConfPath) + if err != nil { + return fmt.Errorf("failed to read smb.conf: %w", err) + } + + // Parse and update smb.conf + lines := strings.Split(string(smbContent), "\n") + var newLines []string + inShare := false + shareStart := -1 + + for i, line := range lines { + trimmed := strings.TrimSpace(line) + + // Check if we're entering our share section + if strings.HasPrefix(trimmed, "[") && strings.HasSuffix(trimmed, "]") { + sectionName := trimmed[1 : len(trimmed)-1] + if sectionName == shareName { + inShare = true + shareStart = i + continue + } else if inShare { + // We've left our share section, insert the share config here + newLines = append(newLines, s.buildSMBShareConfig(shareName, path, comment, guestOK, readOnly, browseable)) + inShare = false + } + } + + if inShare { + // Skip lines until we find the next section or end of file + continue + } + + newLines = append(newLines, line) + } + + // If we were still in the share at the end, add it + if inShare { + newLines = append(newLines, s.buildSMBShareConfig(shareName, path, comment, guestOK, readOnly, browseable)) + } else if shareStart == -1 { + // Share doesn't exist, add it at the end + newLines = append(newLines, "") + newLines = append(newLines, s.buildSMBShareConfig(shareName, path, comment, guestOK, readOnly, browseable)) + } + + // Write back to file + newContent := strings.Join(newLines, "\n") + if err := os.WriteFile(smbConfPath, []byte(newContent), 0644); err != nil { + return fmt.Errorf("failed to write smb.conf: %w", err) + } + + // Reload Samba + cmd := exec.CommandContext(ctx, "sudo", "systemctl", "reload", "smbd") + if output, err := cmd.CombinedOutput(); err != nil { + // Try restart if reload fails + cmd = exec.CommandContext(ctx, "sudo", "systemctl", "restart", "smbd") + if output2, err2 := cmd.CombinedOutput(); err2 != nil { + return fmt.Errorf("failed to reload/restart smbd: %s / %s: %w", string(output), string(output2), err2) + } + } + + s.logger.Info("SMB share applied", "share_name", shareName, "path", path) + return nil +} + +// buildSMBShareConfig builds the SMB share configuration block +func (s *Service) buildSMBShareConfig(shareName, path, comment string, guestOK, readOnly, browseable bool) string { + var config []string + config = append(config, fmt.Sprintf("[%s]", shareName)) + if comment != "" { + config = append(config, fmt.Sprintf(" comment = %s", comment)) + } + config = append(config, fmt.Sprintf(" path = %s", path)) + if guestOK { + config = append(config, " guest ok = yes") + } else { + config = append(config, " guest ok = no") + } + if readOnly { + config = append(config, " read only = yes") + } else { + config = append(config, " read only = no") + } + if browseable { + config = append(config, " browseable = yes") + } else { + config = append(config, " browseable = no") + } + return strings.Join(config, "\n") +} + +// removeSMBShare removes an SMB share from /etc/samba/smb.conf +func (s *Service) removeSMBShare(ctx context.Context, shareName string) error { + if shareName == "" { + return nil // Nothing to remove + } + + smbConfPath := "/etc/samba/smb.conf" + smbContent, err := os.ReadFile(smbConfPath) + if err != nil { + if os.IsNotExist(err) { + return nil // File doesn't exist, nothing to remove + } + return fmt.Errorf("failed to read smb.conf: %w", err) + } + + lines := strings.Split(string(smbContent), "\n") + var newLines []string + inShare := false + + for _, line := range lines { + trimmed := strings.TrimSpace(line) + + // Check if we're entering our share section + if strings.HasPrefix(trimmed, "[") && strings.HasSuffix(trimmed, "]") { + sectionName := trimmed[1 : len(trimmed)-1] + if sectionName == shareName { + inShare = true + continue + } else if inShare { + // We've left our share section + inShare = false + } + } + + if inShare { + // Skip lines in this share section + continue + } + + newLines = append(newLines, line) + } + + // Write back to file + newContent := strings.Join(newLines, "\n") + if err := os.WriteFile(smbConfPath, []byte(newContent), 0644); err != nil { + return fmt.Errorf("failed to write smb.conf: %w", err) + } + + // Reload Samba + cmd := exec.CommandContext(ctx, "sudo", "systemctl", "reload", "smbd") + if output, err := cmd.CombinedOutput(); err != nil { + // Try restart if reload fails + cmd = exec.CommandContext(ctx, "sudo", "systemctl", "restart", "smbd") + if output2, err2 := cmd.CombinedOutput(); err2 != nil { + return fmt.Errorf("failed to reload/restart smbd: %s / %s: %w", string(output), string(output2), err2) + } + } + + s.logger.Info("SMB share removed", "share_name", shareName) + return nil +} diff --git a/backend/internal/storage/disk.go b/backend/internal/storage/disk.go index 1d6ffd1..cb80212 100644 --- a/backend/internal/storage/disk.go +++ b/backend/internal/storage/disk.go @@ -195,7 +195,7 @@ func (s *DiskService) getZFSPoolForDisk(ctx context.Context, devicePath string) deviceName := strings.TrimPrefix(devicePath, "/dev/") // Get all ZFS pools - cmd := exec.CommandContext(ctx, "zpool", "list", "-H", "-o", "name") + cmd := exec.CommandContext(ctx, "sudo", "zpool", "list", "-H", "-o", "name") output, err := cmd.Output() if err != nil { return "" @@ -208,7 +208,7 @@ func (s *DiskService) getZFSPoolForDisk(ctx context.Context, devicePath string) } // Check pool status for this device - statusCmd := exec.CommandContext(ctx, "zpool", "status", poolName) + statusCmd := exec.CommandContext(ctx, "sudo", "zpool", "status", poolName) statusOutput, err := statusCmd.Output() if err != nil { continue diff --git a/backend/internal/storage/handler.go b/backend/internal/storage/handler.go index 2f3382c..7c60d23 100644 --- a/backend/internal/storage/handler.go +++ b/backend/internal/storage/handler.go @@ -15,14 +15,17 @@ import ( // Handler handles storage-related API requests type Handler struct { - diskService *DiskService - lvmService *LVMService - zfsService *ZFSService - arcService *ARCService - taskEngine *tasks.Engine - db *database.DB - logger *logger.Logger - cache *cache.Cache // Cache for invalidation + diskService *DiskService + lvmService *LVMService + zfsService *ZFSService + snapshotService *SnapshotService + snapshotScheduleService *SnapshotScheduleService + replicationService *ReplicationService + arcService *ARCService + taskEngine *tasks.Engine + db *database.DB + logger *logger.Logger + cache *cache.Cache // Cache for invalidation } // SetCache sets the cache instance for cache invalidation @@ -32,14 +35,18 @@ func (h *Handler) SetCache(c *cache.Cache) { // NewHandler creates a new storage handler func NewHandler(db *database.DB, log *logger.Logger) *Handler { + snapshotService := NewSnapshotService(db, log) return &Handler{ - diskService: NewDiskService(db, log), - lvmService: NewLVMService(db, log), - zfsService: NewZFSService(db, log), - arcService: NewARCService(log), - taskEngine: tasks.NewEngine(db, log), - db: db, - logger: log, + diskService: NewDiskService(db, log), + lvmService: NewLVMService(db, log), + zfsService: NewZFSService(db, log), + snapshotService: snapshotService, + snapshotScheduleService: NewSnapshotScheduleService(db, log, snapshotService), + replicationService: NewReplicationService(db, log), + arcService: NewARCService(log), + taskEngine: tasks.NewEngine(db, log), + db: db, + logger: log, } } @@ -509,3 +516,417 @@ func (h *Handler) GetARCStats(c *gin.Context) { c.JSON(http.StatusOK, stats) } + +// ListSnapshots lists all snapshots, optionally filtered by dataset +func (h *Handler) ListSnapshots(c *gin.Context) { + datasetFilter := c.DefaultQuery("dataset", "") + + snapshots, err := h.snapshotService.ListSnapshots(c.Request.Context(), datasetFilter) + if err != nil { + h.logger.Error("Failed to list snapshots", "error", err, "dataset", datasetFilter) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list snapshots: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"snapshots": snapshots}) +} + +// CreateSnapshotRequest represents a request to create a snapshot +type CreateSnapshotRequest struct { + Dataset string `json:"dataset" binding:"required"` + Name string `json:"name" binding:"required"` + Recursive bool `json:"recursive"` +} + +// CreateSnapshot creates a new snapshot +func (h *Handler) CreateSnapshot(c *gin.Context) { + var req CreateSnapshotRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create snapshot request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + if err := h.snapshotService.CreateSnapshot(c.Request.Context(), req.Dataset, req.Name, req.Recursive); err != nil { + h.logger.Error("Failed to create snapshot", "error", err, "dataset", req.Dataset, "name", req.Name) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create snapshot: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, gin.H{"message": "snapshot created successfully"}) +} + +// DeleteSnapshot deletes a snapshot +func (h *Handler) DeleteSnapshot(c *gin.Context) { + snapshotName := c.Param("name") + recursive := c.DefaultQuery("recursive", "false") == "true" + + if err := h.snapshotService.DeleteSnapshot(c.Request.Context(), snapshotName, recursive); err != nil { + h.logger.Error("Failed to delete snapshot", "error", err, "snapshot", snapshotName) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete snapshot: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "snapshot deleted successfully"}) +} + +// RollbackSnapshotRequest represents a request to rollback to a snapshot +type RollbackSnapshotRequest struct { + Force bool `json:"force"` +} + +// RollbackSnapshot rolls back a dataset to a snapshot +func (h *Handler) RollbackSnapshot(c *gin.Context) { + snapshotName := c.Param("name") + + var req RollbackSnapshotRequest + if err := c.ShouldBindJSON(&req); err != nil { + // Default to false if not provided + req.Force = false + } + + if err := h.snapshotService.RollbackSnapshot(c.Request.Context(), snapshotName, req.Force); err != nil { + h.logger.Error("Failed to rollback snapshot", "error", err, "snapshot", snapshotName) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to rollback snapshot: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "snapshot rollback completed successfully"}) +} + +// CloneSnapshotRequest represents a request to clone a snapshot +type CloneSnapshotRequest struct { + CloneName string `json:"clone_name" binding:"required"` +} + +// CloneSnapshot clones a snapshot to a new dataset +func (h *Handler) CloneSnapshot(c *gin.Context) { + snapshotName := c.Param("name") + + var req CloneSnapshotRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid clone snapshot request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + if err := h.snapshotService.CloneSnapshot(c.Request.Context(), snapshotName, req.CloneName); err != nil { + h.logger.Error("Failed to clone snapshot", "error", err, "snapshot", snapshotName, "clone", req.CloneName) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to clone snapshot: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, gin.H{"message": "snapshot cloned successfully", "clone_name": req.CloneName}) +} + +// ListSnapshotSchedules lists all snapshot schedules +func (h *Handler) ListSnapshotSchedules(c *gin.Context) { + schedules, err := h.snapshotScheduleService.ListSchedules(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to list snapshot schedules", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list snapshot schedules: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"schedules": schedules}) +} + +// GetSnapshotSchedule retrieves a snapshot schedule by ID +func (h *Handler) GetSnapshotSchedule(c *gin.Context) { + id := c.Param("id") + + schedule, err := h.snapshotScheduleService.GetSchedule(c.Request.Context(), id) + if err != nil { + if err.Error() == "schedule not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "schedule not found"}) + return + } + h.logger.Error("Failed to get snapshot schedule", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get snapshot schedule: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, schedule) +} + +// CreateSnapshotScheduleRequest represents a request to create a snapshot schedule +type CreateSnapshotScheduleRequest struct { + Name string `json:"name" binding:"required"` + Dataset string `json:"dataset" binding:"required"` + SnapshotNameTemplate string `json:"snapshot_name_template" binding:"required"` + ScheduleType string `json:"schedule_type" binding:"required"` + ScheduleConfig map[string]interface{} `json:"schedule_config" binding:"required"` + Recursive bool `json:"recursive"` + RetentionCount *int `json:"retention_count"` + RetentionDays *int `json:"retention_days"` +} + +// CreateSnapshotSchedule creates a new snapshot schedule +func (h *Handler) CreateSnapshotSchedule(c *gin.Context) { + var req CreateSnapshotScheduleRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create snapshot schedule request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + userID, _ := c.Get("user_id") + userIDStr := "" + if userID != nil { + userIDStr = userID.(string) + } + + schedule, err := h.snapshotScheduleService.CreateSchedule(c.Request.Context(), &CreateScheduleRequest{ + Name: req.Name, + Dataset: req.Dataset, + SnapshotNameTemplate: req.SnapshotNameTemplate, + ScheduleType: req.ScheduleType, + ScheduleConfig: req.ScheduleConfig, + Recursive: req.Recursive, + RetentionCount: req.RetentionCount, + RetentionDays: req.RetentionDays, + }, userIDStr) + if err != nil { + h.logger.Error("Failed to create snapshot schedule", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create snapshot schedule: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, schedule) +} + +// UpdateSnapshotSchedule updates an existing snapshot schedule +func (h *Handler) UpdateSnapshotSchedule(c *gin.Context) { + id := c.Param("id") + + var req CreateSnapshotScheduleRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid update snapshot schedule request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + schedule, err := h.snapshotScheduleService.UpdateSchedule(c.Request.Context(), id, &CreateScheduleRequest{ + Name: req.Name, + Dataset: req.Dataset, + SnapshotNameTemplate: req.SnapshotNameTemplate, + ScheduleType: req.ScheduleType, + ScheduleConfig: req.ScheduleConfig, + Recursive: req.Recursive, + RetentionCount: req.RetentionCount, + RetentionDays: req.RetentionDays, + }) + if err != nil { + if err.Error() == "schedule not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "schedule not found"}) + return + } + h.logger.Error("Failed to update snapshot schedule", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update snapshot schedule: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, schedule) +} + +// DeleteSnapshotSchedule deletes a snapshot schedule +func (h *Handler) DeleteSnapshotSchedule(c *gin.Context) { + id := c.Param("id") + + if err := h.snapshotScheduleService.DeleteSchedule(c.Request.Context(), id); err != nil { + if err.Error() == "schedule not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "schedule not found"}) + return + } + h.logger.Error("Failed to delete snapshot schedule", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete snapshot schedule: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "snapshot schedule deleted successfully"}) +} + +// ToggleSnapshotSchedule enables or disables a snapshot schedule +func (h *Handler) ToggleSnapshotSchedule(c *gin.Context) { + id := c.Param("id") + + var req struct { + Enabled bool `json:"enabled" binding:"required"` + } + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid toggle snapshot schedule request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + if err := h.snapshotScheduleService.ToggleSchedule(c.Request.Context(), id, req.Enabled); err != nil { + if err.Error() == "schedule not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "schedule not found"}) + return + } + h.logger.Error("Failed to toggle snapshot schedule", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to toggle snapshot schedule: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "snapshot schedule toggled successfully"}) +} + +// ListReplicationTasks lists all replication tasks +func (h *Handler) ListReplicationTasks(c *gin.Context) { + direction := c.Query("direction") // Optional filter: "outbound" or "inbound" + tasks, err := h.replicationService.ListReplicationTasks(c.Request.Context(), direction) + if err != nil { + h.logger.Error("Failed to list replication tasks", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list replication tasks: " + err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"tasks": tasks}) +} + +// GetReplicationTask retrieves a replication task by ID +func (h *Handler) GetReplicationTask(c *gin.Context) { + id := c.Param("id") + task, err := h.replicationService.GetReplicationTask(c.Request.Context(), id) + if err != nil { + if err.Error() == "replication task not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "replication task not found"}) + return + } + h.logger.Error("Failed to get replication task", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get replication task: " + err.Error()}) + return + } + c.JSON(http.StatusOK, task) +} + +// CreateReplicationTaskRequest represents a request to create a replication task +type CreateReplicationTaskRequest struct { + Name string `json:"name" binding:"required"` + Direction string `json:"direction" binding:"required"` + SourceDataset *string `json:"source_dataset"` + TargetHost *string `json:"target_host"` + TargetPort *int `json:"target_port"` + TargetUser *string `json:"target_user"` + TargetDataset *string `json:"target_dataset"` + TargetSSHKeyPath *string `json:"target_ssh_key_path"` + SourceHost *string `json:"source_host"` + SourcePort *int `json:"source_port"` + SourceUser *string `json:"source_user"` + LocalDataset *string `json:"local_dataset"` + ScheduleType *string `json:"schedule_type"` + ScheduleConfig map[string]interface{} `json:"schedule_config"` + Compression string `json:"compression"` + Encryption bool `json:"encryption"` + Recursive bool `json:"recursive"` + Incremental bool `json:"incremental"` + AutoSnapshot bool `json:"auto_snapshot"` + Enabled bool `json:"enabled"` +} + +// CreateReplicationTask creates a new replication task +func (h *Handler) CreateReplicationTask(c *gin.Context) { + var req CreateReplicationTaskRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid create replication task request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + userID, _ := c.Get("user_id") + userIDStr := "" + if userID != nil { + userIDStr = userID.(string) + } + + task, err := h.replicationService.CreateReplicationTask(c.Request.Context(), &CreateReplicationRequest{ + Name: req.Name, + Direction: req.Direction, + SourceDataset: req.SourceDataset, + TargetHost: req.TargetHost, + TargetPort: req.TargetPort, + TargetUser: req.TargetUser, + TargetDataset: req.TargetDataset, + TargetSSHKeyPath: req.TargetSSHKeyPath, + SourceHost: req.SourceHost, + SourcePort: req.SourcePort, + SourceUser: req.SourceUser, + LocalDataset: req.LocalDataset, + ScheduleType: req.ScheduleType, + ScheduleConfig: req.ScheduleConfig, + Compression: req.Compression, + Encryption: req.Encryption, + Recursive: req.Recursive, + Incremental: req.Incremental, + AutoSnapshot: req.AutoSnapshot, + Enabled: req.Enabled, + }, userIDStr) + if err != nil { + h.logger.Error("Failed to create replication task", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create replication task: " + err.Error()}) + return + } + + c.JSON(http.StatusCreated, task) +} + +// UpdateReplicationTask updates an existing replication task +func (h *Handler) UpdateReplicationTask(c *gin.Context) { + id := c.Param("id") + var req CreateReplicationTaskRequest + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid update replication task request", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request: " + err.Error()}) + return + } + + task, err := h.replicationService.UpdateReplicationTask(c.Request.Context(), id, &CreateReplicationRequest{ + Name: req.Name, + Direction: req.Direction, + SourceDataset: req.SourceDataset, + TargetHost: req.TargetHost, + TargetPort: req.TargetPort, + TargetUser: req.TargetUser, + TargetDataset: req.TargetDataset, + TargetSSHKeyPath: req.TargetSSHKeyPath, + SourceHost: req.SourceHost, + SourcePort: req.SourcePort, + SourceUser: req.SourceUser, + LocalDataset: req.LocalDataset, + ScheduleType: req.ScheduleType, + ScheduleConfig: req.ScheduleConfig, + Compression: req.Compression, + Encryption: req.Encryption, + Recursive: req.Recursive, + Incremental: req.Incremental, + AutoSnapshot: req.AutoSnapshot, + Enabled: req.Enabled, + }) + if err != nil { + if err.Error() == "replication task not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "replication task not found"}) + return + } + h.logger.Error("Failed to update replication task", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to update replication task: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, task) +} + +// DeleteReplicationTask deletes a replication task +func (h *Handler) DeleteReplicationTask(c *gin.Context) { + id := c.Param("id") + if err := h.replicationService.DeleteReplicationTask(c.Request.Context(), id); err != nil { + if err.Error() == "replication task not found" { + c.JSON(http.StatusNotFound, gin.H{"error": "replication task not found"}) + return + } + h.logger.Error("Failed to delete replication task", "error", err, "id", id) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete replication task: " + err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "replication task deleted successfully"}) +} diff --git a/backend/internal/storage/replication.go b/backend/internal/storage/replication.go new file mode 100644 index 0000000..b0f4be1 --- /dev/null +++ b/backend/internal/storage/replication.go @@ -0,0 +1,553 @@ +package storage + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/google/uuid" +) + +// ReplicationService handles ZFS replication task management +type ReplicationService struct { + db *database.DB + logger *logger.Logger +} + +// NewReplicationService creates a new replication service +func NewReplicationService(db *database.DB, log *logger.Logger) *ReplicationService { + return &ReplicationService{ + db: db, + logger: log, + } +} + +// ReplicationTask represents a ZFS replication task +type ReplicationTask struct { + ID string `json:"id"` + Name string `json:"name"` + Direction string `json:"direction"` // "outbound" or "inbound" + SourceDataset *string `json:"source_dataset,omitempty"` + TargetHost *string `json:"target_host,omitempty"` + TargetPort *int `json:"target_port,omitempty"` + TargetUser *string `json:"target_user,omitempty"` + TargetDataset *string `json:"target_dataset,omitempty"` + TargetSSHKeyPath *string `json:"target_ssh_key_path,omitempty"` + SourceHost *string `json:"source_host,omitempty"` + SourcePort *int `json:"source_port,omitempty"` + SourceUser *string `json:"source_user,omitempty"` + LocalDataset *string `json:"local_dataset,omitempty"` + ScheduleType *string `json:"schedule_type,omitempty"` + ScheduleConfig map[string]interface{} `json:"schedule_config,omitempty"` + Compression string `json:"compression"` + Encryption bool `json:"encryption"` + Recursive bool `json:"recursive"` + Incremental bool `json:"incremental"` + AutoSnapshot bool `json:"auto_snapshot"` + Enabled bool `json:"enabled"` + Status string `json:"status"` + LastRunAt *time.Time `json:"last_run_at,omitempty"` + LastRunStatus *string `json:"last_run_status,omitempty"` + LastRunError *string `json:"last_run_error,omitempty"` + NextRunAt *time.Time `json:"next_run_at,omitempty"` + LastSnapshotSent *string `json:"last_snapshot_sent,omitempty"` + LastSnapshotReceived *string `json:"last_snapshot_received,omitempty"` + TotalRuns int `json:"total_runs"` + SuccessfulRuns int `json:"successful_runs"` + FailedRuns int `json:"failed_runs"` + BytesSent int64 `json:"bytes_sent"` + BytesReceived int64 `json:"bytes_received"` + CreatedBy string `json:"created_by,omitempty"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +// CreateReplicationRequest represents a request to create a replication task +type CreateReplicationRequest struct { + Name string `json:"name" binding:"required"` + Direction string `json:"direction" binding:"required"` // "outbound" or "inbound" + SourceDataset *string `json:"source_dataset"` + TargetHost *string `json:"target_host"` + TargetPort *int `json:"target_port"` + TargetUser *string `json:"target_user"` + TargetDataset *string `json:"target_dataset"` + TargetSSHKeyPath *string `json:"target_ssh_key_path"` + SourceHost *string `json:"source_host"` + SourcePort *int `json:"source_port"` + SourceUser *string `json:"source_user"` + LocalDataset *string `json:"local_dataset"` + ScheduleType *string `json:"schedule_type"` + ScheduleConfig map[string]interface{} `json:"schedule_config"` + Compression string `json:"compression"` + Encryption bool `json:"encryption"` + Recursive bool `json:"recursive"` + Incremental bool `json:"incremental"` + AutoSnapshot bool `json:"auto_snapshot"` + Enabled bool `json:"enabled"` +} + +// ListReplicationTasks lists all replication tasks, optionally filtered by direction +func (s *ReplicationService) ListReplicationTasks(ctx context.Context, directionFilter string) ([]*ReplicationTask, error) { + var query string + var args []interface{} + + if directionFilter != "" { + query = ` + SELECT id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, last_run_at, last_run_status, last_run_error, + next_run_at, last_snapshot_sent, last_snapshot_received, + total_runs, successful_runs, failed_runs, bytes_sent, bytes_received, + created_by, created_at, updated_at + FROM replication_tasks + WHERE direction = $1 + ORDER BY created_at DESC + ` + args = []interface{}{directionFilter} + } else { + query = ` + SELECT id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, last_run_at, last_run_status, last_run_error, + next_run_at, last_snapshot_sent, last_snapshot_received, + total_runs, successful_runs, failed_runs, bytes_sent, bytes_received, + created_by, created_at, updated_at + FROM replication_tasks + ORDER BY direction, created_at DESC + ` + args = []interface{}{} + } + + rows, err := s.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, fmt.Errorf("failed to query replication tasks: %w", err) + } + defer rows.Close() + + var tasks []*ReplicationTask + for rows.Next() { + task, err := s.scanReplicationTask(rows) + if err != nil { + s.logger.Error("Failed to scan replication task", "error", err) + continue + } + tasks = append(tasks, task) + } + + return tasks, rows.Err() +} + +// GetReplicationTask retrieves a replication task by ID +func (s *ReplicationService) GetReplicationTask(ctx context.Context, id string) (*ReplicationTask, error) { + query := ` + SELECT id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, last_run_at, last_run_status, last_run_error, + next_run_at, last_snapshot_sent, last_snapshot_received, + total_runs, successful_runs, failed_runs, bytes_sent, bytes_received, + created_by, created_at, updated_at + FROM replication_tasks + WHERE id = $1 + ` + + row := s.db.QueryRowContext(ctx, query, id) + task, err := s.scanReplicationTaskRow(row) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("replication task not found") + } + return nil, fmt.Errorf("failed to get replication task: %w", err) + } + + return task, nil +} + +// CreateReplicationTask creates a new replication task +func (s *ReplicationService) CreateReplicationTask(ctx context.Context, req *CreateReplicationRequest, createdBy string) (*ReplicationTask, error) { + id := uuid.New().String() + + // Validate direction-specific fields + if req.Direction == "outbound" { + if req.SourceDataset == nil || req.TargetHost == nil || req.TargetDataset == nil { + return nil, fmt.Errorf("outbound replication requires source_dataset, target_host, and target_dataset") + } + } else if req.Direction == "inbound" { + if req.SourceHost == nil || req.SourceDataset == nil || req.LocalDataset == nil { + return nil, fmt.Errorf("inbound replication requires source_host, source_dataset, and local_dataset") + } + } else { + return nil, fmt.Errorf("invalid direction: must be 'outbound' or 'inbound'") + } + + // Set defaults + if req.Compression == "" { + req.Compression = "lz4" + } + if req.TargetPort == nil { + defaultPort := 22 + req.TargetPort = &defaultPort + } + if req.SourcePort == nil { + defaultPort := 22 + req.SourcePort = &defaultPort + } + if req.TargetUser == nil { + defaultUser := "root" + req.TargetUser = &defaultUser + } + if req.SourceUser == nil { + defaultUser := "root" + req.SourceUser = &defaultUser + } + + // Marshal schedule config to JSON + var scheduleConfigJSON sql.NullString + if req.ScheduleConfig != nil { + configJSON, err := json.Marshal(req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal schedule config: %w", err) + } + scheduleConfigJSON = sql.NullString{String: string(configJSON), Valid: true} + } + + query := ` + INSERT INTO replication_tasks ( + id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, created_by, created_at, updated_at + ) VALUES ( + $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, NOW(), NOW() + ) + RETURNING id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, last_run_at, last_run_status, last_run_error, + next_run_at, last_snapshot_sent, last_snapshot_received, + total_runs, successful_runs, failed_runs, bytes_sent, bytes_received, + created_by, created_at, updated_at + ` + + var scheduleTypeStr sql.NullString + if req.ScheduleType != nil { + scheduleTypeStr = sql.NullString{String: *req.ScheduleType, Valid: true} + } + + row := s.db.QueryRowContext(ctx, query, + id, req.Name, req.Direction, + req.SourceDataset, req.TargetHost, req.TargetPort, req.TargetUser, req.TargetDataset, + req.TargetSSHKeyPath, req.SourceHost, req.SourcePort, req.SourceUser, req.LocalDataset, + scheduleTypeStr, scheduleConfigJSON, req.Compression, req.Encryption, req.Recursive, req.Incremental, + req.AutoSnapshot, req.Enabled, "idle", createdBy, + ) + + task, err := s.scanReplicationTaskRow(row) + if err != nil { + return nil, fmt.Errorf("failed to create replication task: %w", err) + } + + s.logger.Info("Replication task created", "id", id, "name", req.Name, "direction", req.Direction) + return task, nil +} + +// UpdateReplicationTask updates an existing replication task +func (s *ReplicationService) UpdateReplicationTask(ctx context.Context, id string, req *CreateReplicationRequest) (*ReplicationTask, error) { + // Validate direction-specific fields + if req.Direction == "outbound" { + if req.SourceDataset == nil || req.TargetHost == nil || req.TargetDataset == nil { + return nil, fmt.Errorf("outbound replication requires source_dataset, target_host, and target_dataset") + } + } else if req.Direction == "inbound" { + if req.SourceHost == nil || req.SourceDataset == nil || req.LocalDataset == nil { + return nil, fmt.Errorf("inbound replication requires source_host, source_dataset, and local_dataset") + } + } else { + return nil, fmt.Errorf("invalid direction: must be 'outbound' or 'inbound'") + } + + // Set defaults + if req.Compression == "" { + req.Compression = "lz4" + } + if req.TargetPort == nil { + defaultPort := 22 + req.TargetPort = &defaultPort + } + if req.SourcePort == nil { + defaultPort := 22 + req.SourcePort = &defaultPort + } + if req.TargetUser == nil { + defaultUser := "root" + req.TargetUser = &defaultUser + } + if req.SourceUser == nil { + defaultUser := "root" + req.SourceUser = &defaultUser + } + + // Marshal schedule config to JSON + var scheduleConfigJSON sql.NullString + if req.ScheduleConfig != nil { + configJSON, err := json.Marshal(req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal schedule config: %w", err) + } + scheduleConfigJSON = sql.NullString{String: string(configJSON), Valid: true} + } + + var scheduleTypeStr sql.NullString + if req.ScheduleType != nil { + scheduleTypeStr = sql.NullString{String: *req.ScheduleType, Valid: true} + } + + query := ` + UPDATE replication_tasks + SET name = $1, direction = $2, source_dataset = $3, target_host = $4, target_port = $5, + target_user = $6, target_dataset = $7, target_ssh_key_path = $8, source_host = $9, + source_port = $10, source_user = $11, local_dataset = $12, schedule_type = $13, + schedule_config = $14, compression = $15, encryption = $16, recursive = $17, + incremental = $18, auto_snapshot = $19, enabled = $20, updated_at = NOW() + WHERE id = $21 + RETURNING id, name, direction, source_dataset, target_host, target_port, target_user, target_dataset, + target_ssh_key_path, source_host, source_port, source_user, local_dataset, + schedule_type, schedule_config, compression, encryption, recursive, incremental, + auto_snapshot, enabled, status, last_run_at, last_run_status, last_run_error, + next_run_at, last_snapshot_sent, last_snapshot_received, + total_runs, successful_runs, failed_runs, bytes_sent, bytes_received, + created_by, created_at, updated_at + ` + + row := s.db.QueryRowContext(ctx, query, + req.Name, req.Direction, + req.SourceDataset, req.TargetHost, req.TargetPort, req.TargetUser, req.TargetDataset, + req.TargetSSHKeyPath, req.SourceHost, req.SourcePort, req.SourceUser, req.LocalDataset, + scheduleTypeStr, scheduleConfigJSON, req.Compression, req.Encryption, req.Recursive, req.Incremental, + req.AutoSnapshot, req.Enabled, id, + ) + + task, err := s.scanReplicationTaskRow(row) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("replication task not found") + } + return nil, fmt.Errorf("failed to update replication task: %w", err) + } + + s.logger.Info("Replication task updated", "id", id) + return task, nil +} + +// DeleteReplicationTask deletes a replication task +func (s *ReplicationService) DeleteReplicationTask(ctx context.Context, id string) error { + query := `DELETE FROM replication_tasks WHERE id = $1` + result, err := s.db.ExecContext(ctx, query, id) + if err != nil { + return fmt.Errorf("failed to delete replication task: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + return fmt.Errorf("replication task not found") + } + + s.logger.Info("Replication task deleted", "id", id) + return nil +} + +// scanReplicationTaskRow scans a single replication task row +func (s *ReplicationService) scanReplicationTaskRow(row *sql.Row) (*ReplicationTask, error) { + var task ReplicationTask + var sourceDataset, targetHost, targetUser, targetDataset, targetSSHKeyPath sql.NullString + var sourceHost, sourceUser, localDataset sql.NullString + var targetPort, sourcePort sql.NullInt64 + var scheduleType, scheduleConfigJSON sql.NullString + var lastRunAt, nextRunAt sql.NullTime + var lastRunStatus, lastRunError, lastSnapshotSent, lastSnapshotReceived sql.NullString + var createdBy sql.NullString + + err := row.Scan( + &task.ID, &task.Name, &task.Direction, + &sourceDataset, &targetHost, &targetPort, &targetUser, &targetDataset, + &targetSSHKeyPath, &sourceHost, &sourcePort, &sourceUser, &localDataset, + &scheduleType, &scheduleConfigJSON, &task.Compression, &task.Encryption, + &task.Recursive, &task.Incremental, &task.AutoSnapshot, &task.Enabled, &task.Status, + &lastRunAt, &lastRunStatus, &lastRunError, &nextRunAt, + &lastSnapshotSent, &lastSnapshotReceived, + &task.TotalRuns, &task.SuccessfulRuns, &task.FailedRuns, + &task.BytesSent, &task.BytesReceived, + &createdBy, &task.CreatedAt, &task.UpdatedAt, + ) + if err != nil { + return nil, err + } + + // Handle nullable fields + if sourceDataset.Valid { + task.SourceDataset = &sourceDataset.String + } + if targetHost.Valid { + task.TargetHost = &targetHost.String + } + if targetPort.Valid { + port := int(targetPort.Int64) + task.TargetPort = &port + } + if targetUser.Valid { + task.TargetUser = &targetUser.String + } + if targetDataset.Valid { + task.TargetDataset = &targetDataset.String + } + if targetSSHKeyPath.Valid { + task.TargetSSHKeyPath = &targetSSHKeyPath.String + } + if sourceHost.Valid { + task.SourceHost = &sourceHost.String + } + if sourcePort.Valid { + port := int(sourcePort.Int64) + task.SourcePort = &port + } + if sourceUser.Valid { + task.SourceUser = &sourceUser.String + } + if localDataset.Valid { + task.LocalDataset = &localDataset.String + } + if scheduleType.Valid { + task.ScheduleType = &scheduleType.String + } + if scheduleConfigJSON.Valid { + if err := json.Unmarshal([]byte(scheduleConfigJSON.String), &task.ScheduleConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal schedule config: %w", err) + } + } + if lastRunAt.Valid { + task.LastRunAt = &lastRunAt.Time + } + if lastRunStatus.Valid { + task.LastRunStatus = &lastRunStatus.String + } + if lastRunError.Valid { + task.LastRunError = &lastRunError.String + } + if nextRunAt.Valid { + task.NextRunAt = &nextRunAt.Time + } + if lastSnapshotSent.Valid { + task.LastSnapshotSent = &lastSnapshotSent.String + } + if lastSnapshotReceived.Valid { + task.LastSnapshotReceived = &lastSnapshotReceived.String + } + if createdBy.Valid { + task.CreatedBy = createdBy.String + } + + return &task, nil +} + +// scanReplicationTask scans a replication task from rows +func (s *ReplicationService) scanReplicationTask(rows *sql.Rows) (*ReplicationTask, error) { + var task ReplicationTask + var sourceDataset, targetHost, targetUser, targetDataset, targetSSHKeyPath sql.NullString + var sourceHost, sourceUser, localDataset sql.NullString + var targetPort, sourcePort sql.NullInt64 + var scheduleType, scheduleConfigJSON sql.NullString + var lastRunAt, nextRunAt sql.NullTime + var lastRunStatus, lastRunError, lastSnapshotSent, lastSnapshotReceived sql.NullString + var createdBy sql.NullString + + err := rows.Scan( + &task.ID, &task.Name, &task.Direction, + &sourceDataset, &targetHost, &targetPort, &targetUser, &targetDataset, + &targetSSHKeyPath, &sourceHost, &sourcePort, &sourceUser, &localDataset, + &scheduleType, &scheduleConfigJSON, &task.Compression, &task.Encryption, + &task.Recursive, &task.Incremental, &task.AutoSnapshot, &task.Enabled, &task.Status, + &lastRunAt, &lastRunStatus, &lastRunError, &nextRunAt, + &lastSnapshotSent, &lastSnapshotReceived, + &task.TotalRuns, &task.SuccessfulRuns, &task.FailedRuns, + &task.BytesSent, &task.BytesReceived, + &createdBy, &task.CreatedAt, &task.UpdatedAt, + ) + if err != nil { + return nil, err + } + + // Handle nullable fields (same as scanReplicationTaskRow) + if sourceDataset.Valid { + task.SourceDataset = &sourceDataset.String + } + if targetHost.Valid { + task.TargetHost = &targetHost.String + } + if targetPort.Valid { + port := int(targetPort.Int64) + task.TargetPort = &port + } + if targetUser.Valid { + task.TargetUser = &targetUser.String + } + if targetDataset.Valid { + task.TargetDataset = &targetDataset.String + } + if targetSSHKeyPath.Valid { + task.TargetSSHKeyPath = &targetSSHKeyPath.String + } + if sourceHost.Valid { + task.SourceHost = &sourceHost.String + } + if sourcePort.Valid { + port := int(sourcePort.Int64) + task.SourcePort = &port + } + if sourceUser.Valid { + task.SourceUser = &sourceUser.String + } + if localDataset.Valid { + task.LocalDataset = &localDataset.String + } + if scheduleType.Valid { + task.ScheduleType = &scheduleType.String + } + if scheduleConfigJSON.Valid { + if err := json.Unmarshal([]byte(scheduleConfigJSON.String), &task.ScheduleConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal schedule config: %w", err) + } + } + if lastRunAt.Valid { + task.LastRunAt = &lastRunAt.Time + } + if lastRunStatus.Valid { + task.LastRunStatus = &lastRunStatus.String + } + if lastRunError.Valid { + task.LastRunError = &lastRunError.String + } + if nextRunAt.Valid { + task.NextRunAt = &nextRunAt.Time + } + if lastSnapshotSent.Valid { + task.LastSnapshotSent = &lastSnapshotSent.String + } + if lastSnapshotReceived.Valid { + task.LastSnapshotReceived = &lastSnapshotReceived.String + } + if createdBy.Valid { + task.CreatedBy = createdBy.String + } + + return &task, nil +} diff --git a/backend/internal/storage/snapshot.go b/backend/internal/storage/snapshot.go new file mode 100644 index 0000000..9b5d56e --- /dev/null +++ b/backend/internal/storage/snapshot.go @@ -0,0 +1,259 @@ +package storage + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" +) + +// SnapshotService handles ZFS snapshot operations +type SnapshotService struct { + db *database.DB + logger *logger.Logger +} + +// NewSnapshotService creates a new snapshot service +func NewSnapshotService(db *database.DB, log *logger.Logger) *SnapshotService { + return &SnapshotService{ + db: db, + logger: log, + } +} + +// Snapshot represents a ZFS snapshot +type Snapshot struct { + ID string `json:"id"` + Name string `json:"name"` // Full snapshot name (e.g., "pool/dataset@snapshot-name") + Dataset string `json:"dataset"` // Dataset name (e.g., "pool/dataset") + SnapshotName string `json:"snapshot_name"` // Snapshot name only (e.g., "snapshot-name") + Created time.Time `json:"created"` + Referenced int64 `json:"referenced"` // Size in bytes + Used int64 `json:"used"` // Used space in bytes + IsLatest bool `json:"is_latest"` // Whether this is the latest snapshot for the dataset +} + +// ListSnapshots lists all snapshots, optionally filtered by dataset +func (s *SnapshotService) ListSnapshots(ctx context.Context, datasetFilter string) ([]*Snapshot, error) { + // Build zfs list command + args := []string{"list", "-t", "snapshot", "-H", "-o", "name,creation,referenced,used"} + if datasetFilter != "" { + // List snapshots for specific dataset + args = append(args, datasetFilter) + } else { + // List all snapshots + args = append(args, "-r") + } + + cmd := zfsCommand(ctx, args...) + output, err := cmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to list snapshots: %w", err) + } + + lines := strings.Split(strings.TrimSpace(string(output)), "\n") + var snapshots []*Snapshot + + // Track latest snapshot per dataset + latestSnapshots := make(map[string]*Snapshot) + + for _, line := range lines { + if line == "" { + continue + } + + fields := strings.Fields(line) + if len(fields) < 4 { + continue + } + + fullName := fields[0] + creationStr := fields[1] + referencedStr := fields[2] + usedStr := fields[3] + + // Parse snapshot name (format: pool/dataset@snapshot-name) + parts := strings.Split(fullName, "@") + if len(parts) != 2 { + continue + } + + dataset := parts[0] + snapshotName := parts[1] + + // Parse creation time (Unix timestamp) + var creationTime time.Time + if timestamp, err := parseZFSUnixTimestamp(creationStr); err == nil { + creationTime = timestamp + } else { + // Fallback to current time if parsing fails + creationTime = time.Now() + } + + // Parse sizes + referenced := parseSnapshotSize(referencedStr) + used := parseSnapshotSize(usedStr) + + snapshot := &Snapshot{ + ID: fullName, + Name: fullName, + Dataset: dataset, + SnapshotName: snapshotName, + Created: creationTime, + Referenced: referenced, + Used: used, + IsLatest: false, + } + + snapshots = append(snapshots, snapshot) + + // Track latest snapshot per dataset + if latest, exists := latestSnapshots[dataset]; !exists || snapshot.Created.After(latest.Created) { + latestSnapshots[dataset] = snapshot + } + } + + // Mark latest snapshots + for _, snapshot := range snapshots { + if latest, exists := latestSnapshots[snapshot.Dataset]; exists && latest.ID == snapshot.ID { + snapshot.IsLatest = true + } + } + + return snapshots, nil +} + +// CreateSnapshot creates a new snapshot +func (s *SnapshotService) CreateSnapshot(ctx context.Context, dataset, snapshotName string, recursive bool) error { + // Validate dataset exists + cmd := zfsCommand(ctx, "list", "-H", "-o", "name", dataset) + if err := cmd.Run(); err != nil { + return fmt.Errorf("dataset %s does not exist: %w", dataset, err) + } + + // Build snapshot name + fullSnapshotName := fmt.Sprintf("%s@%s", dataset, snapshotName) + + // Build command + args := []string{"snapshot"} + if recursive { + args = append(args, "-r") + } + args = append(args, fullSnapshotName) + + cmd = zfsCommand(ctx, args...) + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to create snapshot: %s: %w", string(output), err) + } + + s.logger.Info("Snapshot created", "snapshot", fullSnapshotName, "dataset", dataset, "recursive", recursive) + return nil +} + +// DeleteSnapshot deletes a snapshot +func (s *SnapshotService) DeleteSnapshot(ctx context.Context, snapshotName string, recursive bool) error { + // Build command + args := []string{"destroy"} + if recursive { + args = append(args, "-r") + } + args = append(args, snapshotName) + + cmd := zfsCommand(ctx, args...) + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to delete snapshot: %s: %w", string(output), err) + } + + s.logger.Info("Snapshot deleted", "snapshot", snapshotName, "recursive", recursive) + return nil +} + +// RollbackSnapshot rolls back a dataset to a snapshot +func (s *SnapshotService) RollbackSnapshot(ctx context.Context, snapshotName string, force bool) error { + // Build command + args := []string{"rollback"} + if force { + args = append(args, "-r", "-f") + } else { + args = append(args, "-r") + } + args = append(args, snapshotName) + + cmd := zfsCommand(ctx, args...) + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to rollback snapshot: %s: %w", string(output), err) + } + + s.logger.Info("Snapshot rollback completed", "snapshot", snapshotName, "force", force) + return nil +} + +// CloneSnapshot clones a snapshot to a new dataset +func (s *SnapshotService) CloneSnapshot(ctx context.Context, snapshotName, cloneName string) error { + // Build command + args := []string{"clone", snapshotName, cloneName} + + cmd := zfsCommand(ctx, args...) + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to clone snapshot: %s: %w", string(output), err) + } + + s.logger.Info("Snapshot cloned", "snapshot", snapshotName, "clone", cloneName) + return nil +} + +// parseZFSUnixTimestamp parses ZFS Unix timestamp string +func parseZFSUnixTimestamp(timestampStr string) (time.Time, error) { + // ZFS returns Unix timestamp as string + timestamp, err := time.Parse("20060102150405", timestampStr) + if err != nil { + // Try parsing as Unix timestamp integer + var unixTime int64 + if _, err := fmt.Sscanf(timestampStr, "%d", &unixTime); err == nil { + return time.Unix(unixTime, 0), nil + } + return time.Time{}, err + } + return timestamp, nil +} + +// parseZFSSize parses ZFS size string (e.g., "1.2M", "4.5G", "850K") +// Note: This function is also defined in zfs.go, but we need it here for snapshot parsing +func parseSnapshotSize(sizeStr string) int64 { + if sizeStr == "-" || sizeStr == "" { + return 0 + } + + // Remove any whitespace + sizeStr = strings.TrimSpace(sizeStr) + + // Parse size with unit + var size float64 + var unit string + if _, err := fmt.Sscanf(sizeStr, "%f%s", &size, &unit); err != nil { + return 0 + } + + // Convert to bytes + unit = strings.ToUpper(unit) + switch unit { + case "K", "KB": + return int64(size * 1024) + case "M", "MB": + return int64(size * 1024 * 1024) + case "G", "GB": + return int64(size * 1024 * 1024 * 1024) + case "T", "TB": + return int64(size * 1024 * 1024 * 1024 * 1024) + default: + // Assume bytes if no unit + return int64(size) + } +} diff --git a/backend/internal/storage/snapshot_schedule.go b/backend/internal/storage/snapshot_schedule.go new file mode 100644 index 0000000..52485a3 --- /dev/null +++ b/backend/internal/storage/snapshot_schedule.go @@ -0,0 +1,606 @@ +package storage + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + "sort" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" + "github.com/google/uuid" +) + +// SnapshotScheduleService handles snapshot schedule management +type SnapshotScheduleService struct { + db *database.DB + logger *logger.Logger + snapshotService *SnapshotService +} + +// NewSnapshotScheduleService creates a new snapshot schedule service +func NewSnapshotScheduleService(db *database.DB, log *logger.Logger, snapshotService *SnapshotService) *SnapshotScheduleService { + return &SnapshotScheduleService{ + db: db, + logger: log, + snapshotService: snapshotService, + } +} + +// SnapshotSchedule represents a scheduled snapshot task +type SnapshotSchedule struct { + ID string `json:"id"` + Name string `json:"name"` + Dataset string `json:"dataset"` + SnapshotNameTemplate string `json:"snapshot_name_template"` + ScheduleType string `json:"schedule_type"` // hourly, daily, weekly, monthly, cron + ScheduleConfig map[string]interface{} `json:"schedule_config"` + Recursive bool `json:"recursive"` + Enabled bool `json:"enabled"` + RetentionCount *int `json:"retention_count,omitempty"` + RetentionDays *int `json:"retention_days,omitempty"` + LastRunAt *time.Time `json:"last_run_at,omitempty"` + NextRunAt *time.Time `json:"next_run_at,omitempty"` + CreatedBy string `json:"created_by,omitempty"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +// CreateScheduleRequest represents a request to create a snapshot schedule +type CreateScheduleRequest struct { + Name string `json:"name" binding:"required"` + Dataset string `json:"dataset" binding:"required"` + SnapshotNameTemplate string `json:"snapshot_name_template" binding:"required"` + ScheduleType string `json:"schedule_type" binding:"required"` + ScheduleConfig map[string]interface{} `json:"schedule_config" binding:"required"` + Recursive bool `json:"recursive"` + RetentionCount *int `json:"retention_count"` + RetentionDays *int `json:"retention_days"` +} + +// ListSchedules lists all snapshot schedules +func (s *SnapshotScheduleService) ListSchedules(ctx context.Context) ([]*SnapshotSchedule, error) { + query := ` + SELECT id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + last_run_at, next_run_at, created_by, created_at, updated_at + FROM snapshot_schedules + ORDER BY created_at DESC + ` + + rows, err := s.db.QueryContext(ctx, query) + if err != nil { + return nil, fmt.Errorf("failed to query schedules: %w", err) + } + defer rows.Close() + + var schedules []*SnapshotSchedule + for rows.Next() { + schedule, err := s.scanSchedule(rows) + if err != nil { + s.logger.Error("Failed to scan schedule", "error", err) + continue + } + schedules = append(schedules, schedule) + } + + return schedules, rows.Err() +} + +// GetSchedule retrieves a schedule by ID +func (s *SnapshotScheduleService) GetSchedule(ctx context.Context, id string) (*SnapshotSchedule, error) { + query := ` + SELECT id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + last_run_at, next_run_at, created_by, created_at, updated_at + FROM snapshot_schedules + WHERE id = $1 + ` + + row := s.db.QueryRowContext(ctx, query, id) + schedule, err := s.scanScheduleRow(row) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("schedule not found") + } + return nil, fmt.Errorf("failed to get schedule: %w", err) + } + + return schedule, nil +} + +// CreateSchedule creates a new snapshot schedule +func (s *SnapshotScheduleService) CreateSchedule(ctx context.Context, req *CreateScheduleRequest, createdBy string) (*SnapshotSchedule, error) { + id := uuid.New().String() + + // Calculate next run time + nextRunAt, err := s.calculateNextRun(req.ScheduleType, req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to calculate next run time: %w", err) + } + + // Marshal schedule config to JSON + configJSON, err := json.Marshal(req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal schedule config: %w", err) + } + + query := ` + INSERT INTO snapshot_schedules ( + id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + next_run_at, created_by, created_at, updated_at + ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, NOW(), NOW()) + RETURNING id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + last_run_at, next_run_at, created_by, created_at, updated_at + ` + + row := s.db.QueryRowContext(ctx, query, + id, req.Name, req.Dataset, req.SnapshotNameTemplate, req.ScheduleType, + string(configJSON), req.Recursive, true, req.RetentionCount, req.RetentionDays, + nextRunAt, createdBy, + ) + + schedule, err := s.scanScheduleRow(row) + if err != nil { + return nil, fmt.Errorf("failed to create schedule: %w", err) + } + + s.logger.Info("Snapshot schedule created", "id", id, "name", req.Name, "dataset", req.Dataset) + return schedule, nil +} + +// UpdateSchedule updates an existing schedule +func (s *SnapshotScheduleService) UpdateSchedule(ctx context.Context, id string, req *CreateScheduleRequest) (*SnapshotSchedule, error) { + // Calculate next run time + nextRunAt, err := s.calculateNextRun(req.ScheduleType, req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to calculate next run time: %w", err) + } + + // Marshal schedule config to JSON + configJSON, err := json.Marshal(req.ScheduleConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal schedule config: %w", err) + } + + query := ` + UPDATE snapshot_schedules + SET name = $1, dataset = $2, snapshot_name_template = $3, schedule_type = $4, + schedule_config = $5, recursive = $6, retention_count = $7, retention_days = $8, + next_run_at = $9, updated_at = NOW() + WHERE id = $10 + RETURNING id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + last_run_at, next_run_at, created_by, created_at, updated_at + ` + + row := s.db.QueryRowContext(ctx, query, + req.Name, req.Dataset, req.SnapshotNameTemplate, req.ScheduleType, + string(configJSON), req.Recursive, req.RetentionCount, req.RetentionDays, + nextRunAt, id, + ) + + schedule, err := s.scanScheduleRow(row) + if err != nil { + if err == sql.ErrNoRows { + return nil, fmt.Errorf("schedule not found") + } + return nil, fmt.Errorf("failed to update schedule: %w", err) + } + + s.logger.Info("Snapshot schedule updated", "id", id) + return schedule, nil +} + +// DeleteSchedule deletes a schedule +func (s *SnapshotScheduleService) DeleteSchedule(ctx context.Context, id string) error { + query := `DELETE FROM snapshot_schedules WHERE id = $1` + result, err := s.db.ExecContext(ctx, query, id) + if err != nil { + return fmt.Errorf("failed to delete schedule: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + return fmt.Errorf("schedule not found") + } + + s.logger.Info("Snapshot schedule deleted", "id", id) + return nil +} + +// ToggleSchedule enables or disables a schedule +func (s *SnapshotScheduleService) ToggleSchedule(ctx context.Context, id string, enabled bool) error { + query := `UPDATE snapshot_schedules SET enabled = $1, updated_at = NOW() WHERE id = $2` + result, err := s.db.ExecContext(ctx, query, enabled, id) + if err != nil { + return fmt.Errorf("failed to toggle schedule: %w", err) + } + + rowsAffected, err := result.RowsAffected() + if err != nil { + return fmt.Errorf("failed to get rows affected: %w", err) + } + + if rowsAffected == 0 { + return fmt.Errorf("schedule not found") + } + + s.logger.Info("Snapshot schedule toggled", "id", id, "enabled", enabled) + return nil +} + +// scanScheduleRow scans a single schedule row +func (s *SnapshotScheduleService) scanScheduleRow(row *sql.Row) (*SnapshotSchedule, error) { + var schedule SnapshotSchedule + var configJSON string + var lastRunAt, nextRunAt sql.NullTime + var retentionCount, retentionDays sql.NullInt64 + var createdBy sql.NullString + + err := row.Scan( + &schedule.ID, &schedule.Name, &schedule.Dataset, &schedule.SnapshotNameTemplate, + &schedule.ScheduleType, &configJSON, &schedule.Recursive, &schedule.Enabled, + &retentionCount, &retentionDays, &lastRunAt, &nextRunAt, + &createdBy, &schedule.CreatedAt, &schedule.UpdatedAt, + ) + if err != nil { + return nil, err + } + + // Parse schedule config JSON + if err := json.Unmarshal([]byte(configJSON), &schedule.ScheduleConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal schedule config: %w", err) + } + + // Handle nullable fields + if lastRunAt.Valid { + schedule.LastRunAt = &lastRunAt.Time + } + if nextRunAt.Valid { + schedule.NextRunAt = &nextRunAt.Time + } + if retentionCount.Valid { + count := int(retentionCount.Int64) + schedule.RetentionCount = &count + } + if retentionDays.Valid { + days := int(retentionDays.Int64) + schedule.RetentionDays = &days + } + if createdBy.Valid { + schedule.CreatedBy = createdBy.String + } + + return &schedule, nil +} + +// scanSchedule scans a schedule from rows +func (s *SnapshotScheduleService) scanSchedule(rows *sql.Rows) (*SnapshotSchedule, error) { + var schedule SnapshotSchedule + var configJSON string + var lastRunAt, nextRunAt sql.NullTime + var retentionCount, retentionDays sql.NullInt64 + var createdBy sql.NullString + + err := rows.Scan( + &schedule.ID, &schedule.Name, &schedule.Dataset, &schedule.SnapshotNameTemplate, + &schedule.ScheduleType, &configJSON, &schedule.Recursive, &schedule.Enabled, + &retentionCount, &retentionDays, &lastRunAt, &nextRunAt, + &createdBy, &schedule.CreatedAt, &schedule.UpdatedAt, + ) + if err != nil { + return nil, err + } + + // Parse schedule config JSON + if err := json.Unmarshal([]byte(configJSON), &schedule.ScheduleConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal schedule config: %w", err) + } + + // Handle nullable fields + if lastRunAt.Valid { + schedule.LastRunAt = &lastRunAt.Time + } + if nextRunAt.Valid { + schedule.NextRunAt = &nextRunAt.Time + } + if retentionCount.Valid { + count := int(retentionCount.Int64) + schedule.RetentionCount = &count + } + if retentionDays.Valid { + days := int(retentionDays.Int64) + schedule.RetentionDays = &days + } + if createdBy.Valid { + schedule.CreatedBy = createdBy.String + } + + return &schedule, nil +} + +// calculateNextRun calculates the next run time based on schedule type and config +func (s *SnapshotScheduleService) calculateNextRun(scheduleType string, config map[string]interface{}) (*time.Time, error) { + now := time.Now() + + switch scheduleType { + case "hourly": + nextRun := now.Add(1 * time.Hour) + // Round to next hour + nextRun = nextRun.Truncate(time.Hour).Add(1 * time.Hour) + return &nextRun, nil + + case "daily": + timeStr, ok := config["time"].(string) + if !ok { + timeStr = "00:00" + } + // Parse time (HH:MM format) + hour, min := 0, 0 + fmt.Sscanf(timeStr, "%d:%d", &hour, &min) + nextRun := time.Date(now.Year(), now.Month(), now.Day(), hour, min, 0, 0, now.Location()) + if nextRun.Before(now) { + nextRun = nextRun.Add(24 * time.Hour) + } + return &nextRun, nil + + case "weekly": + dayOfWeek, ok := config["day"].(float64) // JSON numbers are float64 + if !ok { + dayOfWeek = 0 // Sunday + } + timeStr, ok := config["time"].(string) + if !ok { + timeStr = "00:00" + } + hour, min := 0, 0 + fmt.Sscanf(timeStr, "%d:%d", &hour, &min) + + // Calculate next occurrence + currentDay := int(now.Weekday()) + targetDay := int(dayOfWeek) + daysUntil := (targetDay - currentDay + 7) % 7 + if daysUntil == 0 { + // If same day, check if time has passed + today := time.Date(now.Year(), now.Month(), now.Day(), hour, min, 0, 0, now.Location()) + if today.Before(now) { + daysUntil = 7 + } + } + nextRun := time.Date(now.Year(), now.Month(), now.Day(), hour, min, 0, 0, now.Location()).AddDate(0, 0, daysUntil) + return &nextRun, nil + + case "monthly": + day, ok := config["day"].(float64) + if !ok { + day = 1 + } + timeStr, ok := config["time"].(string) + if !ok { + timeStr = "00:00" + } + hour, min := 0, 0 + fmt.Sscanf(timeStr, "%d:%d", &hour, &min) + + // Calculate next occurrence + nextRun := time.Date(now.Year(), now.Month(), int(day), hour, min, 0, 0, now.Location()) + if nextRun.Before(now) { + nextRun = nextRun.AddDate(0, 1, 0) + } + return &nextRun, nil + + case "cron": + // For cron, we'll use a simple implementation + // In production, you'd want to use a proper cron parser library + _, ok := config["cron"].(string) + if !ok { + return nil, fmt.Errorf("cron expression not found in config") + } + // Simple implementation: assume next run is in 1 hour + // TODO: Implement proper cron parsing + nextRun := now.Add(1 * time.Hour) + return &nextRun, nil + + default: + return nil, fmt.Errorf("unknown schedule type: %s", scheduleType) + } +} + +// GetDueSchedules retrieves all enabled schedules that are due to run +func (s *SnapshotScheduleService) GetDueSchedules(ctx context.Context) ([]*SnapshotSchedule, error) { + now := time.Now() + query := ` + SELECT id, name, dataset, snapshot_name_template, schedule_type, schedule_config, + recursive, enabled, retention_count, retention_days, + last_run_at, next_run_at, created_by, created_at, updated_at + FROM snapshot_schedules + WHERE enabled = true AND next_run_at <= $1 + ORDER BY next_run_at ASC + ` + + rows, err := s.db.QueryContext(ctx, query, now) + if err != nil { + return nil, fmt.Errorf("failed to query due schedules: %w", err) + } + defer rows.Close() + + var schedules []*SnapshotSchedule + for rows.Next() { + schedule, err := s.scanSchedule(rows) + if err != nil { + s.logger.Error("Failed to scan schedule", "error", err) + continue + } + schedules = append(schedules, schedule) + } + + return schedules, rows.Err() +} + +// ExecuteSchedule executes a snapshot schedule +func (s *SnapshotScheduleService) ExecuteSchedule(ctx context.Context, schedule *SnapshotSchedule) error { + now := time.Now() + + // Generate snapshot name from template + snapshotName := s.generateSnapshotName(schedule.SnapshotNameTemplate, now) + + // Create snapshot + if err := s.snapshotService.CreateSnapshot(ctx, schedule.Dataset, snapshotName, schedule.Recursive); err != nil { + return fmt.Errorf("failed to create snapshot: %w", err) + } + + s.logger.Info("Snapshot created from schedule", "schedule", schedule.Name, "snapshot", snapshotName, "dataset", schedule.Dataset) + + // Calculate next run time + nextRunAt, err := s.calculateNextRun(schedule.ScheduleType, schedule.ScheduleConfig) + if err != nil { + s.logger.Error("Failed to calculate next run time", "error", err, "schedule", schedule.Name) + // Set a default next run time (1 hour from now) if calculation fails + defaultNextRun := now.Add(1 * time.Hour) + nextRunAt = &defaultNextRun + } + + // Update schedule with last run time and next run time + query := ` + UPDATE snapshot_schedules + SET last_run_at = $1, next_run_at = $2, updated_at = NOW() + WHERE id = $3 + ` + if _, err := s.db.ExecContext(ctx, query, now, nextRunAt, schedule.ID); err != nil { + s.logger.Error("Failed to update schedule after execution", "error", err, "schedule", schedule.Name) + // Don't return error here - snapshot was created successfully + } + + // Handle retention + if err := s.handleRetention(ctx, schedule); err != nil { + s.logger.Error("Failed to handle retention", "error", err, "schedule", schedule.Name) + // Don't return error - retention is best effort + } + + return nil +} + +// generateSnapshotName generates a snapshot name from a template +func (s *SnapshotScheduleService) generateSnapshotName(template string, t time.Time) string { + // Replace common time format placeholders + name := template + name = strings.ReplaceAll(name, "%Y", t.Format("2006")) + name = strings.ReplaceAll(name, "%m", t.Format("01")) + name = strings.ReplaceAll(name, "%d", t.Format("02")) + name = strings.ReplaceAll(name, "%H", t.Format("15")) + name = strings.ReplaceAll(name, "%M", t.Format("04")) + name = strings.ReplaceAll(name, "%S", t.Format("05")) + name = strings.ReplaceAll(name, "%Y-%m-%d", t.Format("2006-01-02")) + name = strings.ReplaceAll(name, "%Y-%m-%d-%H%M", t.Format("2006-01-02-1504")) + name = strings.ReplaceAll(name, "%Y-%m-%d-%H%M%S", t.Format("2006-01-02-150405")) + + // If no placeholders were replaced, append timestamp + if name == template { + name = fmt.Sprintf("%s-%d", template, t.Unix()) + } + + return name +} + +// handleRetention handles snapshot retention based on schedule settings +func (s *SnapshotScheduleService) handleRetention(ctx context.Context, schedule *SnapshotSchedule) error { + // Get all snapshots for this dataset + snapshots, err := s.snapshotService.ListSnapshots(ctx, schedule.Dataset) + if err != nil { + return fmt.Errorf("failed to list snapshots: %w", err) + } + + // Filter snapshots that match this schedule's naming pattern + matchingSnapshots := make([]*Snapshot, 0) + for _, snapshot := range snapshots { + // Check if snapshot name matches the template pattern + if s.snapshotMatchesTemplate(snapshot.SnapshotName, schedule.SnapshotNameTemplate) { + matchingSnapshots = append(matchingSnapshots, snapshot) + } + } + + now := time.Now() + snapshotsToDelete := make([]*Snapshot, 0) + + // Apply retention_count if set + if schedule.RetentionCount != nil && *schedule.RetentionCount > 0 { + if len(matchingSnapshots) > *schedule.RetentionCount { + // Sort by creation time (oldest first) + sort.Slice(matchingSnapshots, func(i, j int) bool { + return matchingSnapshots[i].Created.Before(matchingSnapshots[j].Created) + }) + // Mark excess snapshots for deletion + excessCount := len(matchingSnapshots) - *schedule.RetentionCount + for i := 0; i < excessCount; i++ { + snapshotsToDelete = append(snapshotsToDelete, matchingSnapshots[i]) + } + } + } + + // Apply retention_days if set + if schedule.RetentionDays != nil && *schedule.RetentionDays > 0 { + cutoffTime := now.AddDate(0, 0, -*schedule.RetentionDays) + for _, snapshot := range matchingSnapshots { + if snapshot.Created.Before(cutoffTime) { + // Check if not already marked for deletion + alreadyMarked := false + for _, marked := range snapshotsToDelete { + if marked.ID == snapshot.ID { + alreadyMarked = true + break + } + } + if !alreadyMarked { + snapshotsToDelete = append(snapshotsToDelete, snapshot) + } + } + } + } + + // Delete snapshots + for _, snapshot := range snapshotsToDelete { + if err := s.snapshotService.DeleteSnapshot(ctx, snapshot.Name, schedule.Recursive); err != nil { + s.logger.Error("Failed to delete snapshot for retention", "error", err, "snapshot", snapshot.Name) + continue + } + s.logger.Info("Deleted snapshot for retention", "snapshot", snapshot.Name, "schedule", schedule.Name) + } + + return nil +} + +// snapshotMatchesTemplate checks if a snapshot name matches a template pattern +func (s *SnapshotScheduleService) snapshotMatchesTemplate(snapshotName, template string) bool { + if template == "" { + return false + } + + // Extract the base name from template (everything before the first %) + // This handles templates like "auto-%Y-%m-%d" or "daily-backup-%Y%m%d" + baseName := template + if idx := strings.Index(template, "%"); idx != -1 { + baseName = template[:idx] + } + + // If template starts with a placeholder, check if snapshot name matches the pattern + // by checking if it starts with any reasonable prefix + if baseName == "" { + // Template starts with placeholder - use a more lenient check + // Check if snapshot name matches common patterns + return true // Match all if template is just placeholders + } + + // Check if snapshot name starts with the base name + // This handles cases like template "auto-%Y-%m-%d" matching snapshot "auto-2024-01-15" + return strings.HasPrefix(snapshotName, baseName) +} diff --git a/backend/internal/storage/snapshot_schedule_worker.go b/backend/internal/storage/snapshot_schedule_worker.go new file mode 100644 index 0000000..1527fa2 --- /dev/null +++ b/backend/internal/storage/snapshot_schedule_worker.go @@ -0,0 +1,87 @@ +package storage + +import ( + "context" + "time" + + "github.com/atlasos/calypso/internal/common/database" + "github.com/atlasos/calypso/internal/common/logger" +) + +// SnapshotScheduleWorker handles periodic execution of snapshot schedules +type SnapshotScheduleWorker struct { + scheduleService *SnapshotScheduleService + logger *logger.Logger + interval time.Duration + stopCh chan struct{} +} + +// NewSnapshotScheduleWorker creates a new snapshot schedule worker +func NewSnapshotScheduleWorker(db *database.DB, log *logger.Logger, snapshotService *SnapshotService, interval time.Duration) *SnapshotScheduleWorker { + scheduleService := NewSnapshotScheduleService(db, log, snapshotService) + return &SnapshotScheduleWorker{ + scheduleService: scheduleService, + logger: log, + interval: interval, + stopCh: make(chan struct{}), + } +} + +// Start starts the snapshot schedule worker background service +func (w *SnapshotScheduleWorker) Start(ctx context.Context) { + w.logger.Info("Starting snapshot schedule worker", "interval", w.interval) + ticker := time.NewTicker(w.interval) + defer ticker.Stop() + + // Run initial check immediately + w.processSchedules(ctx) + + for { + select { + case <-ctx.Done(): + w.logger.Info("Snapshot schedule worker stopped") + return + case <-w.stopCh: + w.logger.Info("Snapshot schedule worker stopped") + return + case <-ticker.C: + w.processSchedules(ctx) + } + } +} + +// Stop stops the snapshot schedule worker service +func (w *SnapshotScheduleWorker) Stop() { + close(w.stopCh) +} + +// processSchedules processes all due snapshot schedules +func (w *SnapshotScheduleWorker) processSchedules(ctx context.Context) { + w.logger.Debug("Checking for due snapshot schedules") + + // Get all schedules that are due to run + schedules, err := w.scheduleService.GetDueSchedules(ctx) + if err != nil { + w.logger.Error("Failed to get due schedules", "error", err) + return + } + + if len(schedules) == 0 { + w.logger.Debug("No snapshot schedules due to run") + return + } + + w.logger.Info("Found due snapshot schedules", "count", len(schedules)) + + // Execute each schedule + for _, schedule := range schedules { + w.logger.Info("Executing snapshot schedule", "schedule", schedule.Name, "dataset", schedule.Dataset) + + if err := w.scheduleService.ExecuteSchedule(ctx, schedule); err != nil { + w.logger.Error("Failed to execute snapshot schedule", "error", err, "schedule", schedule.Name) + continue + } + + w.logger.Info("Successfully executed snapshot schedule", "schedule", schedule.Name) + } +} diff --git a/backend/internal/storage/zfs.go b/backend/internal/storage/zfs.go index 8c8242b..2b8c2d8 100644 --- a/backend/internal/storage/zfs.go +++ b/backend/internal/storage/zfs.go @@ -16,6 +16,16 @@ import ( "github.com/lib/pq" ) +// zfsCommand executes a ZFS command with sudo +func zfsCommand(ctx context.Context, args ...string) *exec.Cmd { + return exec.CommandContext(ctx, "sudo", append([]string{"zfs"}, args...)...) +} + +// zpoolCommand executes a ZPOOL command with sudo +func zpoolCommand(ctx context.Context, args ...string) *exec.Cmd { + return exec.CommandContext(ctx, "sudo", append([]string{"zpool"}, args...)...) +} + // ZFSService handles ZFS pool management type ZFSService struct { db *database.DB @@ -115,6 +125,10 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri var args []string args = append(args, "create", "-f") // -f to force creation + // Set default mountpoint to /opt/calypso/data/pool/ + mountPoint := fmt.Sprintf("/opt/calypso/data/pool/%s", name) + args = append(args, "-m", mountPoint) + // Note: compression is a filesystem property, not a pool property // We'll set it after pool creation using zfs set @@ -155,9 +169,15 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri args = append(args, disks...) } - // Execute zpool create - s.logger.Info("Creating ZFS pool", "name", name, "raid_level", raidLevel, "disks", disks, "args", args) - cmd := exec.CommandContext(ctx, "zpool", args...) + // Create mountpoint directory if it doesn't exist + if err := os.MkdirAll(mountPoint, 0755); err != nil { + return nil, fmt.Errorf("failed to create mountpoint directory %s: %w", mountPoint, err) + } + s.logger.Info("Created mountpoint directory", "path", mountPoint) + + // Execute zpool create (with sudo for permissions) + s.logger.Info("Creating ZFS pool", "name", name, "raid_level", raidLevel, "disks", disks, "mountpoint", mountPoint, "args", args) + cmd := zpoolCommand(ctx, args...) output, err := cmd.CombinedOutput() if err != nil { errorMsg := string(output) @@ -170,7 +190,7 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri // Set filesystem properties (compression, etc.) after pool creation // ZFS creates a root filesystem with the same name as the pool if compression != "" && compression != "off" { - cmd = exec.CommandContext(ctx, "zfs", "set", fmt.Sprintf("compression=%s", compression), name) + cmd = zfsCommand(ctx, "set", fmt.Sprintf("compression=%s", compression), name) output, err = cmd.CombinedOutput() if err != nil { s.logger.Warn("Failed to set compression property", "pool", name, "compression", compression, "error", string(output)) @@ -185,7 +205,7 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri if err != nil { // Try to destroy the pool if we can't get info s.logger.Warn("Failed to get pool info, attempting to destroy pool", "name", name, "error", err) - exec.CommandContext(ctx, "zpool", "destroy", "-f", name).Run() + zpoolCommand(ctx, "destroy", "-f", name).Run() return nil, fmt.Errorf("failed to get pool info after creation: %w", err) } @@ -219,7 +239,7 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri if err != nil { // Cleanup: destroy pool if database insert fails s.logger.Error("Failed to save pool to database, destroying pool", "name", name, "error", err) - exec.CommandContext(ctx, "zpool", "destroy", "-f", name).Run() + zpoolCommand(ctx, "destroy", "-f", name).Run() return nil, fmt.Errorf("failed to save pool to database: %w", err) } @@ -243,7 +263,7 @@ func (s *ZFSService) CreatePool(ctx context.Context, name string, raidLevel stri // getPoolInfo retrieves information about a ZFS pool func (s *ZFSService) getPoolInfo(ctx context.Context, poolName string) (*ZFSPool, error) { // Get pool size and used space - cmd := exec.CommandContext(ctx, "zpool", "list", "-H", "-o", "name,size,allocated", poolName) + cmd := zpoolCommand(ctx, "list", "-H", "-o", "name,size,allocated", poolName) output, err := cmd.CombinedOutput() if err != nil { errorMsg := string(output) @@ -322,7 +342,7 @@ func parseZFSSize(sizeStr string) (int64, error) { // getSpareDisks retrieves spare disks from zpool status func (s *ZFSService) getSpareDisks(ctx context.Context, poolName string) ([]string, error) { - cmd := exec.CommandContext(ctx, "zpool", "status", poolName) + cmd := zpoolCommand(ctx, "status", poolName) output, err := cmd.CombinedOutput() if err != nil { return nil, fmt.Errorf("failed to get pool status: %w", err) @@ -363,7 +383,7 @@ func (s *ZFSService) getSpareDisks(ctx context.Context, poolName string) ([]stri // getCompressRatio gets the compression ratio from ZFS func (s *ZFSService) getCompressRatio(ctx context.Context, poolName string) (float64, error) { - cmd := exec.CommandContext(ctx, "zfs", "get", "-H", "-o", "value", "compressratio", poolName) + cmd := zfsCommand(ctx, "get", "-H", "-o", "value", "compressratio", poolName) output, err := cmd.Output() if err != nil { return 1.0, err @@ -406,16 +426,20 @@ func (s *ZFSService) ListPools(ctx context.Context) ([]*ZFSPool, error) { for rows.Next() { var pool ZFSPool var description sql.NullString + var createdBy sql.NullString err := rows.Scan( &pool.ID, &pool.Name, &description, &pool.RaidLevel, pq.Array(&pool.Disks), &pool.SizeBytes, &pool.UsedBytes, &pool.Compression, &pool.Deduplication, &pool.AutoExpand, &pool.ScrubInterval, &pool.IsActive, &pool.HealthStatus, - &pool.CreatedAt, &pool.UpdatedAt, &pool.CreatedBy, + &pool.CreatedAt, &pool.UpdatedAt, &createdBy, ) if err != nil { - s.logger.Error("Failed to scan pool row", "error", err) + s.logger.Error("Failed to scan pool row", "error", err, "error_type", fmt.Sprintf("%T", err)) continue // Skip this pool instead of failing entire query } + if createdBy.Valid { + pool.CreatedBy = createdBy.String + } if description.Valid { pool.Description = description.String } @@ -501,7 +525,7 @@ func (s *ZFSService) DeletePool(ctx context.Context, poolID string) error { // Destroy ZFS pool with -f flag to force destroy (works for both empty and non-empty pools) // The -f flag is needed to destroy pools even if they have datasets or are in use s.logger.Info("Destroying ZFS pool", "pool", pool.Name) - cmd := exec.CommandContext(ctx, "zpool", "destroy", "-f", pool.Name) + cmd := zpoolCommand(ctx, "destroy", "-f", pool.Name) output, err := cmd.CombinedOutput() if err != nil { errorMsg := string(output) @@ -516,6 +540,15 @@ func (s *ZFSService) DeletePool(ctx context.Context, poolID string) error { s.logger.Info("ZFS pool destroyed successfully", "pool", pool.Name) } + // Remove mount point directory (default: /opt/calypso/data/pool/) + mountPoint := fmt.Sprintf("/opt/calypso/data/pool/%s", pool.Name) + if err := os.RemoveAll(mountPoint); err != nil { + s.logger.Warn("Failed to remove mount point directory", "mountpoint", mountPoint, "error", err) + // Don't fail pool deletion if mount point removal fails + } else { + s.logger.Info("Removed mount point directory", "mountpoint", mountPoint) + } + // Mark disks as unused for _, diskPath := range pool.Disks { _, err = s.db.ExecContext(ctx, @@ -550,7 +583,7 @@ func (s *ZFSService) AddSpareDisk(ctx context.Context, poolID string, diskPaths } // Verify pool exists in ZFS and check if disks are already spare - cmd := exec.CommandContext(ctx, "zpool", "status", pool.Name) + cmd := zpoolCommand(ctx, "status", pool.Name) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("pool %s does not exist in ZFS: %w", pool.Name, err) @@ -575,7 +608,7 @@ func (s *ZFSService) AddSpareDisk(ctx context.Context, poolID string, diskPaths // Execute zpool add s.logger.Info("Adding spare disks to ZFS pool", "pool", pool.Name, "disks", diskPaths) - cmd = exec.CommandContext(ctx, "zpool", args...) + cmd = zpoolCommand(ctx, args...) output, err = cmd.CombinedOutput() if err != nil { errorMsg := string(output) @@ -610,6 +643,7 @@ func (s *ZFSService) AddSpareDisk(ctx context.Context, poolID string, diskPaths // ZFSDataset represents a ZFS dataset type ZFSDataset struct { + ID string `json:"id"` Name string `json:"name"` Pool string `json:"pool"` Type string `json:"type"` // filesystem, volume, snapshot @@ -628,7 +662,7 @@ type ZFSDataset struct { func (s *ZFSService) ListDatasets(ctx context.Context, poolName string) ([]*ZFSDataset, error) { // Get datasets from database query := ` - SELECT name, pool_name, type, mount_point, + SELECT id, name, pool_name, type, mount_point, used_bytes, available_bytes, referenced_bytes, compression, deduplication, quota, reservation, created_at @@ -654,7 +688,7 @@ func (s *ZFSService) ListDatasets(ctx context.Context, poolName string) ([]*ZFSD var mountPoint sql.NullString err := rows.Scan( - &ds.Name, &ds.Pool, &ds.Type, &mountPoint, + &ds.ID, &ds.Name, &ds.Pool, &ds.Type, &mountPoint, &ds.UsedBytes, &ds.AvailableBytes, &ds.ReferencedBytes, &ds.Compression, &ds.Deduplication, &ds.Quota, &ds.Reservation, &ds.CreatedAt, @@ -696,10 +730,36 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre // Construct full dataset name fullName := poolName + "/" + req.Name - // For filesystem datasets, create mount directory if mount point is provided - if req.Type == "filesystem" && req.MountPoint != "" { - // Clean and validate mount point path - mountPath := filepath.Clean(req.MountPoint) + // Get pool mount point to validate dataset mount point is within pool directory + poolMountPoint := fmt.Sprintf("/opt/calypso/data/pool/%s", poolName) + var mountPath string + + // For filesystem datasets, validate and set mount point + if req.Type == "filesystem" { + if req.MountPoint != "" { + // User provided mount point - validate it's within pool directory + mountPath = filepath.Clean(req.MountPoint) + + // Check if mount point is within pool mount point directory + poolMountAbs, err := filepath.Abs(poolMountPoint) + if err != nil { + return nil, fmt.Errorf("failed to resolve pool mount point: %w", err) + } + + mountPathAbs, err := filepath.Abs(mountPath) + if err != nil { + return nil, fmt.Errorf("failed to resolve mount point: %w", err) + } + + // Check if mount path is within pool mount point directory + relPath, err := filepath.Rel(poolMountAbs, mountPathAbs) + if err != nil || strings.HasPrefix(relPath, "..") { + return nil, fmt.Errorf("mount point must be within pool directory: %s (pool mount: %s)", mountPath, poolMountPoint) + } + } else { + // No mount point provided - use default: /opt/calypso/data/pool/// + mountPath = filepath.Join(poolMountPoint, req.Name) + } // Check if directory already exists if info, err := os.Stat(mountPath); err == nil { @@ -748,14 +808,14 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre args = append(args, "-o", fmt.Sprintf("compression=%s", req.Compression)) } - // Set mount point if provided (only for filesystems, not volumes) - if req.Type == "filesystem" && req.MountPoint != "" { - args = append(args, "-o", fmt.Sprintf("mountpoint=%s", req.MountPoint)) + // Set mount point for filesystems (always set, either user-provided or default) + if req.Type == "filesystem" { + args = append(args, "-o", fmt.Sprintf("mountpoint=%s", mountPath)) } // Execute zfs create s.logger.Info("Creating ZFS dataset", "name", fullName, "type", req.Type) - cmd := exec.CommandContext(ctx, "zfs", args...) + cmd := zfsCommand(ctx, args...) output, err := cmd.CombinedOutput() if err != nil { errorMsg := string(output) @@ -765,7 +825,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre // Set quota if specified (for filesystems) if req.Type == "filesystem" && req.Quota > 0 { - quotaCmd := exec.CommandContext(ctx, "zfs", "set", fmt.Sprintf("quota=%d", req.Quota), fullName) + quotaCmd := zfsCommand(ctx, "set", fmt.Sprintf("quota=%d", req.Quota), fullName) if quotaOutput, err := quotaCmd.CombinedOutput(); err != nil { s.logger.Warn("Failed to set quota", "dataset", fullName, "error", err, "output", string(quotaOutput)) } @@ -773,7 +833,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre // Set reservation if specified if req.Reservation > 0 { - resvCmd := exec.CommandContext(ctx, "zfs", "set", fmt.Sprintf("reservation=%d", req.Reservation), fullName) + resvCmd := zfsCommand(ctx, "set", fmt.Sprintf("reservation=%d", req.Reservation), fullName) if resvOutput, err := resvCmd.CombinedOutput(); err != nil { s.logger.Warn("Failed to set reservation", "dataset", fullName, "error", err, "output", string(resvOutput)) } @@ -785,30 +845,30 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre if err != nil { s.logger.Error("Failed to get pool ID", "pool", poolName, "error", err) // Try to destroy the dataset if we can't save to database - exec.CommandContext(ctx, "zfs", "destroy", "-r", fullName).Run() + zfsCommand(ctx, "destroy", "-r", fullName).Run() return nil, fmt.Errorf("failed to get pool ID: %w", err) } // Get dataset info from ZFS to save to database - cmd = exec.CommandContext(ctx, "zfs", "list", "-H", "-o", "name,used,avail,refer,compress,dedup,quota,reservation,mountpoint", fullName) + cmd = zfsCommand(ctx, "list", "-H", "-o", "name,used,avail,refer,compress,dedup,quota,reservation,mountpoint", fullName) output, err = cmd.CombinedOutput() if err != nil { s.logger.Error("Failed to get dataset info", "name", fullName, "error", err) // Try to destroy the dataset if we can't get info - exec.CommandContext(ctx, "zfs", "destroy", "-r", fullName).Run() + zfsCommand(ctx, "destroy", "-r", fullName).Run() return nil, fmt.Errorf("failed to get dataset info: %w", err) } // Parse dataset info lines := strings.TrimSpace(string(output)) if lines == "" { - exec.CommandContext(ctx, "zfs", "destroy", "-r", fullName).Run() + zfsCommand(ctx, "destroy", "-r", fullName).Run() return nil, fmt.Errorf("dataset not found after creation") } fields := strings.Fields(lines) if len(fields) < 9 { - exec.CommandContext(ctx, "zfs", "destroy", "-r", fullName).Run() + zfsCommand(ctx, "destroy", "-r", fullName).Run() return nil, fmt.Errorf("invalid dataset info format") } @@ -823,7 +883,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre // Determine dataset type datasetType := req.Type - typeCmd := exec.CommandContext(ctx, "zfs", "get", "-H", "-o", "value", "type", fullName) + typeCmd := zfsCommand(ctx, "get", "-H", "-o", "value", "type", fullName) if typeOutput, err := typeCmd.Output(); err == nil { volType := strings.TrimSpace(string(typeOutput)) if volType == "volume" { @@ -837,7 +897,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre quota := int64(-1) if datasetType == "volume" { // For volumes, get volsize - volsizeCmd := exec.CommandContext(ctx, "zfs", "get", "-H", "-o", "value", "volsize", fullName) + volsizeCmd := zfsCommand(ctx, "get", "-H", "-o", "value", "volsize", fullName) if volsizeOutput, err := volsizeCmd.Output(); err == nil { volsizeStr := strings.TrimSpace(string(volsizeOutput)) if volsizeStr != "-" && volsizeStr != "none" { @@ -867,7 +927,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre // Get creation time createdAt := time.Now() - creationCmd := exec.CommandContext(ctx, "zfs", "get", "-H", "-o", "value", "creation", fullName) + creationCmd := zfsCommand(ctx, "get", "-H", "-o", "value", "creation", fullName) if creationOutput, err := creationCmd.Output(); err == nil { creationStr := strings.TrimSpace(string(creationOutput)) if t, err := time.Parse("Mon Jan 2 15:04:05 2006", creationStr); err == nil { @@ -899,7 +959,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre if err != nil { s.logger.Error("Failed to save dataset to database", "name", fullName, "error", err) // Try to destroy the dataset if we can't save to database - exec.CommandContext(ctx, "zfs", "destroy", "-r", fullName).Run() + zfsCommand(ctx, "destroy", "-r", fullName).Run() return nil, fmt.Errorf("failed to save dataset to database: %w", err) } @@ -927,7 +987,7 @@ func (s *ZFSService) CreateDataset(ctx context.Context, poolName string, req Cre func (s *ZFSService) DeleteDataset(ctx context.Context, datasetName string) error { // Check if dataset exists and get its mount point before deletion var mountPoint string - cmd := exec.CommandContext(ctx, "zfs", "list", "-H", "-o", "name,mountpoint", datasetName) + cmd := zfsCommand(ctx, "list", "-H", "-o", "name,mountpoint", datasetName) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("dataset %s does not exist: %w", datasetName, err) @@ -946,7 +1006,7 @@ func (s *ZFSService) DeleteDataset(ctx context.Context, datasetName string) erro // Get dataset type to determine if we should clean up mount directory var datasetType string - typeCmd := exec.CommandContext(ctx, "zfs", "get", "-H", "-o", "value", "type", datasetName) + typeCmd := zfsCommand(ctx, "get", "-H", "-o", "value", "type", datasetName) typeOutput, err := typeCmd.Output() if err == nil { datasetType = strings.TrimSpace(string(typeOutput)) @@ -969,7 +1029,7 @@ func (s *ZFSService) DeleteDataset(ctx context.Context, datasetName string) erro // Delete the dataset from ZFS (use -r for recursive to delete children) s.logger.Info("Deleting ZFS dataset", "name", datasetName, "mountpoint", mountPoint) - cmd = exec.CommandContext(ctx, "zfs", "destroy", "-r", datasetName) + cmd = zfsCommand(ctx, "destroy", "-r", datasetName) output, err = cmd.CombinedOutput() if err != nil { errorMsg := string(output) diff --git a/backend/internal/storage/zfs_pool_monitor.go b/backend/internal/storage/zfs_pool_monitor.go index 255f676..281f607 100644 --- a/backend/internal/storage/zfs_pool_monitor.go +++ b/backend/internal/storage/zfs_pool_monitor.go @@ -2,6 +2,7 @@ package storage import ( "context" + "fmt" "os/exec" "regexp" "strconv" @@ -98,11 +99,17 @@ type PoolInfo struct { func (m *ZFSPoolMonitor) getSystemPools(ctx context.Context) (map[string]PoolInfo, error) { pools := make(map[string]PoolInfo) - // Get pool list - cmd := exec.CommandContext(ctx, "zpool", "list", "-H", "-o", "name,size,alloc,free,health") - output, err := cmd.Output() + // Get pool list (with sudo for permissions) + cmd := exec.CommandContext(ctx, "sudo", "zpool", "list", "-H", "-o", "name,size,alloc,free,health") + output, err := cmd.CombinedOutput() if err != nil { - return nil, err + // If no pools exist, zpool list returns exit code 1 but that's OK + // Check if output is empty (no pools) vs actual error + outputStr := strings.TrimSpace(string(output)) + if outputStr == "" || strings.Contains(outputStr, "no pools available") { + return pools, nil // No pools, return empty map (not an error) + } + return nil, fmt.Errorf("zpool list failed: %w, output: %s", err, outputStr) } lines := strings.Split(strings.TrimSpace(string(output)), "\n") diff --git a/backend/internal/system/handler.go b/backend/internal/system/handler.go index 04fd9bd..6500595 100644 --- a/backend/internal/system/handler.go +++ b/backend/internal/system/handler.go @@ -3,6 +3,7 @@ package system import ( "net/http" "strconv" + "time" "github.com/atlasos/calypso/internal/common/logger" "github.com/atlasos/calypso/internal/tasks" @@ -131,3 +132,163 @@ func (h *Handler) ListNetworkInterfaces(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"interfaces": interfaces}) } + +// GetManagementIPAddress returns the management IP address +func (h *Handler) GetManagementIPAddress(c *gin.Context) { + ip, err := h.service.GetManagementIPAddress(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to get management IP address", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get management IP address"}) + return + } + + c.JSON(http.StatusOK, gin.H{"ip_address": ip}) +} + +// SaveNTPSettings saves NTP configuration to the OS +func (h *Handler) SaveNTPSettings(c *gin.Context) { + var settings NTPSettings + if err := c.ShouldBindJSON(&settings); err != nil { + h.logger.Error("Invalid request body", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request body"}) + return + } + + // Validate timezone + if settings.Timezone == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "timezone is required"}) + return + } + + // Validate NTP servers + if len(settings.NTPServers) == 0 { + c.JSON(http.StatusBadRequest, gin.H{"error": "at least one NTP server is required"}) + return + } + + if err := h.service.SaveNTPSettings(c.Request.Context(), settings); err != nil { + h.logger.Error("Failed to save NTP settings", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"message": "NTP settings saved successfully"}) +} + +// GetNTPSettings retrieves current NTP configuration +func (h *Handler) GetNTPSettings(c *gin.Context) { + settings, err := h.service.GetNTPSettings(c.Request.Context()) + if err != nil { + h.logger.Error("Failed to get NTP settings", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get NTP settings"}) + return + } + + c.JSON(http.StatusOK, gin.H{"settings": settings}) +} + +// UpdateNetworkInterface updates a network interface configuration +func (h *Handler) UpdateNetworkInterface(c *gin.Context) { + ifaceName := c.Param("name") + if ifaceName == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "interface name is required"}) + return + } + + var req struct { + IPAddress string `json:"ip_address" binding:"required"` + Subnet string `json:"subnet" binding:"required"` + Gateway string `json:"gateway,omitempty"` + DNS1 string `json:"dns1,omitempty"` + DNS2 string `json:"dns2,omitempty"` + Role string `json:"role,omitempty"` + } + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid request body", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request body"}) + return + } + + // Convert to service request + serviceReq := UpdateNetworkInterfaceRequest{ + IPAddress: req.IPAddress, + Subnet: req.Subnet, + Gateway: req.Gateway, + DNS1: req.DNS1, + DNS2: req.DNS2, + Role: req.Role, + } + + updatedIface, err := h.service.UpdateNetworkInterface(c.Request.Context(), ifaceName, serviceReq) + if err != nil { + h.logger.Error("Failed to update network interface", "interface", ifaceName, "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, gin.H{"interface": updatedIface}) +} + +// GetSystemLogs retrieves recent system logs +func (h *Handler) GetSystemLogs(c *gin.Context) { + limitStr := c.DefaultQuery("limit", "30") + limit, err := strconv.Atoi(limitStr) + if err != nil || limit <= 0 || limit > 100 { + limit = 30 + } + + logs, err := h.service.GetSystemLogs(c.Request.Context(), limit) + if err != nil { + h.logger.Error("Failed to get system logs", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get system logs"}) + return + } + + c.JSON(http.StatusOK, gin.H{"logs": logs}) +} + +// GetNetworkThroughput retrieves network throughput data from RRD +func (h *Handler) GetNetworkThroughput(c *gin.Context) { + // Default to last 5 minutes + durationStr := c.DefaultQuery("duration", "5m") + duration, err := time.ParseDuration(durationStr) + if err != nil { + duration = 5 * time.Minute + } + + data, err := h.service.GetNetworkThroughput(c.Request.Context(), duration) + if err != nil { + h.logger.Error("Failed to get network throughput", "error", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get network throughput"}) + return + } + + c.JSON(http.StatusOK, gin.H{"data": data}) +} + +// ExecuteCommand executes a shell command +func (h *Handler) ExecuteCommand(c *gin.Context) { + var req struct { + Command string `json:"command" binding:"required"` + Service string `json:"service,omitempty"` // Optional: system, scst, storage, backup, tape + } + + if err := c.ShouldBindJSON(&req); err != nil { + h.logger.Error("Invalid request body", "error", err) + c.JSON(http.StatusBadRequest, gin.H{"error": "command is required"}) + return + } + + // Execute command based on service context + output, err := h.service.ExecuteCommand(c.Request.Context(), req.Command, req.Service) + if err != nil { + h.logger.Error("Failed to execute command", "error", err, "command", req.Command, "service", req.Service) + c.JSON(http.StatusInternalServerError, gin.H{ + "error": err.Error(), + "output": output, // Include output even on error + }) + return + } + + c.JSON(http.StatusOK, gin.H{"output": output}) +} diff --git a/backend/internal/system/rrd.go b/backend/internal/system/rrd.go new file mode 100644 index 0000000..94d228b --- /dev/null +++ b/backend/internal/system/rrd.go @@ -0,0 +1,292 @@ +package system + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "time" + + "github.com/atlasos/calypso/internal/common/logger" +) + +// RRDService handles RRD database operations for network monitoring +type RRDService struct { + logger *logger.Logger + rrdDir string + interfaceName string +} + +// NewRRDService creates a new RRD service +func NewRRDService(log *logger.Logger, rrdDir string, interfaceName string) *RRDService { + return &RRDService{ + logger: log, + rrdDir: rrdDir, + interfaceName: interfaceName, + } +} + +// NetworkStats represents network interface statistics +type NetworkStats struct { + Interface string `json:"interface"` + RxBytes uint64 `json:"rx_bytes"` + TxBytes uint64 `json:"tx_bytes"` + RxPackets uint64 `json:"rx_packets"` + TxPackets uint64 `json:"tx_packets"` + Timestamp time.Time `json:"timestamp"` +} + +// GetNetworkStats reads network statistics from /proc/net/dev +func (r *RRDService) GetNetworkStats(ctx context.Context, interfaceName string) (*NetworkStats, error) { + data, err := os.ReadFile("/proc/net/dev") + if err != nil { + return nil, fmt.Errorf("failed to read /proc/net/dev: %w", err) + } + + lines := strings.Split(string(data), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + if !strings.HasPrefix(line, interfaceName+":") { + continue + } + + // Parse line: interface: rx_bytes rx_packets ... tx_bytes tx_packets ... + parts := strings.Fields(line) + if len(parts) < 17 { + continue + } + + // Extract statistics + // Format: interface: rx_bytes rx_packets rx_errs rx_drop ... tx_bytes tx_packets ... + rxBytes, err := strconv.ParseUint(parts[1], 10, 64) + if err != nil { + continue + } + rxPackets, err := strconv.ParseUint(parts[2], 10, 64) + if err != nil { + continue + } + txBytes, err := strconv.ParseUint(parts[9], 10, 64) + if err != nil { + continue + } + txPackets, err := strconv.ParseUint(parts[10], 10, 64) + if err != nil { + continue + } + + return &NetworkStats{ + Interface: interfaceName, + RxBytes: rxBytes, + TxBytes: txBytes, + RxPackets: rxPackets, + TxPackets: txPackets, + Timestamp: time.Now(), + }, nil + } + + return nil, fmt.Errorf("interface %s not found in /proc/net/dev", interfaceName) +} + +// InitializeRRD creates RRD database if it doesn't exist +func (r *RRDService) InitializeRRD(ctx context.Context) error { + // Ensure RRD directory exists + if err := os.MkdirAll(r.rrdDir, 0755); err != nil { + return fmt.Errorf("failed to create RRD directory: %w", err) + } + + rrdFile := filepath.Join(r.rrdDir, fmt.Sprintf("network-%s.rrd", r.interfaceName)) + + // Check if RRD file already exists + if _, err := os.Stat(rrdFile); err == nil { + r.logger.Info("RRD file already exists", "file", rrdFile) + return nil + } + + // Create RRD database + // Use COUNTER type to track cumulative bytes, RRD will calculate rate automatically + // DS:inbound:COUNTER:20:0:U - inbound cumulative bytes, 20s heartbeat + // DS:outbound:COUNTER:20:0:U - outbound cumulative bytes, 20s heartbeat + // RRA:AVERAGE:0.5:1:600 - 1 sample per step, 600 steps (100 minutes at 10s interval) + // RRA:AVERAGE:0.5:6:700 - 6 samples per step, 700 steps (11.6 hours at 1min interval) + // RRA:AVERAGE:0.5:60:730 - 60 samples per step, 730 steps (5 days at 1hour interval) + // RRA:MAX:0.5:1:600 - Max values for same intervals + // RRA:MAX:0.5:6:700 + // RRA:MAX:0.5:60:730 + cmd := exec.CommandContext(ctx, "rrdtool", "create", rrdFile, + "--step", "10", // 10 second step + "DS:inbound:COUNTER:20:0:U", // Inbound cumulative bytes, 20s heartbeat + "DS:outbound:COUNTER:20:0:U", // Outbound cumulative bytes, 20s heartbeat + "RRA:AVERAGE:0.5:1:600", // 10s resolution, 100 minutes + "RRA:AVERAGE:0.5:6:700", // 1min resolution, 11.6 hours + "RRA:AVERAGE:0.5:60:730", // 1hour resolution, 5 days + "RRA:MAX:0.5:1:600", // Max values + "RRA:MAX:0.5:6:700", + "RRA:MAX:0.5:60:730", + ) + + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to create RRD: %s: %w", string(output), err) + } + + r.logger.Info("RRD database created", "file", rrdFile) + return nil +} + +// UpdateRRD updates RRD database with new network statistics +func (r *RRDService) UpdateRRD(ctx context.Context, stats *NetworkStats) error { + rrdFile := filepath.Join(r.rrdDir, fmt.Sprintf("network-%s.rrd", stats.Interface)) + + // Update with cumulative byte counts (COUNTER type) + // RRD will automatically calculate the rate (bytes per second) + cmd := exec.CommandContext(ctx, "rrdtool", "update", rrdFile, + fmt.Sprintf("%d:%d:%d", stats.Timestamp.Unix(), stats.RxBytes, stats.TxBytes), + ) + + output, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("failed to update RRD: %s: %w", string(output), err) + } + + return nil +} + +// FetchRRDData fetches data from RRD database for graphing +func (r *RRDService) FetchRRDData(ctx context.Context, startTime time.Time, endTime time.Time, resolution string) ([]NetworkDataPoint, error) { + rrdFile := filepath.Join(r.rrdDir, fmt.Sprintf("network-%s.rrd", r.interfaceName)) + + // Check if RRD file exists + if _, err := os.Stat(rrdFile); os.IsNotExist(err) { + return []NetworkDataPoint{}, nil + } + + // Fetch data using rrdtool fetch + // Use AVERAGE consolidation with appropriate resolution + cmd := exec.CommandContext(ctx, "rrdtool", "fetch", rrdFile, + "AVERAGE", + "--start", fmt.Sprintf("%d", startTime.Unix()), + "--end", fmt.Sprintf("%d", endTime.Unix()), + "--resolution", resolution, + ) + + output, err := cmd.CombinedOutput() + if err != nil { + return nil, fmt.Errorf("failed to fetch RRD data: %s: %w", string(output), err) + } + + // Parse rrdtool fetch output + // Format: + // inbound outbound + // 1234567890: 1.2345678901e+06 2.3456789012e+06 + points := []NetworkDataPoint{} + lines := strings.Split(string(output), "\n") + + // Skip header lines + dataStart := false + for _, line := range lines { + line = strings.TrimSpace(line) + if line == "" { + continue + } + + // Check if this is the data section + if strings.Contains(line, "inbound") && strings.Contains(line, "outbound") { + dataStart = true + continue + } + + if !dataStart { + continue + } + + // Parse data line: timestamp: inbound_value outbound_value + parts := strings.Fields(line) + if len(parts) < 3 { + continue + } + + // Parse timestamp + timestampStr := strings.TrimSuffix(parts[0], ":") + timestamp, err := strconv.ParseInt(timestampStr, 10, 64) + if err != nil { + continue + } + + // Parse inbound (bytes per second from COUNTER, convert to Mbps) + inboundStr := parts[1] + inbound, err := strconv.ParseFloat(inboundStr, 64) + if err != nil || inbound < 0 { + // Skip NaN or negative values + continue + } + // Convert bytes per second to Mbps (bytes/s * 8 / 1000000) + inboundMbps := inbound * 8 / 1000000 + + // Parse outbound + outboundStr := parts[2] + outbound, err := strconv.ParseFloat(outboundStr, 64) + if err != nil || outbound < 0 { + // Skip NaN or negative values + continue + } + outboundMbps := outbound * 8 / 1000000 + + // Format time as MM:SS + t := time.Unix(timestamp, 0) + timeStr := fmt.Sprintf("%02d:%02d", t.Minute(), t.Second()) + + points = append(points, NetworkDataPoint{ + Time: timeStr, + Inbound: inboundMbps, + Outbound: outboundMbps, + }) + } + + return points, nil +} + +// NetworkDataPoint represents a single data point for graphing +type NetworkDataPoint struct { + Time string `json:"time"` + Inbound float64 `json:"inbound"` // Mbps + Outbound float64 `json:"outbound"` // Mbps +} + +// StartCollector starts a background goroutine to periodically collect and update RRD +func (r *RRDService) StartCollector(ctx context.Context, interval time.Duration) error { + // Initialize RRD if needed + if err := r.InitializeRRD(ctx); err != nil { + return fmt.Errorf("failed to initialize RRD: %w", err) + } + + go func() { + ticker := time.NewTicker(interval) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + // Get current stats + stats, err := r.GetNetworkStats(ctx, r.interfaceName) + if err != nil { + r.logger.Warn("Failed to get network stats", "error", err) + continue + } + + // Update RRD with cumulative byte counts + // RRD COUNTER type will automatically calculate rate + if err := r.UpdateRRD(ctx, stats); err != nil { + r.logger.Warn("Failed to update RRD", "error", err) + } + } + } + }() + + return nil +} diff --git a/backend/internal/system/service.go b/backend/internal/system/service.go index 8a55345..34038f0 100644 --- a/backend/internal/system/service.go +++ b/backend/internal/system/service.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "os" "os/exec" "strings" "time" @@ -11,18 +12,98 @@ import ( "github.com/atlasos/calypso/internal/common/logger" ) +// NTPSettings represents NTP configuration +type NTPSettings struct { + Timezone string `json:"timezone"` + NTPServers []string `json:"ntp_servers"` +} + // Service handles system management operations type Service struct { - logger *logger.Logger + logger *logger.Logger + rrdService *RRDService +} + +// detectPrimaryInterface detects the primary network interface (first non-loopback with IP) +func detectPrimaryInterface(ctx context.Context) string { + // Try to get default route interface + cmd := exec.CommandContext(ctx, "ip", "route", "show", "default") + output, err := cmd.Output() + if err == nil { + lines := strings.Split(string(output), "\n") + for _, line := range lines { + if strings.Contains(line, "dev ") { + parts := strings.Fields(line) + for i, part := range parts { + if part == "dev" && i+1 < len(parts) { + iface := parts[i+1] + if iface != "lo" { + return iface + } + } + } + } + } + } + + // Fallback: get first non-loopback interface with IP + cmd = exec.CommandContext(ctx, "ip", "-4", "addr", "show") + output, err = cmd.Output() + if err == nil { + lines := strings.Split(string(output), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + // Look for interface name line (e.g., "2: ens18: 0 && line[0] >= '0' && line[0] <= '9' && strings.Contains(line, ":") { + parts := strings.Fields(line) + if len(parts) >= 2 { + iface := strings.TrimSuffix(parts[1], ":") + if iface != "" && iface != "lo" { + // Check if this interface has an IP (next lines will have "inet") + // For simplicity, return first non-loopback interface + return iface + } + } + } + } + } + + // Final fallback + return "eth0" } // NewService creates a new system service func NewService(log *logger.Logger) *Service { + // Initialize RRD service for network monitoring + rrdDir := "/var/lib/calypso/rrd" + + // Auto-detect primary interface + ctx := context.Background() + interfaceName := detectPrimaryInterface(ctx) + log.Info("Detected primary network interface", "interface", interfaceName) + + rrdService := NewRRDService(log, rrdDir, interfaceName) + return &Service{ - logger: log, + logger: log, + rrdService: rrdService, } } +// StartNetworkMonitoring starts the RRD collector for network monitoring +func (s *Service) StartNetworkMonitoring(ctx context.Context) error { + return s.rrdService.StartCollector(ctx, 10*time.Second) +} + +// GetNetworkThroughput fetches network throughput data from RRD +func (s *Service) GetNetworkThroughput(ctx context.Context, duration time.Duration) ([]NetworkDataPoint, error) { + endTime := time.Now() + startTime := endTime.Add(-duration) + + // Use 10 second resolution for recent data + return s.rrdService.FetchRRDData(ctx, startTime, endTime, "10") +} + // ServiceStatus represents a systemd service status type ServiceStatus struct { Name string `json:"name"` @@ -35,31 +116,37 @@ type ServiceStatus struct { // GetServiceStatus retrieves the status of a systemd service func (s *Service) GetServiceStatus(ctx context.Context, serviceName string) (*ServiceStatus, error) { - cmd := exec.CommandContext(ctx, "systemctl", "show", serviceName, - "--property=ActiveState,SubState,LoadState,Description,ActiveEnterTimestamp", - "--value", "--no-pager") - output, err := cmd.Output() - if err != nil { - return nil, fmt.Errorf("failed to get service status: %w", err) - } - - lines := strings.Split(strings.TrimSpace(string(output)), "\n") - if len(lines) < 4 { - return nil, fmt.Errorf("invalid service status output") - } - status := &ServiceStatus{ - Name: serviceName, - ActiveState: strings.TrimSpace(lines[0]), - SubState: strings.TrimSpace(lines[1]), - LoadState: strings.TrimSpace(lines[2]), - Description: strings.TrimSpace(lines[3]), + Name: serviceName, } - // Parse timestamp if available - if len(lines) > 4 && lines[4] != "" { - if t, err := time.Parse("Mon 2006-01-02 15:04:05 MST", strings.TrimSpace(lines[4])); err == nil { - status.Since = t + // Get each property individually to ensure correct parsing + properties := map[string]*string{ + "ActiveState": &status.ActiveState, + "SubState": &status.SubState, + "LoadState": &status.LoadState, + "Description": &status.Description, + } + + for prop, target := range properties { + cmd := exec.CommandContext(ctx, "systemctl", "show", serviceName, "--property", prop, "--value", "--no-pager") + output, err := cmd.Output() + if err != nil { + s.logger.Warn("Failed to get property", "service", serviceName, "property", prop, "error", err) + continue + } + *target = strings.TrimSpace(string(output)) + } + + // Get timestamp if available + cmd := exec.CommandContext(ctx, "systemctl", "show", serviceName, "--property", "ActiveEnterTimestamp", "--value", "--no-pager") + output, err := cmd.Output() + if err == nil { + timestamp := strings.TrimSpace(string(output)) + if timestamp != "" { + if t, err := time.Parse("Mon 2006-01-02 15:04:05 MST", timestamp); err == nil { + status.Since = t + } } } @@ -69,10 +156,15 @@ func (s *Service) GetServiceStatus(ctx context.Context, serviceName string) (*Se // ListServices lists all Calypso-related services func (s *Service) ListServices(ctx context.Context) ([]ServiceStatus, error) { services := []string{ + "ssh", + "sshd", + "smbd", + "iscsi-scst", + "nfs-server", + "nfs", + "mhvtl", "calypso-api", "scst", - "iscsi-scst", - "mhvtl", "postgresql", } @@ -128,6 +220,108 @@ func (s *Service) GetJournalLogs(ctx context.Context, serviceName string, lines return logs, nil } +// SystemLogEntry represents a parsed system log entry +type SystemLogEntry struct { + Time string `json:"time"` + Level string `json:"level"` + Source string `json:"source"` + Message string `json:"message"` +} + +// GetSystemLogs retrieves recent system logs from journalctl +func (s *Service) GetSystemLogs(ctx context.Context, limit int) ([]SystemLogEntry, error) { + if limit <= 0 || limit > 100 { + limit = 30 // Default to 30 logs + } + + cmd := exec.CommandContext(ctx, "journalctl", + "-n", fmt.Sprintf("%d", limit), + "-o", "json", + "--no-pager", + "--since", "1 hour ago") // Only get logs from last hour + output, err := cmd.Output() + if err != nil { + return nil, fmt.Errorf("failed to get system logs: %w", err) + } + + var logs []SystemLogEntry + linesOutput := strings.Split(strings.TrimSpace(string(output)), "\n") + for _, line := range linesOutput { + if line == "" { + continue + } + var logEntry map[string]interface{} + if err := json.Unmarshal([]byte(line), &logEntry); err != nil { + continue + } + + // Parse timestamp (__REALTIME_TIMESTAMP is in microseconds) + var timeStr string + if timestamp, ok := logEntry["__REALTIME_TIMESTAMP"].(float64); ok { + // Convert microseconds to nanoseconds for time.Unix (1 microsecond = 1000 nanoseconds) + t := time.Unix(0, int64(timestamp)*1000) + timeStr = t.Format("15:04:05") + } else if timestamp, ok := logEntry["_SOURCE_REALTIME_TIMESTAMP"].(float64); ok { + t := time.Unix(0, int64(timestamp)*1000) + timeStr = t.Format("15:04:05") + } else { + timeStr = time.Now().Format("15:04:05") + } + + // Parse log level (priority) + level := "INFO" + if priority, ok := logEntry["PRIORITY"].(float64); ok { + switch int(priority) { + case 0: // emerg + level = "EMERG" + case 1, 2, 3: // alert, crit, err + level = "ERROR" + case 4: // warning + level = "WARN" + case 5: // notice + level = "NOTICE" + case 6: // info + level = "INFO" + case 7: // debug + level = "DEBUG" + } + } + + // Parse source (systemd unit or syslog identifier) + source := "system" + if unit, ok := logEntry["_SYSTEMD_UNIT"].(string); ok && unit != "" { + // Remove .service suffix if present + source = strings.TrimSuffix(unit, ".service") + } else if ident, ok := logEntry["SYSLOG_IDENTIFIER"].(string); ok && ident != "" { + source = ident + } else if comm, ok := logEntry["_COMM"].(string); ok && comm != "" { + source = comm + } + + // Parse message + message := "" + if msg, ok := logEntry["MESSAGE"].(string); ok { + message = msg + } + + if message != "" { + logs = append(logs, SystemLogEntry{ + Time: timeStr, + Level: level, + Source: source, + Message: message, + }) + } + } + + // Reverse to get newest first + for i, j := 0, len(logs)-1; i < j; i, j = i+1, j-1 { + logs[i], logs[j] = logs[j], logs[i] + } + + return logs, nil +} + // GenerateSupportBundle generates a diagnostic support bundle func (s *Service) GenerateSupportBundle(ctx context.Context, outputPath string) error { // Create bundle directory @@ -183,6 +377,9 @@ type NetworkInterface struct { Status string `json:"status"` // "Connected" or "Down" Speed string `json:"speed"` // e.g., "10 Gbps", "1 Gbps" Role string `json:"role"` // "Management", "ISCSI", or empty + Gateway string `json:"gateway,omitempty"` + DNS1 string `json:"dns1,omitempty"` + DNS2 string `json:"dns2,omitempty"` } // ListNetworkInterfaces lists all network interfaces @@ -297,6 +494,103 @@ func (s *Service) ListNetworkInterfaces(ctx context.Context) ([]NetworkInterface } } + // Get default gateway for each interface + cmd = exec.CommandContext(ctx, "ip", "route", "show") + output, err = cmd.Output() + if err == nil { + lines = strings.Split(string(output), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + if line == "" { + continue + } + + // Parse default route: "default via 10.10.14.1 dev ens18" + if strings.HasPrefix(line, "default via ") { + parts := strings.Fields(line) + // Find "via" and "dev" in the parts + var gateway string + var ifaceName string + for i, part := range parts { + if part == "via" && i+1 < len(parts) { + gateway = parts[i+1] + } + if part == "dev" && i+1 < len(parts) { + ifaceName = parts[i+1] + } + } + if gateway != "" && ifaceName != "" { + if iface, exists := interfaceMap[ifaceName]; exists { + iface.Gateway = gateway + s.logger.Info("Set default gateway for interface", "name", ifaceName, "gateway", gateway) + } + } + } else if strings.Contains(line, " via ") && strings.Contains(line, " dev ") { + // Parse network route: "10.10.14.0/24 via 10.10.14.1 dev ens18" + // Or: "192.168.1.0/24 via 192.168.1.1 dev eth0" + parts := strings.Fields(line) + var gateway string + var ifaceName string + for i, part := range parts { + if part == "via" && i+1 < len(parts) { + gateway = parts[i+1] + } + if part == "dev" && i+1 < len(parts) { + ifaceName = parts[i+1] + } + } + // Only set gateway if it's not already set (prefer default route) + if gateway != "" && ifaceName != "" { + if iface, exists := interfaceMap[ifaceName]; exists { + if iface.Gateway == "" { + iface.Gateway = gateway + s.logger.Info("Set gateway from network route for interface", "name", ifaceName, "gateway", gateway) + } + } + } + } + } + } else { + s.logger.Warn("Failed to get routes", "error", err) + } + + // Get DNS servers from systemd-resolved or /etc/resolv.conf + // Try systemd-resolved first + cmd = exec.CommandContext(ctx, "systemd-resolve", "--status") + output, err = cmd.Output() + dnsServers := []string{} + if err == nil { + // Parse DNS from systemd-resolve output + lines = strings.Split(string(output), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + if strings.HasPrefix(line, "DNS Servers:") { + // Format: "DNS Servers: 8.8.8.8 8.8.4.4" + parts := strings.Fields(line) + if len(parts) >= 3 { + dnsServers = parts[2:] + } + break + } + } + } else { + // Fallback to /etc/resolv.conf + data, err := os.ReadFile("/etc/resolv.conf") + if err == nil { + lines = strings.Split(string(data), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + if strings.HasPrefix(line, "nameserver ") { + dns := strings.TrimPrefix(line, "nameserver ") + dns = strings.TrimSpace(dns) + if dns != "" { + dnsServers = append(dnsServers, dns) + } + } + } + } + } + // Convert map to slice var interfaces []NetworkInterface s.logger.Debug("Converting interface map to slice", "map_size", len(interfaceMap)) @@ -319,6 +613,14 @@ func (s *Service) ListNetworkInterfaces(ctx context.Context) ([]NetworkInterface } } + // Set DNS servers (use first two if available) + if len(dnsServers) > 0 { + iface.DNS1 = dnsServers[0] + } + if len(dnsServers) > 1 { + iface.DNS2 = dnsServers[1] + } + // Determine role based on interface name or IP (simple heuristic) // You can enhance this with configuration file or database lookup if strings.Contains(iface.Name, "eth") || strings.Contains(iface.Name, "ens") { @@ -345,3 +647,401 @@ func (s *Service) ListNetworkInterfaces(ctx context.Context) ([]NetworkInterface s.logger.Info("Listed network interfaces", "count", len(interfaces)) return interfaces, nil } + +// GetManagementIPAddress returns the IP address of the management interface +func (s *Service) GetManagementIPAddress(ctx context.Context) (string, error) { + interfaces, err := s.ListNetworkInterfaces(ctx) + if err != nil { + return "", fmt.Errorf("failed to list network interfaces: %w", err) + } + + // First, try to find interface with Role "Management" + for _, iface := range interfaces { + if iface.Role == "Management" && iface.IPAddress != "" && iface.Status == "Connected" { + s.logger.Info("Found management interface", "interface", iface.Name, "ip", iface.IPAddress) + return iface.IPAddress, nil + } + } + + // Fallback: use interface with default route (primary interface) + for _, iface := range interfaces { + if iface.Gateway != "" && iface.IPAddress != "" && iface.Status == "Connected" { + s.logger.Info("Using primary interface as management", "interface", iface.Name, "ip", iface.IPAddress) + return iface.IPAddress, nil + } + } + + // Final fallback: use first connected interface with IP + for _, iface := range interfaces { + if iface.IPAddress != "" && iface.Status == "Connected" && iface.Name != "lo" { + s.logger.Info("Using first connected interface as management", "interface", iface.Name, "ip", iface.IPAddress) + return iface.IPAddress, nil + } + } + + return "", fmt.Errorf("no management interface found") +} + +// UpdateNetworkInterfaceRequest represents the request to update a network interface +type UpdateNetworkInterfaceRequest struct { + IPAddress string `json:"ip_address"` + Subnet string `json:"subnet"` + Gateway string `json:"gateway,omitempty"` + DNS1 string `json:"dns1,omitempty"` + DNS2 string `json:"dns2,omitempty"` + Role string `json:"role,omitempty"` +} + +// UpdateNetworkInterface updates network interface configuration +func (s *Service) UpdateNetworkInterface(ctx context.Context, ifaceName string, req UpdateNetworkInterfaceRequest) (*NetworkInterface, error) { + // Validate interface exists + cmd := exec.CommandContext(ctx, "ip", "link", "show", ifaceName) + if err := cmd.Run(); err != nil { + return nil, fmt.Errorf("interface %s not found: %w", ifaceName, err) + } + + // Remove existing IP address if any + cmd = exec.CommandContext(ctx, "ip", "addr", "flush", "dev", ifaceName) + cmd.Run() // Ignore error, interface might not have IP + + // Set new IP address and subnet + ipWithSubnet := fmt.Sprintf("%s/%s", req.IPAddress, req.Subnet) + cmd = exec.CommandContext(ctx, "ip", "addr", "add", ipWithSubnet, "dev", ifaceName) + output, err := cmd.CombinedOutput() + if err != nil { + s.logger.Error("Failed to set IP address", "interface", ifaceName, "error", err, "output", string(output)) + return nil, fmt.Errorf("failed to set IP address: %w", err) + } + + // Remove existing default route if any + cmd = exec.CommandContext(ctx, "ip", "route", "del", "default") + cmd.Run() // Ignore error, might not exist + + // Set gateway if provided + if req.Gateway != "" { + cmd = exec.CommandContext(ctx, "ip", "route", "add", "default", "via", req.Gateway, "dev", ifaceName) + output, err = cmd.CombinedOutput() + if err != nil { + s.logger.Error("Failed to set gateway", "interface", ifaceName, "error", err, "output", string(output)) + return nil, fmt.Errorf("failed to set gateway: %w", err) + } + } + + // Update DNS in systemd-resolved or /etc/resolv.conf + if req.DNS1 != "" || req.DNS2 != "" { + // Try using systemd-resolve first + cmd = exec.CommandContext(ctx, "systemd-resolve", "--status") + if cmd.Run() == nil { + // systemd-resolve is available, use it + dnsServers := []string{} + if req.DNS1 != "" { + dnsServers = append(dnsServers, req.DNS1) + } + if req.DNS2 != "" { + dnsServers = append(dnsServers, req.DNS2) + } + if len(dnsServers) > 0 { + // Use resolvectl to set DNS (newer systemd) + cmd = exec.CommandContext(ctx, "resolvectl", "dns", ifaceName, strings.Join(dnsServers, " ")) + if cmd.Run() != nil { + // Fallback to systemd-resolve + cmd = exec.CommandContext(ctx, "systemd-resolve", "--interface", ifaceName, "--set-dns", strings.Join(dnsServers, " ")) + output, err = cmd.CombinedOutput() + if err != nil { + s.logger.Warn("Failed to set DNS via systemd-resolve", "error", err, "output", string(output)) + } + } + } + } else { + // Fallback: update /etc/resolv.conf + resolvContent := "# Generated by Calypso\n" + if req.DNS1 != "" { + resolvContent += fmt.Sprintf("nameserver %s\n", req.DNS1) + } + if req.DNS2 != "" { + resolvContent += fmt.Sprintf("nameserver %s\n", req.DNS2) + } + + tmpPath := "/tmp/resolv.conf." + fmt.Sprintf("%d", time.Now().Unix()) + if err := os.WriteFile(tmpPath, []byte(resolvContent), 0644); err != nil { + s.logger.Warn("Failed to write temporary resolv.conf", "error", err) + } else { + cmd = exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("mv %s /etc/resolv.conf", tmpPath)) + output, err = cmd.CombinedOutput() + if err != nil { + s.logger.Warn("Failed to update /etc/resolv.conf", "error", err, "output", string(output)) + } + } + } + } + + // Bring interface up + cmd = exec.CommandContext(ctx, "ip", "link", "set", ifaceName, "up") + output, err = cmd.CombinedOutput() + if err != nil { + s.logger.Warn("Failed to bring interface up", "interface", ifaceName, "error", err, "output", string(output)) + } + + // Return updated interface + updatedIface := &NetworkInterface{ + Name: ifaceName, + IPAddress: req.IPAddress, + Subnet: req.Subnet, + Gateway: req.Gateway, + DNS1: req.DNS1, + DNS2: req.DNS2, + Role: req.Role, + Status: "Connected", + Speed: "Unknown", // Will be updated on next list + } + + s.logger.Info("Updated network interface", "interface", ifaceName, "ip", req.IPAddress, "subnet", req.Subnet) + return updatedIface, nil +} + +// SaveNTPSettings saves NTP configuration to the OS +func (s *Service) SaveNTPSettings(ctx context.Context, settings NTPSettings) error { + // Set timezone using timedatectl + if settings.Timezone != "" { + cmd := exec.CommandContext(ctx, "timedatectl", "set-timezone", settings.Timezone) + output, err := cmd.CombinedOutput() + if err != nil { + s.logger.Error("Failed to set timezone", "timezone", settings.Timezone, "error", err, "output", string(output)) + return fmt.Errorf("failed to set timezone: %w", err) + } + s.logger.Info("Timezone set", "timezone", settings.Timezone) + } + + // Configure NTP servers in systemd-timesyncd + if len(settings.NTPServers) > 0 { + configPath := "/etc/systemd/timesyncd.conf" + + // Build config content + configContent := "[Time]\n" + configContent += "NTP=" + for i, server := range settings.NTPServers { + if i > 0 { + configContent += " " + } + configContent += server + } + configContent += "\n" + + // Write to temporary file first, then move to final location (requires root) + tmpPath := "/tmp/timesyncd.conf." + fmt.Sprintf("%d", time.Now().Unix()) + if err := os.WriteFile(tmpPath, []byte(configContent), 0644); err != nil { + s.logger.Error("Failed to write temporary NTP config", "error", err) + return fmt.Errorf("failed to write temporary NTP configuration: %w", err) + } + + // Move to final location using sudo (requires root privileges) + cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("mv %s %s", tmpPath, configPath)) + output, err := cmd.CombinedOutput() + if err != nil { + s.logger.Error("Failed to move NTP config", "error", err, "output", string(output)) + os.Remove(tmpPath) // Clean up temp file + return fmt.Errorf("failed to move NTP configuration: %w", err) + } + + // Restart systemd-timesyncd to apply changes + cmd = exec.CommandContext(ctx, "systemctl", "restart", "systemd-timesyncd") + output, err = cmd.CombinedOutput() + if err != nil { + s.logger.Error("Failed to restart systemd-timesyncd", "error", err, "output", string(output)) + return fmt.Errorf("failed to restart systemd-timesyncd: %w", err) + } + + s.logger.Info("NTP servers configured", "servers", settings.NTPServers) + } + + return nil +} + +// GetNTPSettings retrieves current NTP configuration from the OS +func (s *Service) GetNTPSettings(ctx context.Context) (*NTPSettings, error) { + settings := &NTPSettings{ + NTPServers: []string{}, + } + + // Get current timezone using timedatectl + cmd := exec.CommandContext(ctx, "timedatectl", "show", "--property=Timezone", "--value") + output, err := cmd.Output() + if err != nil { + s.logger.Warn("Failed to get timezone", "error", err) + settings.Timezone = "Etc/UTC" // Default fallback + } else { + settings.Timezone = strings.TrimSpace(string(output)) + if settings.Timezone == "" { + settings.Timezone = "Etc/UTC" + } + } + + // Read NTP servers from systemd-timesyncd config + configPath := "/etc/systemd/timesyncd.conf" + data, err := os.ReadFile(configPath) + if err != nil { + s.logger.Warn("Failed to read NTP config", "error", err) + // Default NTP servers if config file doesn't exist + settings.NTPServers = []string{"pool.ntp.org", "time.google.com"} + } else { + // Parse NTP servers from config file + lines := strings.Split(string(data), "\n") + for _, line := range lines { + line = strings.TrimSpace(line) + if strings.HasPrefix(line, "NTP=") { + ntpLine := strings.TrimPrefix(line, "NTP=") + if ntpLine != "" { + servers := strings.Fields(ntpLine) + settings.NTPServers = servers + break + } + } + } + // If no NTP servers found in config, use defaults + if len(settings.NTPServers) == 0 { + settings.NTPServers = []string{"pool.ntp.org", "time.google.com"} + } + } + + return settings, nil +} + +// ExecuteCommand executes a shell command and returns the output +// service parameter is optional and can be: system, scst, storage, backup, tape +func (s *Service) ExecuteCommand(ctx context.Context, command string, service string) (string, error) { + // Sanitize command - basic security check + command = strings.TrimSpace(command) + if command == "" { + return "", fmt.Errorf("command cannot be empty") + } + + // Block dangerous commands that could harm the system + dangerousCommands := []string{ + "rm -rf /", + "dd if=", + ":(){ :|:& };:", + "mkfs", + "fdisk", + "parted", + "format", + "> /dev/sd", + "mkfs.ext", + "mkfs.xfs", + "mkfs.btrfs", + "wipefs", + } + + commandLower := strings.ToLower(command) + for _, dangerous := range dangerousCommands { + if strings.Contains(commandLower, dangerous) { + return "", fmt.Errorf("command blocked for security reasons") + } + } + + // Service-specific command handling + switch service { + case "scst": + // Allow SCST admin commands + if strings.HasPrefix(command, "scstadmin") { + // SCST commands are safe + break + } + case "backup": + // Allow bconsole commands + if strings.HasPrefix(command, "bconsole") { + // Backup console commands are safe + break + } + case "storage": + // Allow ZFS and storage commands + if strings.HasPrefix(command, "zfs") || strings.HasPrefix(command, "zpool") || strings.HasPrefix(command, "lsblk") { + // Storage commands are safe + break + } + case "tape": + // Allow tape library commands + if strings.HasPrefix(command, "mtx") || strings.HasPrefix(command, "lsscsi") || strings.HasPrefix(command, "sg_") { + // Tape commands are safe + break + } + } + + // Execute command with timeout (30 seconds) + ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + + // Check if command already has sudo (reuse commandLower from above) + hasSudo := strings.HasPrefix(commandLower, "sudo ") + + // Determine if command needs sudo based on service and command type + needsSudo := false + + if !hasSudo { + // Commands that typically need sudo + sudoCommands := []string{ + "scstadmin", + "systemctl", + "zfs", + "zpool", + "mount", + "umount", + "ip link", + "ip addr", + "iptables", + "journalctl", + } + + for _, sudoCmd := range sudoCommands { + if strings.HasPrefix(commandLower, sudoCmd) { + needsSudo = true + break + } + } + + // Service-specific sudo requirements + switch service { + case "scst": + // All SCST admin commands need sudo + if strings.HasPrefix(commandLower, "scstadmin") { + needsSudo = true + } + case "storage": + // ZFS commands typically need sudo + if strings.HasPrefix(commandLower, "zfs") || strings.HasPrefix(commandLower, "zpool") { + needsSudo = true + } + case "system": + // System commands like systemctl need sudo + if strings.HasPrefix(commandLower, "systemctl") || strings.HasPrefix(commandLower, "journalctl") { + needsSudo = true + } + } + } + + // Build command with or without sudo + var cmd *exec.Cmd + if needsSudo && !hasSudo { + // Use sudo for privileged commands (if not already present) + cmd = exec.CommandContext(ctx, "sudo", "sh", "-c", command) + } else { + // Regular command (or already has sudo) + cmd = exec.CommandContext(ctx, "sh", "-c", command) + } + + cmd.Env = append(os.Environ(), "TERM=xterm-256color") + + cmd.Env = append(os.Environ(), "TERM=xterm-256color") + + output, err := cmd.CombinedOutput() + + if err != nil { + // Return output even if there's an error (some commands return non-zero exit codes) + outputStr := string(output) + if len(outputStr) > 0 { + return outputStr, nil + } + return "", fmt.Errorf("command execution failed: %w", err) + } + + return string(output), nil +} diff --git a/backend/internal/system/terminal.go b/backend/internal/system/terminal.go new file mode 100644 index 0000000..597ff2b --- /dev/null +++ b/backend/internal/system/terminal.go @@ -0,0 +1,328 @@ +package system + +import ( + "encoding/json" + "io" + "net/http" + "os" + "os/exec" + "os/user" + "sync" + "syscall" + "time" + + "github.com/atlasos/calypso/internal/common/logger" + "github.com/creack/pty" + "github.com/gin-gonic/gin" + "github.com/gorilla/websocket" +) + +const ( + // WebSocket timeouts + writeWait = 10 * time.Second + pongWait = 60 * time.Second + pingPeriod = (pongWait * 9) / 10 +) + +var upgrader = websocket.Upgrader{ + ReadBufferSize: 4096, + WriteBufferSize: 4096, + CheckOrigin: func(r *http.Request) bool { + // Allow all origins - in production, validate against allowed domains + return true + }, +} + +// TerminalSession manages a single terminal session +type TerminalSession struct { + conn *websocket.Conn + pty *os.File + cmd *exec.Cmd + logger *logger.Logger + mu sync.RWMutex + closed bool + username string + done chan struct{} +} + +// HandleTerminalWebSocket handles WebSocket connection for terminal +func HandleTerminalWebSocket(c *gin.Context, log *logger.Logger) { + // Verify authentication + userID, exists := c.Get("user_id") + if !exists { + log.Warn("Terminal WebSocket: unauthorized access", "ip", c.ClientIP()) + c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"}) + return + } + + username, _ := c.Get("username") + if username == nil { + username = userID + } + + log.Info("Terminal WebSocket: connection attempt", "username", username, "ip", c.ClientIP()) + + // Upgrade connection + conn, err := upgrader.Upgrade(c.Writer, c.Request, nil) + if err != nil { + log.Error("Terminal WebSocket: upgrade failed", "error", err) + return + } + + log.Info("Terminal WebSocket: connection upgraded", "username", username) + + // Create session + session := &TerminalSession{ + conn: conn, + logger: log, + username: username.(string), + done: make(chan struct{}), + } + + // Start terminal + if err := session.startPTY(); err != nil { + log.Error("Terminal WebSocket: failed to start PTY", "error", err, "username", username) + session.sendError(err.Error()) + session.close() + return + } + + // Handle messages and PTY output + go session.handleRead() + go session.handleWrite() +} + +// startPTY starts the PTY session +func (s *TerminalSession) startPTY() error { + // Get user info + currentUser, err := user.Lookup(s.username) + if err != nil { + // Fallback to current user + currentUser, err = user.Current() + if err != nil { + return err + } + } + + // Determine shell + shell := os.Getenv("SHELL") + if shell == "" { + shell = "/bin/bash" + } + + // Create command + s.cmd = exec.Command(shell) + s.cmd.Env = append(os.Environ(), + "TERM=xterm-256color", + "HOME="+currentUser.HomeDir, + "USER="+currentUser.Username, + "USERNAME="+currentUser.Username, + ) + s.cmd.Dir = currentUser.HomeDir + + // Start PTY + ptyFile, err := pty.Start(s.cmd) + if err != nil { + return err + } + + s.pty = ptyFile + + // Set initial size + pty.Setsize(ptyFile, &pty.Winsize{ + Rows: 24, + Cols: 80, + }) + + return nil +} + +// handleRead handles incoming WebSocket messages +func (s *TerminalSession) handleRead() { + defer s.close() + + // Set read deadline and pong handler + s.conn.SetReadDeadline(time.Now().Add(pongWait)) + s.conn.SetPongHandler(func(string) error { + s.conn.SetReadDeadline(time.Now().Add(pongWait)) + return nil + }) + + for { + select { + case <-s.done: + return + default: + messageType, data, err := s.conn.ReadMessage() + if err != nil { + if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { + s.logger.Error("Terminal WebSocket: read error", "error", err) + } + return + } + + // Handle binary messages (raw input) + if messageType == websocket.BinaryMessage { + s.writeToPTY(data) + continue + } + + // Handle text messages (JSON commands) + if messageType == websocket.TextMessage { + var msg map[string]interface{} + if err := json.Unmarshal(data, &msg); err != nil { + continue + } + + switch msg["type"] { + case "input": + if data, ok := msg["data"].(string); ok { + s.writeToPTY([]byte(data)) + } + + case "resize": + if cols, ok1 := msg["cols"].(float64); ok1 { + if rows, ok2 := msg["rows"].(float64); ok2 { + s.resizePTY(uint16(cols), uint16(rows)) + } + } + + case "ping": + s.writeWS(websocket.TextMessage, []byte(`{"type":"pong"}`)) + } + } + } + } +} + +// handleWrite handles PTY output to WebSocket +func (s *TerminalSession) handleWrite() { + defer s.close() + + ticker := time.NewTicker(pingPeriod) + defer ticker.Stop() + + // Read from PTY and write to WebSocket + buffer := make([]byte, 4096) + for { + select { + case <-s.done: + return + case <-ticker.C: + // Send ping + if err := s.writeWS(websocket.PingMessage, nil); err != nil { + return + } + default: + // Read from PTY + if s.pty != nil { + n, err := s.pty.Read(buffer) + if err != nil { + if err != io.EOF { + s.logger.Error("Terminal WebSocket: PTY read error", "error", err) + } + return + } + if n > 0 { + // Write binary data to WebSocket + if err := s.writeWS(websocket.BinaryMessage, buffer[:n]); err != nil { + return + } + } + } + } + } +} + +// writeToPTY writes data to PTY +func (s *TerminalSession) writeToPTY(data []byte) { + s.mu.RLock() + closed := s.closed + pty := s.pty + s.mu.RUnlock() + + if closed || pty == nil { + return + } + + if _, err := pty.Write(data); err != nil { + s.logger.Error("Terminal WebSocket: PTY write error", "error", err) + } +} + +// resizePTY resizes the PTY +func (s *TerminalSession) resizePTY(cols, rows uint16) { + s.mu.RLock() + closed := s.closed + ptyFile := s.pty + s.mu.RUnlock() + + if closed || ptyFile == nil { + return + } + + // Use pty.Setsize from package, not method from variable + pty.Setsize(ptyFile, &pty.Winsize{ + Cols: cols, + Rows: rows, + }) +} + +// writeWS writes message to WebSocket +func (s *TerminalSession) writeWS(messageType int, data []byte) error { + s.mu.RLock() + closed := s.closed + conn := s.conn + s.mu.RUnlock() + + if closed || conn == nil { + return io.ErrClosedPipe + } + + conn.SetWriteDeadline(time.Now().Add(writeWait)) + return conn.WriteMessage(messageType, data) +} + +// sendError sends error message +func (s *TerminalSession) sendError(errMsg string) { + msg := map[string]interface{}{ + "type": "error", + "error": errMsg, + } + data, _ := json.Marshal(msg) + s.writeWS(websocket.TextMessage, data) +} + +// close closes the terminal session +func (s *TerminalSession) close() { + s.mu.Lock() + defer s.mu.Unlock() + + if s.closed { + return + } + + s.closed = true + close(s.done) + + // Close PTY + if s.pty != nil { + s.pty.Close() + } + + // Kill process + if s.cmd != nil && s.cmd.Process != nil { + s.cmd.Process.Signal(syscall.SIGTERM) + time.Sleep(100 * time.Millisecond) + if s.cmd.ProcessState == nil || !s.cmd.ProcessState.Exited() { + s.cmd.Process.Kill() + } + } + + // Close WebSocket + if s.conn != nil { + s.conn.Close() + } + + s.logger.Info("Terminal WebSocket: session closed", "username", s.username) +} diff --git a/bacula-config b/bacula-config new file mode 120000 index 0000000..debed25 --- /dev/null +++ b/bacula-config @@ -0,0 +1 @@ +/opt/calypso/conf/bacula \ No newline at end of file diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz b/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz new file mode 100644 index 0000000..212a5fb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz.sha256 b/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz.sha256 new file mode 100644 index 0000000..eb131b1 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap.tar.gz.sha256 @@ -0,0 +1 @@ +a4040ea4ab486d4671772e4b832b4be5741bf58764fc731873b585df1d805e66 calypso-appliance-1.0.0-airgap.tar.gz diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/README.md b/dist/airgap/calypso-appliance-1.0.0-airgap/README.md new file mode 100644 index 0000000..03c5015 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/README.md @@ -0,0 +1,59 @@ +# Calypso Appliance - Airgap Installation Bundle + +**Version:** 1.0.0 +**Target OS:** Ubuntu Server 24.04 LTS +**Installation Type:** Offline/Airgap + +## Bundle Contents + +- **binaries/**: Pre-built Calypso binaries +- **frontend/**: Built frontend assets +- **packages/debs/**: All required DEB packages with dependencies (59 packages + ~200-300 dependencies) +- **scripts/**: Installation scripts +- **services/**: Systemd service files +- **migrations/**: Database migration files +- **configs/**: Configuration templates +- **third_party/**: Optional third-party binaries (Go, Node.js) + +## Installation + +### Prerequisites + +- Ubuntu Server 24.04 LTS +- Root or sudo access +- Minimum 10GB free disk space +- Kernel headers installed (for kernel modules) + +### Quick Install + +```bash +cd /path/to/bundle +sudo ./install-airgap.sh +``` + +The installer will: +1. Install all packages from bundled DEB files +2. Install Calypso binaries and frontend +3. Setup database and configuration +4. Install systemd services + +### Post-Installation + +1. Review configuration: `/etc/calypso/calypso.yaml` +2. Install kernel modules (ZFS, SCST, mhVTL) if needed +3. Start services: `systemctl start calypso-api` +4. Enable services: `systemctl enable calypso-api` + +## Verification + +Check service status: +```bash +systemctl status calypso-api +curl http://localhost:8080/api/v1/health +``` + +## Support + +For issues, check: +- Installation logs: `/var/log/calypso/install.log` +- Service logs: `journalctl -u calypso-api` diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/binaries/calypso-api b/dist/airgap/calypso-appliance-1.0.0-airgap/binaries/calypso-api new file mode 100755 index 0000000..a4e91a2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/binaries/calypso-api differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/configs/config.yaml.template b/dist/airgap/calypso-appliance-1.0.0-airgap/configs/config.yaml.template new file mode 100644 index 0000000..670407f --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/configs/config.yaml.template @@ -0,0 +1,64 @@ +# AtlasOS - Calypso API Configuration Template +# This file will be copied to /etc/calypso/config.yaml during installation +# Environment variables from /etc/calypso/secrets.env will be used for sensitive values + +server: + port: 8080 + host: "0.0.0.0" + read_timeout: 15s + write_timeout: 15s + idle_timeout: 60s + # Response caching configuration + cache: + enabled: true # Enable response caching + default_ttl: 5m # Default cache TTL (5 minutes) + max_age: 300 # Cache-Control max-age in seconds (5 minutes) + +database: + host: "localhost" + port: 5432 + user: "calypso" + password: "" # Set via CALYPSO_DB_PASSWORD environment variable + database: "calypso" + ssl_mode: "disable" + # Connection pool optimization + max_connections: 25 + max_idle_conns: 5 + conn_max_lifetime: 5m + +auth: + jwt_secret: "" # Set via CALYPSO_JWT_SECRET environment variable + token_lifetime: 24h + argon2: + memory: 65536 # 64 MB + iterations: 3 + parallelism: 4 + salt_length: 16 + key_length: 32 + +logging: + level: "info" # debug, info, warn, error + format: "json" # json or text + +# CORS configuration +cors: + allowed_origins: + - "http://localhost:3000" + - "http://localhost:5173" + allowed_methods: + - "GET" + - "POST" + - "PUT" + - "DELETE" + - "PATCH" + allowed_headers: + - "Content-Type" + - "Authorization" + allow_credentials: true + +# Rate limiting +rate_limit: + enabled: true + requests_per_minute: 100 + authenticated_requests_per_minute: 200 + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/chart-vendor-CnBPFalK.js b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/chart-vendor-CnBPFalK.js new file mode 100644 index 0000000..207a870 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/chart-vendor-CnBPFalK.js @@ -0,0 +1,66 @@ +import{c as Z}from"./ui-vendor-C4xvlrdo.js";import{c as Si,g as oe,r as N,R as S}from"./react-vendor-Dvs2KPqW.js";var Ao,rp;function Le(){if(rp)return Ao;rp=1;var e=Array.isArray;return Ao=e,Ao}var So,np;function Jb(){if(np)return So;np=1;var e=typeof Si=="object"&&Si&&Si.Object===Object&&Si;return So=e,So}var Po,ip;function pt(){if(ip)return Po;ip=1;var e=Jb(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Po=r,Po}var To,ap;function di(){if(ap)return To;ap=1;var e=pt(),t=e.Symbol;return To=t,To}var Eo,op;function OO(){if(op)return Eo;op=1;var e=di(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Eo=a,Eo}var jo,up;function _O(){if(up)return jo;up=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return jo=r,jo}var $o,cp;function Pt(){if(cp)return $o;cp=1;var e=di(),t=OO(),r=_O(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return $o=o,$o}var Mo,sp;function Tt(){if(sp)return Mo;sp=1;function e(t){return t!=null&&typeof t=="object"}return Mo=e,Mo}var Io,lp;function an(){if(lp)return Io;lp=1;var e=Pt(),t=Tt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Io=n,Io}var Co,fp;function Xf(){if(fp)return Co;fp=1;var e=Le(),t=an(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Co=i,Co}var ko,hp;function Dt(){if(hp)return ko;hp=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return ko=e,ko}var Ro,pp;function Yf(){if(pp)return Ro;pp=1;var e=Pt(),t=Dt(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return Ro=o,Ro}var Do,dp;function AO(){if(dp)return Do;dp=1;var e=pt(),t=e["__core-js_shared__"];return Do=t,Do}var No,vp;function SO(){if(vp)return No;vp=1;var e=AO(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return No=r,No}var qo,yp;function Qb(){if(yp)return qo;yp=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return qo=r,qo}var Lo,mp;function PO(){if(mp)return Lo;mp=1;var e=Yf(),t=SO(),r=Dt(),n=Qb(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return Lo=l,Lo}var Bo,gp;function TO(){if(gp)return Bo;gp=1;function e(t,r){return t?.[r]}return Bo=e,Bo}var Fo,bp;function hr(){if(bp)return Fo;bp=1;var e=PO(),t=TO();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Fo=r,Fo}var Wo,xp;function Ba(){if(xp)return Wo;xp=1;var e=hr(),t=e(Object,"create");return Wo=t,Wo}var zo,wp;function EO(){if(wp)return zo;wp=1;var e=Ba();function t(){this.__data__=e?e(null):{},this.size=0}return zo=t,zo}var Uo,Op;function jO(){if(Op)return Uo;Op=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Uo=e,Uo}var Ho,_p;function $O(){if(_p)return Ho;_p=1;var e=Ba(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return Ho=i,Ho}var Ko,Ap;function MO(){if(Ap)return Ko;Ap=1;var e=Ba(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Ko=n,Ko}var Go,Sp;function IO(){if(Sp)return Go;Sp=1;var e=Ba(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Go=r,Go}var Vo,Pp;function CO(){if(Pp)return Vo;Pp=1;var e=EO(),t=jO(),r=$O(),n=MO(),i=IO();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u-1}return eu=t,eu}var tu,Cp;function qO(){if(Cp)return tu;Cp=1;var e=Fa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return tu=t,tu}var ru,kp;function Wa(){if(kp)return ru;kp=1;var e=kO(),t=RO(),r=DO(),n=NO(),i=qO();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},Zt=function(t){return ar(t)&&t.indexOf("%")===t.length-1},q=function(t){return u_(t)&&!un(t)},c_=function(t){return Y(t)},Se=function(t){return q(t)||ar(t)},s_=0,pr=function(t){var r=++s_;return"".concat(t||"").concat(r)},ke=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!ar(t))return n;var a;if(Zt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return un(a)&&(a=n),i&&a>r&&(a=r),a},It=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},l_=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Tl(e){"@babel/helpers - typeof";return Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(e)}var cd={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},wt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},sd=null,Eu=null,nh=function e(t){if(t===sd&&Array.isArray(Eu))return Eu;var r=[];return N.Children.forEach(t,function(n){Y(n)||(n_.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Eu=r,sd=t,r};function Ke(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return wt(i)}):n=[wt(t)],nh(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function ze(e,t){var r=Ke(e,t);return r&&r[0]}var ld=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},g_=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],b_=function(t){return t&&t.type&&ar(t.type)&&g_.indexOf(t.type)>=0},a0=function(t){return t&&Tl(t)==="object"&&"clipDot"in t},x_=function(t,r,n,i){var a,o=(a=Tu?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!G(t)&&(i&&o.includes(r)||p_.includes(r))||n&&rh.includes(r)},U=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!on(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;x_((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},El=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return fd(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function S_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $l(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=A_(e,__),f=i||{width:r,height:n,x:0,y:0},l=Z("recharts-surface",a);return S.createElement("svg",jl({},U(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),S.createElement("title",null,u),S.createElement("desc",null,c),t)}var P_=["children","className"];function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function E_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ee=S.forwardRef(function(e,t){var r=e.children,n=e.className,i=T_(e,P_),a=Z("recharts-layer",n);return S.createElement("g",Ml({className:a},U(i,!0),{ref:t}),r)}),it=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return $u=t,$u}var Mu,vd;function o0(){if(vd)return Mu;vd=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Mu=c,Mu}var Iu,yd;function M_(){if(yd)return Iu;yd=1;function e(t){return t.split("")}return Iu=e,Iu}var Cu,md;function I_(){if(md)return Cu;md=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",y=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+y+")*",g=v+y+p,b="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+b+g,"g");function O(m){return m.match(w)||[]}return Cu=O,Cu}var ku,gd;function C_(){if(gd)return ku;gd=1;var e=M_(),t=o0(),r=I_();function n(i){return t(i)?r(i):e(i)}return ku=n,ku}var Ru,bd;function k_(){if(bd)return Ru;bd=1;var e=$_(),t=o0(),r=C_(),n=t0();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return Ru=i,Ru}var Du,xd;function R_(){if(xd)return Du;xd=1;var e=k_(),t=e("toUpperCase");return Du=t,Du}var D_=R_();const Ha=oe(D_);function se(e){return function(){return e}}const u0=Math.cos,Wi=Math.sin,ot=Math.sqrt,zi=Math.PI,Ka=2*zi,Il=Math.PI,Cl=2*Il,Vt=1e-6,N_=Cl-Vt;function c0(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return c0;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iVt)if(!(Math.abs(l*c-s*f)>Vt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,y=i-u,v=c*c+s*s,p=d*d+y*y,g=Math.sqrt(v),b=Math.sqrt(h),w=a*Math.tan((Il-Math.acos((v+h-p)/(2*g*b)))/2),O=w/b,m=w/g;Math.abs(O-1)>Vt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*y)},${this._x1=t+m*c},${this._y1=r+m*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Vt||Math.abs(this._y1-f)>Vt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%Cl+Cl),h>N_?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Vt&&this._append`A${n},${n},0,${+(h>=Il)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function ih(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new L_(t)}function ah(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function s0(e){this._context=e}s0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ga(e){return new s0(e)}function l0(e){return e[0]}function f0(e){return e[1]}function h0(e,t){var r=se(!0),n=null,i=Ga,a=null,o=ih(u);e=typeof e=="function"?e:e===void 0?l0:se(e),t=typeof t=="function"?t:t===void 0?f0:se(t);function u(c){var s,f=(c=ah(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--y)u.point(w[y],O[y]);u.lineEnd(),u.areaEnd()}g&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(b)return u=null,b+""||null}function f(){return h0().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:se(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:se(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:se(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class p0{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function B_(e){return new p0(e,!0)}function F_(e){return new p0(e,!1)}const oh={draw(e,t){const r=ot(t/zi);e.moveTo(r,0),e.arc(0,0,r,0,Ka)}},W_={draw(e,t){const r=ot(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},d0=ot(1/3),z_=d0*2,U_={draw(e,t){const r=ot(t/z_),n=r*d0;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},H_={draw(e,t){const r=ot(t),n=-r/2;e.rect(n,n,r,r)}},K_=.8908130915292852,v0=Wi(zi/10)/Wi(7*zi/10),G_=Wi(Ka/10)*v0,V_=-u0(Ka/10)*v0,X_={draw(e,t){const r=ot(t*K_),n=G_*r,i=V_*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=Ka*a/5,u=u0(o),c=Wi(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},Nu=ot(3),Y_={draw(e,t){const r=-ot(t/(Nu*3));e.moveTo(0,r*2),e.lineTo(-Nu*r,-r),e.lineTo(Nu*r,-r),e.closePath()}},Ge=-.5,Ve=ot(3)/2,kl=1/ot(12),Z_=(kl/2+1)*3,J_={draw(e,t){const r=ot(t/Z_),n=r/2,i=r*kl,a=n,o=r*kl+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Ge*n-Ve*i,Ve*n+Ge*i),e.lineTo(Ge*a-Ve*o,Ve*a+Ge*o),e.lineTo(Ge*u-Ve*c,Ve*u+Ge*c),e.lineTo(Ge*n+Ve*i,Ge*i-Ve*n),e.lineTo(Ge*a+Ve*o,Ge*o-Ve*a),e.lineTo(Ge*u+Ve*c,Ge*c-Ve*u),e.closePath()}};function Q_(e,t){let r=null,n=ih(i);e=typeof e=="function"?e:se(e||oh),t=typeof t=="function"?t:se(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:se(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:se(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Ui(){}function Hi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function y0(e){this._context=e}y0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Hi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Hi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eA(e){return new y0(e)}function m0(e){this._context=e}m0.prototype={areaStart:Ui,areaEnd:Ui,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Hi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tA(e){return new m0(e)}function g0(e){this._context=e}g0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Hi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function rA(e){return new g0(e)}function b0(e){this._context=e}b0.prototype={areaStart:Ui,areaEnd:Ui,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function nA(e){return new b0(e)}function wd(e){return e<0?-1:1}function Od(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(wd(a)+wd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function _d(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function qu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Ki(e){this._context=e}Ki.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qu(this,this._t0,_d(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qu(this,_d(this,r=Od(this,e,t)),r);break;default:qu(this,this._t0,r=Od(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function x0(e){this._context=new w0(e)}(x0.prototype=Object.create(Ki.prototype)).point=function(e,t){Ki.prototype.point.call(this,t,e)};function w0(e){this._context=e}w0.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function iA(e){return new Ki(e)}function aA(e){return new x0(e)}function O0(e){this._context=e}O0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ad(e),i=Ad(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function uA(e){return new Va(e,.5)}function cA(e){return new Va(e,0)}function sA(e){return new Va(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function lA(e,t){return e[t]}function fA(e){const t=[];return t.key=e,t}function hA(){var e=se([]),t=Rl,r=Ir,n=lA;function i(a){var o=Array.from(e.apply(this,arguments),fA),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var _0={symbolCircle:oh,symbolCross:W_,symbolDiamond:U_,symbolSquare:H_,symbolStar:X_,symbolTriangle:Y_,symbolWye:J_},OA=Math.PI/180,_A=function(t){var r="symbol".concat(Ha(t));return _0[r]||oh},AA=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*OA;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},SA=function(t,r){_0["symbol".concat(Ha(t))]=r},uh=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=xA(t,yA),s=Pd(Pd({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=_A(n),g=Q_().type(p).size(AA(a,u,n));return g()},l=s.className,h=s.cx,d=s.cy,y=U(s,!0);return h===+h&&d===+d&&a===+a?S.createElement("path",Dl({},y,{className:Z("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};uh.registerSymbol=SA;function Cr(e){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(e)}function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var b=d.inactive?s:d.color;return S.createElement("li",Nl({className:p,style:l,key:"legend-item-".concat(y)},or(n.props,d,y)),S.createElement($l,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),S.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},v?v(g,d,y):g))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return S.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);kn(ch,"displayName","Legend");kn(ch,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Lu,Ed;function RA(){if(Ed)return Lu;Ed=1;var e=Wa();function t(){this.__data__=new e,this.size=0}return Lu=t,Lu}var Bu,jd;function DA(){if(jd)return Bu;jd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Bu=e,Bu}var Fu,$d;function NA(){if($d)return Fu;$d=1;function e(t){return this.__data__.get(t)}return Fu=e,Fu}var Wu,Md;function qA(){if(Md)return Wu;Md=1;function e(t){return this.__data__.has(t)}return Wu=e,Wu}var zu,Id;function LA(){if(Id)return zu;Id=1;var e=Wa(),t=Jf(),r=Qf(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthd))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var g=-1,b=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++g-1&&n%1==0&&n-1&&r%1==0&&r<=e}return fc=t,fc}var hc,rv;function JA(){if(rv)return hc;rv=1;var e=Pt(),t=hh(),r=Tt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",y="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",g="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",m="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",T="[object Uint16Array]",$="[object Uint32Array]",P={};P[b]=P[w]=P[O]=P[m]=P[x]=P[_]=P[A]=P[T]=P[$]=!0,P[n]=P[i]=P[p]=P[a]=P[g]=P[o]=P[u]=P[c]=P[s]=P[f]=P[l]=P[h]=P[d]=P[y]=P[v]=!1;function E(j){return r(j)&&t(j.length)&&!!P[e(j)]}return hc=E,hc}var pc,nv;function C0(){if(nv)return pc;nv=1;function e(t){return function(r){return t(r)}}return pc=e,pc}var An={exports:{}};An.exports;var iv;function QA(){return iv||(iv=1,(function(e,t){var r=Jb(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(An,An.exports)),An.exports}var dc,av;function k0(){if(av)return dc;av=1;var e=JA(),t=C0(),r=QA(),n=r&&r.isTypedArray,i=n?t(n):e;return dc=i,dc}var vc,ov;function e1(){if(ov)return vc;ov=1;var e=XA(),t=lh(),r=Le(),n=I0(),i=fh(),a=k0(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),y=!l&&!h&&!d&&a(s),v=l||h||d||y,p=v?e(s.length,String):[],g=p.length;for(var b in s)(f||u.call(s,b))&&!(v&&(b=="length"||d&&(b=="offset"||b=="parent")||y&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,g)))&&p.push(b);return p}return vc=c,vc}var yc,uv;function t1(){if(uv)return yc;uv=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return yc=t,yc}var mc,cv;function R0(){if(cv)return mc;cv=1;function e(t,r){return function(n){return t(r(n))}}return mc=e,mc}var gc,sv;function r1(){if(sv)return gc;sv=1;var e=R0(),t=e(Object.keys,Object);return gc=t,gc}var bc,lv;function n1(){if(lv)return bc;lv=1;var e=t1(),t=r1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return bc=i,bc}var xc,fv;function vi(){if(fv)return xc;fv=1;var e=Yf(),t=hh();function r(n){return n!=null&&t(n.length)&&!e(n)}return xc=r,xc}var wc,hv;function Xa(){if(hv)return wc;hv=1;var e=e1(),t=n1(),r=vi();function n(i){return r(i)?e(i):t(i)}return wc=n,wc}var Oc,pv;function i1(){if(pv)return Oc;pv=1;var e=HA(),t=VA(),r=Xa();function n(i){return e(i,r,t)}return Oc=n,Oc}var _c,dv;function a1(){if(dv)return _c;dv=1;var e=i1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,y=e(o),v=y.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var g=h[p];if(!(l?g in o:n.call(o,g)))return!1}var b=f.get(a),w=f.get(o);if(b&&w)return b==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var m=l;++p-1}return Xc=t,Xc}var Yc,Fv;function S1(){if(Fv)return Yc;Fv=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var g=s?null:i(c);if(g)return a(g);y=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function B1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function F1(e){return e.value}function W1(e,t){if(S.isValidElement(e))return S.cloneElement(e,t);if(typeof e=="function")return S.createElement(e,t);t.ref;var r=L1(t,M1);return S.createElement(ch,r)}var Xv=1,jr=(function(e){function t(){var r;I1(this,t);for(var n=arguments.length,i=new Array(n),a=0;aXv||Math.abs(i.height-this.lastBoundingBox.height)>Xv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?vt({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();h={top:((f||0)-y.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return vt(vt({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=vt(vt({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return S.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},W1(a,vt(vt({},this.props),{},{payload:B0(f,s,F1)})))}}],[{key:"getWithHeight",value:function(n,i){var a=vt(vt({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);Ya(jr,"displayName","Legend");Ya(jr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ts,Yv;function z1(){if(Yv)return ts;Yv=1;var e=di(),t=lh(),r=Le(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return ts=i,ts}var rs,Zv;function z0(){if(Zv)return rs;Zv=1;var e=M0(),t=z1();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return rs=r,rs}var ns,Jv;function U1(){if(Jv)return ns;Jv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return ns=e,ns}var is,Qv;function H1(){if(Qv)return is;Qv=1;var e=U1(),t=e();return is=t,is}var as,ey;function U0(){if(ey)return as;ey=1;var e=H1(),t=Xa();function r(n,i){return n&&e(n,i,t)}return as=r,as}var os,ty;function K1(){if(ty)return os;ty=1;var e=vi();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return fs=t,fs}var hs,uy;function Y1(){if(uy)return hs;uy=1;var e=eh(),t=th(),r=dt(),n=H0(),i=G1(),a=C0(),o=X1(),u=cn(),c=Le();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var y=n(f,function(v,p,g){var b=e(l,function(w){return w(v)});return{criteria:b,index:++d,value:v}});return i(y,function(v,p){return o(v,p,h)})}return hs=s,hs}var ps,cy;function Z1(){if(cy)return ps;cy=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return ps=e,ps}var ds,sy;function J1(){if(sy)return ds;sy=1;var e=Z1(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return gs=n,gs}var bs,dy;function rS(){if(dy)return bs;dy=1;var e=eS(),t=tS(),r=t(e);return bs=r,bs}var xs,vy;function nS(){if(vy)return xs;vy=1;var e=cn(),t=J1(),r=rS();function n(i,a){return r(t(i,a,e),i+"")}return xs=n,xs}var ws,yy;function Za(){if(yy)return ws;yy=1;var e=Zf(),t=vi(),r=fh(),n=Dt();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return ws=i,ws}var Os,my;function iS(){if(my)return Os;my=1;var e=z0(),t=Y1(),r=nS(),n=Za(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return Os=i,Os}var aS=iS();const vh=oe(aS);function Rn(e){"@babel/helpers - typeof";return Rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(e)}function Bl(){return Bl=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(dn,"-left"),q(r)&&t&&q(t.x)&&r=t.y),"".concat(dn,"-top"),q(n)&&t&&q(t.y)&&nv?Math.max(f,c[n]):Math.max(l,c[n])}function xS(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function wS(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,c=e.viewBox,s,f,l;return o.height>0&&o.width>0&&r?(f=xy({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),l=xy({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),s=xS({translateX:f,translateY:l,useTranslate3d:u})):s=gS,{cssProperties:s,cssClasses:bS({translateX:f,translateY:l,coordinate:r})}}function Rr(e){"@babel/helpers - typeof";return Rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rr(e)}function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Oy(e){for(var t=1;t_y||Math.abs(n.height-this.state.lastBoundingBox.height)>_y)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,u=i.animationDuration,c=i.animationEasing,s=i.children,f=i.coordinate,l=i.hasPayload,h=i.isAnimationActive,d=i.offset,y=i.position,v=i.reverseDirection,p=i.useTranslate3d,g=i.viewBox,b=i.wrapperStyle,w=wS({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:d,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:g}),O=w.cssClasses,m=w.cssProperties,x=Oy(Oy({transition:h&&a?"transform ".concat(u,"ms ").concat(c):void 0},m),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&l?"visible":"hidden",position:"absolute",top:0,left:0},b);return S.createElement("div",{tabIndex:-1,className:O,style:x,ref:function(A){n.wrapperNode=A}},s)}}])})(N.PureComponent),MS=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Nt={isSsr:MS()};function Dr(e){"@babel/helpers - typeof";return Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(e)}function Ay(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Sy(e){for(var t=1;t0;return S.createElement($S,{allowEscapeViewBox:o,animationDuration:u,animationEasing:c,isAnimationActive:h,active:a,coordinate:f,hasPayload:x,offset:d,position:p,reverseDirection:g,useTranslate3d:b,viewBox:w,wrapperStyle:O},FS(s,Sy(Sy({},this.props),{},{payload:m})))}}])})(N.PureComponent);yh(yt,"displayName","Tooltip");yh(yt,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Nt.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var As,Py;function WS(){if(Py)return As;Py=1;var e=pt(),t=function(){return e.Date.now()};return As=t,As}var Ss,Ty;function zS(){if(Ty)return Ss;Ty=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Ss=t,Ss}var Ps,Ey;function US(){if(Ey)return Ps;Ey=1;var e=zS(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Ps=r,Ps}var Ts,jy;function Z0(){if(jy)return Ts;jy=1;var e=US(),t=Dt(),r=an(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function c(s){if(typeof s=="number")return s;if(r(s))return n;if(t(s)){var f=typeof s.valueOf=="function"?s.valueOf():s;s=t(f)?f+"":f}if(typeof s!="string")return s===0?s:+s;s=e(s);var l=a.test(s);return l||o.test(s)?u(s.slice(2),l?2:8):i.test(s)?n:+s}return Ts=c,Ts}var Es,$y;function HS(){if($y)return Es;$y=1;var e=Dt(),t=WS(),r=Z0(),n="Expected a function",i=Math.max,a=Math.min;function o(u,c,s){var f,l,h,d,y,v,p=0,g=!1,b=!1,w=!0;if(typeof u!="function")throw new TypeError(n);c=r(c)||0,e(s)&&(g=!!s.leading,b="maxWait"in s,h=b?i(r(s.maxWait)||0,c):h,w="trailing"in s?!!s.trailing:w);function O(j){var I=f,M=l;return f=l=void 0,p=j,d=u.apply(M,I),d}function m(j){return p=j,y=setTimeout(A,c),g?O(j):d}function x(j){var I=j-v,M=j-p,k=c-I;return b?a(k,h-M):k}function _(j){var I=j-v,M=j-p;return v===void 0||I>=c||I<0||b&&M>=h}function A(){var j=t();if(_(j))return T(j);y=setTimeout(A,x(j))}function T(j){return y=void 0,w&&f?O(j):(f=l=void 0,d)}function $(){y!==void 0&&clearTimeout(y),p=0,f=v=l=y=void 0}function P(){return y===void 0?d:T(t())}function E(){var j=t(),I=_(j);if(f=arguments,l=this,v=j,I){if(y===void 0)return m(v);if(b)return clearTimeout(y),y=setTimeout(A,c),O(v)}return y===void 0&&(y=setTimeout(A,c)),d}return E.cancel=$,E.flush=P,E}return Es=o,Es}var js,My;function KS(){if(My)return js;My=1;var e=HS(),t=Dt(),r="Expected a function";function n(i,a,o){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return js=n,js}var GS=KS();const J0=oe(GS);function Nn(e){"@babel/helpers - typeof";return Nn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nn(e)}function Iy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ei(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(j=J0(j,v,{trailing:!0,leading:!1}));var I=new ResizeObserver(j),M=m.current.getBoundingClientRect(),k=M.width,R=M.height;return P(k,R),I.observe(m.current),function(){I.disconnect()}},[P,v]);var E=N.useMemo(function(){var j=T.containerWidth,I=T.containerHeight;if(j<0||I<0)return null;it(Zt(o)||Zt(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),it(!r||r>0,"The aspect(%s) must be greater than zero.",r);var M=Zt(o)?j:o,k=Zt(c)?I:c;r&&r>0&&(M?k=M/r:k&&(M=k*r),h&&k>h&&(k=h)),it(M>0||k>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,M,k,o,c,f,l,r);var R=!Array.isArray(d)&&wt(d.type).endsWith("Chart");return S.Children.map(d,function(L){return S.isValidElement(L)?N.cloneElement(L,Ei({width:M,height:k},R?{style:Ei({height:"100%",width:"100%",maxHeight:k,maxWidth:M},L.props.style)}:{})):L})},[r,d,c,h,l,f,T,o]);return S.createElement("div",{id:p?"".concat(p):void 0,className:Z("recharts-responsive-container",g),style:Ei(Ei({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:m},E)}),mh=function(t){return null};mh.displayName="Cell";function qn(e){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}function ky(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ul(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Nt.isSsr)return{width:0,height:0};var n=uP(r),i=JSON.stringify({text:t,copyStyle:n});if(br.widthCache[i])return br.widthCache[i];try{var a=document.getElementById(Ry);a||(a=document.createElement("span"),a.setAttribute("id",Ry),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=Ul(Ul({},oP),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return br.widthCache[i]=c,++br.cacheCount>aP&&(br.cacheCount=0,br.widthCache={}),c}catch{return{width:0,height:0}}},cP=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Ln(e){"@babel/helpers - typeof";return Ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(e)}function Zi(e,t){return hP(e)||fP(e,t)||lP(e,t)||sP()}function sP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lP(e,t){if(e){if(typeof e=="string")return Dy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dy(e,t)}}function Dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function PP(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Wy(e,t){return $P(e)||jP(e,t)||EP(e,t)||TP()}function TP(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EP(e,t){if(e){if(typeof e=="string")return zy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zy(e,t)}}function zy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return M.reduce(function(k,R){var L=R.word,B=R.width,H=k[k.length-1];if(H&&(i==null||a||H.width+B+nR.width?k:R})};if(!f)return d;for(var v="…",p=function(M){var k=l.slice(0,M),R=rx({breakAll:s,style:c,children:k+v}).wordsWithComputedWidth,L=h(R),B=L.length>o||y(L).width>Number(i);return[B,L]},g=0,b=l.length-1,w=0,O;g<=b&&w<=l.length-1;){var m=Math.floor((g+b)/2),x=m-1,_=p(x),A=Wy(_,2),T=A[0],$=A[1],P=p(m),E=Wy(P,1),j=E[0];if(!T&&!j&&(g=m+1),T&&j&&(b=m-1),!T&&j){O=$;break}w++}return O||d},Uy=function(t){var r=Y(t)?[]:t.toString().split(tx);return[{words:r}]},IP=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!Nt.isSsr){var c,s,f=rx({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return Uy(i);return MP({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return Uy(i)},Hy="#808080",ur=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,d=h===void 0?"start":h,y=t.verticalAnchor,v=y===void 0?"end":y,p=t.fill,g=p===void 0?Hy:p,b=Fy(t,AP),w=N.useMemo(function(){return IP({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:l,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,l,b.style,b.width]),O=b.dx,m=b.dy,x=b.angle,_=b.className,A=b.breakAll,T=Fy(b,SP);if(!Se(n)||!Se(a))return null;var $=n+(q(O)?O:0),P=a+(q(m)?m:0),E;switch(v){case"start":E=$s("calc(".concat(s,")"));break;case"middle":E=$s("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=$s("calc(".concat(w.length-1," * -").concat(u,")"));break}var j=[];if(l){var I=w[0].width,M=b.width;j.push("scale(".concat((q(M)?M/I:1)/I,")"))}return x&&j.push("rotate(".concat(x,", ").concat($,", ").concat(P,")")),j.length&&(T.transform=j.join(" ")),S.createElement("text",Hl({},U(T,!0),{x:$,y:P,className:Z("recharts-text",_),textAnchor:d,fill:g.includes("url")?Hy:g}),w.map(function(k,R){var L=k.words.join(A?"":" ");return S.createElement("tspan",{x:$,dy:R===0?E:u,key:"".concat(L,"-").concat(R)},L)}))};function Rt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function CP(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function gh(e){let t,r,n;e.length!==2?(t=Rt,r=(u,c)=>Rt(e(u),c),n=(u,c)=>e(u)-c):(t=e===Rt||e===CP?e:kP,r=e,n=e);function i(u,c,s=0,f=u.length){if(s>>1;r(u[l],c)<0?s=l+1:f=l}while(s>>1;r(u[l],c)<=0?s=l+1:f=l}while(ss&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function kP(){return 0}function nx(e){return e===null?NaN:+e}function*RP(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const DP=gh(Rt),yi=DP.right;gh(nx).center;class Ky extends Map{constructor(t,r=LP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Gy(this,t))}has(t){return super.has(Gy(this,t))}set(t,r){return super.set(NP(this,t),r)}delete(t){return super.delete(qP(this,t))}}function Gy({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function NP({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function qP({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function LP(e){return e!==null&&typeof e=="object"?e.valueOf():e}function BP(e=Rt){if(e===Rt)return ix;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function ix(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const FP=Math.sqrt(50),WP=Math.sqrt(10),zP=Math.sqrt(2);function Ji(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=FP?10:a>=WP?5:a>=zP?2:1;let u,c,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),c=Math.round(t*s),u/st&&--c,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),c=Math.round(t/s),u*st&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,c=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function Xy(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function ax(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?ix:BP(i);n>r;){if(n-r>600){const c=n-r+1,s=t-r+1,f=Math.log(c),l=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*l*(c-l)/c)*(s-c/2<0?-1:1),d=Math.max(r,Math.floor(t-s*l/c+h)),y=Math.min(n,Math.floor(t+(c-s)*l/c+h));ax(e,t,d,y,i)}const a=e[t];let o=r,u=n;for(vn(e,r,t),i(e[n],a)>0&&vn(e,r,n);o0;)--u}i(e[r],a)===0?vn(e,r,u):(++u,vn(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function vn(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function UP(e,t,r){if(e=Float64Array.from(RP(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Xy(e);if(t>=1)return Vy(e);var n,i=(n-1)*t,a=Math.floor(i),o=Vy(ax(e,a).subarray(0,a+1)),u=Xy(e.subarray(a+1));return o+(u-o)*(i-a)}}function HP(e,t,r=nx){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function KP(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?$i(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?$i(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=VP.exec(e))?new qe(t[1],t[2],t[3],1):(t=XP.exec(e))?new qe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=YP.exec(e))?$i(t[1],t[2],t[3],t[4]):(t=ZP.exec(e))?$i(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=JP.exec(e))?rm(t[1],t[2]/100,t[3]/100,1):(t=QP.exec(e))?rm(t[1],t[2]/100,t[3]/100,t[4]):Yy.hasOwnProperty(e)?Qy(Yy[e]):e==="transparent"?new qe(NaN,NaN,NaN,0):null}function Qy(e){return new qe(e>>16&255,e>>8&255,e&255,1)}function $i(e,t,r,n){return n<=0&&(e=t=r=NaN),new qe(e,t,r,n)}function rT(e){return e instanceof mi||(e=zn(e)),e?(e=e.rgb(),new qe(e.r,e.g,e.b,e.opacity)):new qe}function Yl(e,t,r,n){return arguments.length===1?rT(e):new qe(e,t,r,n??1)}function qe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}xh(qe,Yl,ux(mi,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new qe(rr(this.r),rr(this.g),rr(this.b),ea(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:em,formatHex:em,formatHex8:nT,formatRgb:tm,toString:tm}));function em(){return`#${Jt(this.r)}${Jt(this.g)}${Jt(this.b)}`}function nT(){return`#${Jt(this.r)}${Jt(this.g)}${Jt(this.b)}${Jt((isNaN(this.opacity)?1:this.opacity)*255)}`}function tm(){const e=ea(this.opacity);return`${e===1?"rgb(":"rgba("}${rr(this.r)}, ${rr(this.g)}, ${rr(this.b)}${e===1?")":`, ${e})`}`}function ea(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jt(e){return e=rr(e),(e<16?"0":"")+e.toString(16)}function rm(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,r,n)}function cx(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof mi||(e=zn(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,c=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&c<1?0:o,new nt(o,u,c,e.opacity)}function iT(e,t,r,n){return arguments.length===1?cx(e):new nt(e,t,r,n??1)}function nt(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}xh(nt,iT,ux(mi,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new qe(Ms(e>=240?e-240:e+120,i,n),Ms(e,i,n),Ms(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new nt(nm(this.h),Mi(this.s),Mi(this.l),ea(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ea(this.opacity);return`${e===1?"hsl(":"hsla("}${nm(this.h)}, ${Mi(this.s)*100}%, ${Mi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function nm(e){return e=(e||0)%360,e<0?e+360:e}function Mi(e){return Math.max(0,Math.min(1,e||0))}function Ms(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const wh=e=>()=>e;function aT(e,t){return function(r){return e+r*t}}function oT(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function uT(e){return(e=+e)==1?sx:function(t,r){return r-t?oT(t,r,e):wh(isNaN(t)?r:t)}}function sx(e,t){var r=t-e;return r?aT(e,r):wh(isNaN(e)?t:e)}const im=(function e(t){var r=uT(t);function n(i,a){var o=r((i=Yl(i)).r,(a=Yl(a)).r),u=r(i.g,a.g),c=r(i.b,a.b),s=sx(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=u(f),i.b=c(f),i.opacity=s(f),i+""}}return n.gamma=e,n})(1);function cT(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,c.push({i:o,x:ta(n,i)})),r=Is.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function bT(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?xT:bT,c=s=null,l}function l(h){return h==null||isNaN(h=+h)?a:(c||(c=u(e.map(n),t,r)))(n(o(h)))}return l.invert=function(h){return o(i((s||(s=u(t,e.map(n),ta)))(h)))},l.domain=function(h){return arguments.length?(e=Array.from(h,ra),f()):e.slice()},l.range=function(h){return arguments.length?(t=Array.from(h),f()):t.slice()},l.rangeRound=function(h){return t=Array.from(h),r=Oh,f()},l.clamp=function(h){return arguments.length?(o=h?!0:Re,f()):o!==Re},l.interpolate=function(h){return arguments.length?(r=h,f()):r},l.unknown=function(h){return arguments.length?(a=h,l):a},function(h,d){return n=h,i=d,f()}}function _h(){return Ja()(Re,Re)}function wT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function na(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Nr(e){return e=na(Math.abs(e)),e?e[1]:NaN}function OT(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),a.push(r.substring(i-=u,i+u)),!((c+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function _T(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var AT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Un(e){if(!(t=AT.exec(e)))throw new Error("invalid format: "+e);var t;return new Ah({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Un.prototype=Ah.prototype;function Ah(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Ah.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ST(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var lx;function PT(e,t){var r=na(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(lx=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+na(e,Math.max(0,t+a-1))[0]}function om(e,t){var r=na(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const um={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:wT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>om(e*100,t),r:om,s:PT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function cm(e){return e}var sm=Array.prototype.map,lm=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function TT(e){var t=e.grouping===void 0||e.thousands===void 0?cm:OT(sm.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?cm:_T(sm.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function s(l){l=Un(l);var h=l.fill,d=l.align,y=l.sign,v=l.symbol,p=l.zero,g=l.width,b=l.comma,w=l.precision,O=l.trim,m=l.type;m==="n"?(b=!0,m="g"):um[m]||(w===void 0&&(w=12),O=!0,m="g"),(p||h==="0"&&d==="=")&&(p=!0,h="0",d="=");var x=v==="$"?r:v==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",_=v==="$"?n:/[%p]/.test(m)?o:"",A=um[m],T=/[defgprs%]/.test(m);w=w===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function $(P){var E=x,j=_,I,M,k;if(m==="c")j=A(P)+j,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),w),O&&(P=ST(P)),R&&+P==0&&y!=="+"&&(R=!1),E=(R?y==="("?y:u:y==="-"||y==="("?"":y)+E,j=(m==="s"?lm[8+lx/3]:"")+j+(R&&y==="("?")":""),T){for(I=-1,M=P.length;++Ik||k>57){j=(k===46?i+P.slice(I+1):P.slice(I))+j,P=P.slice(0,I);break}}}b&&!p&&(P=t(P,1/0));var L=E.length+P.length+j.length,B=L>1)+E+P+j+B.slice(L);break;default:P=B+E+P+j;break}return a(P)}return $.toString=function(){return l+""},$}function f(l,h){var d=s((l=Un(l),l.type="f",l)),y=Math.max(-8,Math.min(8,Math.floor(Nr(h)/3)))*3,v=Math.pow(10,-y),p=lm[8+y/3];return function(g){return d(v*g)+p}}return{format:s,formatPrefix:f}}var Ii,Sh,fx;ET({thousands:",",grouping:[3],currency:["$",""]});function ET(e){return Ii=TT(e),Sh=Ii.format,fx=Ii.formatPrefix,Ii}function jT(e){return Math.max(0,-Nr(Math.abs(e)))}function $T(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nr(t)/3)))*3-Nr(Math.abs(e)))}function MT(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Nr(t)-Nr(e))+1}function hx(e,t,r,n){var i=Vl(e,t,r),a;switch(n=Un(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=$T(i,o))&&(n.precision=a),fx(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=MT(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=jT(i))&&(n.precision=a-(n.type==="%")*2);break}}return Sh(n)}function qt(e){var t=e.domain;return e.ticks=function(r){var n=t();return Kl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return hx(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],c,s,f=10;for(u0;){if(s=Gl(o,u,r),s===c)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;c=s}return e},e}function ia(){var e=_h();return e.copy=function(){return gi(e,ia())},Qe.apply(e,arguments),qt(e)}function px(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,ra),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return px(e).unknown(t)},e=arguments.length?Array.from(e,ra):[0,1],qt(r)}function dx(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function DT(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function pm(e){return(t,r)=>-e(-t,r)}function Ph(e){const t=e(fm,hm),r=t.domain;let n=10,i,a;function o(){return i=DT(n),a=RT(n),r()[0]<0?(i=pm(i),a=pm(a),e(IT,CT)):e(fm,hm),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const c=r();let s=c[0],f=c[c.length-1];const l=f0){for(;h<=d;++h)for(y=1;yf)break;g.push(v)}}else for(;h<=d;++h)for(y=n-1;y>=1;--y)if(v=h>0?y/a(-h):y*a(h),!(vf)break;g.push(v)}g.length*2{if(u==null&&(u=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Un(c)).precision==null&&(c.trim=!0),c=Sh(c)),u===1/0)return c;const s=Math.max(1,n*u/t.ticks().length);return f=>{let l=f/a(Math.round(i(f)));return l*nr(dx(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function vx(){const e=Ph(Ja()).domain([1,10]);return e.copy=()=>gi(e,vx()).base(e.base()),Qe.apply(e,arguments),e}function dm(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function vm(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Th(e){var t=1,r=e(dm(t),vm(t));return r.constant=function(n){return arguments.length?e(dm(t=+n),vm(t)):t},qt(r)}function yx(){var e=Th(Ja());return e.copy=function(){return gi(e,yx()).constant(e.constant())},Qe.apply(e,arguments)}function ym(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function NT(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qT(e){return e<0?-e*e:e*e}function Eh(e){var t=e(Re,Re),r=1;function n(){return r===1?e(Re,Re):r===.5?e(NT,qT):e(ym(r),ym(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},qt(t)}function jh(){var e=Eh(Ja());return e.copy=function(){return gi(e,jh()).exponent(e.exponent())},Qe.apply(e,arguments),e}function LT(){return jh.apply(null,arguments).exponent(.5)}function mm(e){return Math.sign(e)*e*e}function BT(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function mx(){var e=_h(),t=[0,1],r=!1,n;function i(a){var o=BT(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(mm(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,ra)).map(mm)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return mx(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Qe.apply(i,arguments),qt(i)}function gx(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return bx().domain([e,t]).range(i).unknown(a)},Qe.apply(qt(o),arguments)}function xx(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[yi(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return xx().domain(e).range(t).unknown(r)},Qe.apply(i,arguments)}const Cs=new Date,ks=new Date;function Pe(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const c=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return c;let s;do c.push(s=new Date(+a)),t(a,u),e(a);while(sPe(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(Cs.setTime(+a),ks.setTime(+o),e(Cs),e(ks),Math.floor(r(Cs,ks))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const aa=Pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);aa.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):aa);aa.range;const gt=1e3,Ze=gt*60,bt=Ze*60,_t=bt*24,$h=_t*7,gm=_t*30,Rs=_t*365,Qt=Pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*gt)},(e,t)=>(t-e)/gt,e=>e.getUTCSeconds());Qt.range;const Mh=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*gt)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getMinutes());Mh.range;const Ih=Pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getUTCMinutes());Ih.range;const Ch=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*gt-e.getMinutes()*Ze)},(e,t)=>{e.setTime(+e+t*bt)},(e,t)=>(t-e)/bt,e=>e.getHours());Ch.range;const kh=Pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*bt)},(e,t)=>(t-e)/bt,e=>e.getUTCHours());kh.range;const bi=Pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ze)/_t,e=>e.getDate()-1);bi.range;const Qa=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/_t,e=>e.getUTCDate()-1);Qa.range;const wx=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/_t,e=>Math.floor(e/_t));wx.range;function dr(e){return Pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Ze)/$h)}const eo=dr(0),oa=dr(1),FT=dr(2),WT=dr(3),qr=dr(4),zT=dr(5),UT=dr(6);eo.range;oa.range;FT.range;WT.range;qr.range;zT.range;UT.range;function vr(e){return Pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/$h)}const to=vr(0),ua=vr(1),HT=vr(2),KT=vr(3),Lr=vr(4),GT=vr(5),VT=vr(6);to.range;ua.range;HT.range;KT.range;Lr.range;GT.range;VT.range;const Rh=Pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Rh.range;const Dh=Pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Dh.range;const At=Pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());At.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});At.range;const St=Pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());St.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});St.range;function Ox(e,t,r,n,i,a){const o=[[Qt,1,gt],[Qt,5,5*gt],[Qt,15,15*gt],[Qt,30,30*gt],[a,1,Ze],[a,5,5*Ze],[a,15,15*Ze],[a,30,30*Ze],[i,1,bt],[i,3,3*bt],[i,6,6*bt],[i,12,12*bt],[n,1,_t],[n,2,2*_t],[r,1,$h],[t,1,gm],[t,3,3*gm],[e,1,Rs]];function u(s,f,l){const h=fp).right(o,h);if(d===o.length)return e.every(Vl(s/Rs,f/Rs,l));if(d===0)return aa.every(Math.max(Vl(s,f,l),1));const[y,v]=o[h/o[d-1][2]53)return null;"w"in D||(D.w=1),"Z"in D?(te=Ns(yn(D.y,0,1)),xe=te.getUTCDay(),te=xe>4||xe===0?ua.ceil(te):ua(te),te=Qa.offset(te,(D.V-1)*7),D.y=te.getUTCFullYear(),D.m=te.getUTCMonth(),D.d=te.getUTCDate()+(D.w+6)%7):(te=Ds(yn(D.y,0,1)),xe=te.getDay(),te=xe>4||xe===0?oa.ceil(te):oa(te),te=bi.offset(te,(D.V-1)*7),D.y=te.getFullYear(),D.m=te.getMonth(),D.d=te.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),xe="Z"in D?Ns(yn(D.y,0,1)).getUTCDay():Ds(yn(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(xe+5)%7:D.w+D.U*7-(xe+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Ns(D)):Ds(D)}}function A(F,J,Q,D){for(var de=0,te=J.length,xe=Q.length,we,Ne;de=xe)return-1;if(we=J.charCodeAt(de++),we===37){if(we=J.charAt(de++),Ne=m[we in bm?J.charAt(de++):we],!Ne||(D=Ne(F,Q,D))<0)return-1}else if(we!=Q.charCodeAt(D++))return-1}return D}function T(F,J,Q){var D=s.exec(J.slice(Q));return D?(F.p=f.get(D[0].toLowerCase()),Q+D[0].length):-1}function $(F,J,Q){var D=d.exec(J.slice(Q));return D?(F.w=y.get(D[0].toLowerCase()),Q+D[0].length):-1}function P(F,J,Q){var D=l.exec(J.slice(Q));return D?(F.w=h.get(D[0].toLowerCase()),Q+D[0].length):-1}function E(F,J,Q){var D=g.exec(J.slice(Q));return D?(F.m=b.get(D[0].toLowerCase()),Q+D[0].length):-1}function j(F,J,Q){var D=v.exec(J.slice(Q));return D?(F.m=p.get(D[0].toLowerCase()),Q+D[0].length):-1}function I(F,J,Q){return A(F,t,J,Q)}function M(F,J,Q){return A(F,r,J,Q)}function k(F,J,Q){return A(F,n,J,Q)}function R(F){return o[F.getDay()]}function L(F){return a[F.getDay()]}function B(F){return c[F.getMonth()]}function H(F){return u[F.getMonth()]}function V(F){return i[+(F.getHours()>=12)]}function W(F){return 1+~~(F.getMonth()/3)}function X(F){return o[F.getUTCDay()]}function fe(F){return a[F.getUTCDay()]}function me(F){return c[F.getUTCMonth()]}function Be(F){return u[F.getUTCMonth()]}function Wt(F){return i[+(F.getUTCHours()>=12)]}function De(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var J=x(F+="",w);return J.toString=function(){return F},J},parse:function(F){var J=_(F+="",!1);return J.toString=function(){return F},J},utcFormat:function(F){var J=x(F+="",O);return J.toString=function(){return F},J},utcParse:function(F){var J=_(F+="",!0);return J.toString=function(){return F},J}}}var bm={"-":"",_:" ",0:"0"},je=/^\s*\d+/,eE=/^%/,tE=/[\\^$*+?|[\]().{}]/g;function re(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function nE(e,t,r){var n=je.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function iE(e,t,r){var n=je.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function aE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function oE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function uE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function xm(e,t,r){var n=je.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function wm(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function cE(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function sE(e,t,r){var n=je.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function lE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Om(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function fE(e,t,r){var n=je.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function _m(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function hE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function pE(e,t,r){var n=je.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function dE(e,t,r){var n=je.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function vE(e,t,r){var n=je.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function yE(e,t,r){var n=eE.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function mE(e,t,r){var n=je.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function gE(e,t,r){var n=je.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function Am(e,t){return re(e.getDate(),t,2)}function bE(e,t){return re(e.getHours(),t,2)}function xE(e,t){return re(e.getHours()%12||12,t,2)}function wE(e,t){return re(1+bi.count(At(e),e),t,3)}function _x(e,t){return re(e.getMilliseconds(),t,3)}function OE(e,t){return _x(e,t)+"000"}function _E(e,t){return re(e.getMonth()+1,t,2)}function AE(e,t){return re(e.getMinutes(),t,2)}function SE(e,t){return re(e.getSeconds(),t,2)}function PE(e){var t=e.getDay();return t===0?7:t}function TE(e,t){return re(eo.count(At(e)-1,e),t,2)}function Ax(e){var t=e.getDay();return t>=4||t===0?qr(e):qr.ceil(e)}function EE(e,t){return e=Ax(e),re(qr.count(At(e),e)+(At(e).getDay()===4),t,2)}function jE(e){return e.getDay()}function $E(e,t){return re(oa.count(At(e)-1,e),t,2)}function ME(e,t){return re(e.getFullYear()%100,t,2)}function IE(e,t){return e=Ax(e),re(e.getFullYear()%100,t,2)}function CE(e,t){return re(e.getFullYear()%1e4,t,4)}function kE(e,t){var r=e.getDay();return e=r>=4||r===0?qr(e):qr.ceil(e),re(e.getFullYear()%1e4,t,4)}function RE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function Sm(e,t){return re(e.getUTCDate(),t,2)}function DE(e,t){return re(e.getUTCHours(),t,2)}function NE(e,t){return re(e.getUTCHours()%12||12,t,2)}function qE(e,t){return re(1+Qa.count(St(e),e),t,3)}function Sx(e,t){return re(e.getUTCMilliseconds(),t,3)}function LE(e,t){return Sx(e,t)+"000"}function BE(e,t){return re(e.getUTCMonth()+1,t,2)}function FE(e,t){return re(e.getUTCMinutes(),t,2)}function WE(e,t){return re(e.getUTCSeconds(),t,2)}function zE(e){var t=e.getUTCDay();return t===0?7:t}function UE(e,t){return re(to.count(St(e)-1,e),t,2)}function Px(e){var t=e.getUTCDay();return t>=4||t===0?Lr(e):Lr.ceil(e)}function HE(e,t){return e=Px(e),re(Lr.count(St(e),e)+(St(e).getUTCDay()===4),t,2)}function KE(e){return e.getUTCDay()}function GE(e,t){return re(ua.count(St(e)-1,e),t,2)}function VE(e,t){return re(e.getUTCFullYear()%100,t,2)}function XE(e,t){return e=Px(e),re(e.getUTCFullYear()%100,t,2)}function YE(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function ZE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Lr(e):Lr.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function JE(){return"+0000"}function Pm(){return"%"}function Tm(e){return+e}function Em(e){return Math.floor(+e/1e3)}var xr,Tx,Ex;QE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function QE(e){return xr=QT(e),Tx=xr.format,xr.parse,Ex=xr.utcFormat,xr.utcParse,xr}function ej(e){return new Date(e)}function tj(e){return e instanceof Date?+e:+new Date(+e)}function Nh(e,t,r,n,i,a,o,u,c,s){var f=_h(),l=f.invert,h=f.domain,d=s(".%L"),y=s(":%S"),v=s("%I:%M"),p=s("%I %p"),g=s("%a %d"),b=s("%b %d"),w=s("%B"),O=s("%Y");function m(x){return(c(x)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>UP(e,a/n))},r.copy=function(){return Ix(t).domain(e)},Et.apply(r,arguments)}function no(){var e=0,t=.5,r=1,n=1,i,a,o,u,c,s=Re,f,l=!1,h;function d(v){return isNaN(v=+v)?h:(v=.5+((v=+f(v))-a)*(n*vr}return Ls=e,Ls}var Bs,Im;function oj(){if(Im)return Bs;Im=1;var e=io(),t=Dx(),r=cn();function n(i){return i&&i.length?e(i,r,t):void 0}return Bs=n,Bs}var uj=oj();const Ct=oe(uj);var Fs,Cm;function Nx(){if(Cm)return Fs;Cm=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};z.decimalPlaces=z.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*he;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};z.dividedBy=z.div=function(e){return Ot(this,new this.constructor(e))};z.dividedToIntegerBy=z.idiv=function(e){var t=this,r=t.constructor;return ue(Ot(t,new r(e),0,1),r.precision)};z.equals=z.eq=function(e){return!this.cmp(e)};z.exponent=function(){return be(this)};z.greaterThan=z.gt=function(e){return this.cmp(e)>0};z.greaterThanOrEqualTo=z.gte=function(e){return this.cmp(e)>=0};z.isInteger=z.isint=function(){return this.e>this.d.length-2};z.isNegative=z.isneg=function(){return this.s<0};z.isPositive=z.ispos=function(){return this.s>0};z.isZero=function(){return this.s===0};z.lessThan=z.lt=function(e){return this.cmp(e)<0};z.lessThanOrEqualTo=z.lte=function(e){return this.cmp(e)<1};z.logarithm=z.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ue))throw Error(Je+"NaN");if(r.s<1)throw Error(Je+(r.s?"NaN":"-Infinity"));return r.eq(Ue)?new n(0):(pe=!1,t=Ot(Hn(r,a),Hn(e,a),a),pe=!0,ue(t,i))};z.minus=z.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Fx(t,e):Lx(t,(e.s=-e.s,e))};z.modulo=z.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(Je+"NaN");return r.s?(pe=!1,t=Ot(r,e,0,1).times(e),pe=!0,r.minus(t)):ue(new n(r),i)};z.naturalExponential=z.exp=function(){return Bx(this)};z.naturalLogarithm=z.ln=function(){return Hn(this)};z.negated=z.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};z.plus=z.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Lx(t,e):Fx(t,(e.s=-e.s,e))};z.precision=z.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(nr+e);if(t=be(i)+1,n=i.d.length-1,r=n*he+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};z.squareRoot=z.sqrt=function(){var e,t,r,n,i,a,o,u=this,c=u.constructor;if(u.s<1){if(!u.s)return new c(0);throw Error(Je+"NaN")}for(e=be(u),pe=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=ut(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=fn((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(a=n,n=a.plus(Ot(u,a,o+2)).times(.5),ut(a.d).slice(0,o)===(t=ut(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(ue(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return pe=!0,ue(n,r)};z.times=z.mul=function(e){var t,r,n,i,a,o,u,c,s,f=this,l=f.constructor,h=f.d,d=(e=new l(e)).d;if(!f.s||!e.s)return new l(0);for(e.s*=f.s,r=f.e+e.e,c=h.length,s=d.length,c=0;){for(t=0,i=c+n;i>n;)u=a[i]+d[n]*h[i-n-1]+t,a[i--]=u%Te|0,t=u/Te|0;a[i]=(a[i]+t)%Te|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,pe?ue(e,l.precision):e};z.toDecimalPlaces=z.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(ht(e,0,ln),t===void 0?t=n.rounding:ht(t,0,8),ue(r,e+be(r)+1,t))};z.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=sr(n,!0):(ht(e,0,ln),t===void 0?t=i.rounding:ht(t,0,8),n=ue(new i(n),e+1,t),r=sr(n,!0,e+1)),r};z.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?sr(i):(ht(e,0,ln),t===void 0?t=a.rounding:ht(t,0,8),n=ue(new a(i),e+be(i)+1,t),r=sr(n.abs(),!1,e+be(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};z.toInteger=z.toint=function(){var e=this,t=e.constructor;return ue(new t(e),be(e)+1,t.rounding)};z.toNumber=function(){return+this};z.toPower=z.pow=function(e){var t,r,n,i,a,o,u=this,c=u.constructor,s=12,f=+(e=new c(e));if(!e.s)return new c(Ue);if(u=new c(u),!u.s){if(e.s<1)throw Error(Je+"Infinity");return u}if(u.eq(Ue))return u;if(n=c.precision,e.eq(Ue))return ue(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=f<0?-f:f)<=qx){for(i=new c(Ue),t=Math.ceil(n/he+4),pe=!1;r%2&&(i=i.times(u),Lm(i.d,t)),r=fn(r/2),r!==0;)u=u.times(u),Lm(u.d,t);return pe=!0,e.s<0?new c(Ue).div(i):ue(i,n)}}else if(a<0)throw Error(Je+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,pe=!1,i=e.times(Hn(u,n+s)),pe=!0,i=Bx(i),i.s=a,i};z.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=be(i),n=sr(i,r<=a.toExpNeg||r>=a.toExpPos)):(ht(e,1,ln),t===void 0?t=a.rounding:ht(t,0,8),i=ue(new a(i),e,t),r=be(i),n=sr(i,e<=r||r<=a.toExpNeg,e)),n};z.toSignificantDigits=z.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(ht(e,1,ln),t===void 0?t=n.rounding:ht(t,0,8)),ue(new n(r),e,t)};z.toString=z.valueOf=z.val=z.toJSON=z[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=be(e),r=e.constructor;return sr(e,t<=r.toExpNeg||t>=r.toExpPos)};function Lx(e,t){var r,n,i,a,o,u,c,s,f=e.constructor,l=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),pe?ue(t,l):t;if(c=e.d,s=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(n=c,a=-a,u=s.length):(n=s,i=o,u=c.length),o=Math.ceil(l/he),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=c.length,a=s.length,u-a<0&&(a=u,n=s,s=c,c=n),r=0;a;)r=(c[--a]=c[a]+s[a]+r)/Te|0,c[a]%=Te;for(r&&(c.unshift(r),++i),u=c.length;c[--u]==0;)c.pop();return t.d=c,t.e=i,pe?ue(t,l):t}function ht(e,t,r){if(e!==~~e||er)throw Error(nr+e)}function ut(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=c=0;ui[u]?1:-1;break}return c}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,c,s,f,l,h,d,y,v,p,g,b,w,O,m,x,_,A,T=n.constructor,$=n.s==i.s?1:-1,P=n.d,E=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(Je+"Division by zero");for(c=n.e-i.e,_=E.length,m=P.length,d=new T($),y=d.d=[],s=0;E[s]==(P[s]||0);)++s;if(E[s]>(P[s]||0)&&--c,a==null?b=a=T.precision:o?b=a+(be(n)-be(i))+1:b=a,b<0)return new T(0);if(b=b/he+2|0,s=0,_==1)for(f=0,E=E[0],b++;(s1&&(E=e(E,f),P=e(P,f),_=E.length,m=P.length),O=_,v=P.slice(0,_),p=v.length;p<_;)v[p++]=0;A=E.slice(),A.unshift(0),x=E[0],E[1]>=Te/2&&++x;do f=0,u=t(E,v,_,p),u<0?(g=v[0],_!=p&&(g=g*Te+(v[1]||0)),f=g/x|0,f>1?(f>=Te&&(f=Te-1),l=e(E,f),h=l.length,p=v.length,u=t(l,v,h,p),u==1&&(f--,r(l,_16)throw Error(Bh+be(e));if(!e.s)return new f(Ue);for(pe=!1,u=l,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(Xt(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new f(Ue),f.precision=u;;){if(i=ue(i.times(e),u),r=r.times(++c),o=a.plus(Ot(i,r,u)),ut(o.d).slice(0,u)===ut(a.d).slice(0,u)){for(;s--;)a=ue(a.times(a),u);return f.precision=l,t==null?(pe=!0,ue(a,l)):a}a=o}}function be(e){for(var t=e.e*he,r=e.d[0];r>=10;r/=10)t++;return t}function Ks(e,t,r){if(t>e.LN10.sd())throw pe=!0,r&&(e.precision=r),Error(Je+"LN10 precision limit exceeded");return ue(new e(e.LN10),t)}function Mt(e){for(var t="";e--;)t+="0";return t}function Hn(e,t){var r,n,i,a,o,u,c,s,f,l=1,h=10,d=e,y=d.d,v=d.constructor,p=v.precision;if(d.s<1)throw Error(Je+(d.s?"NaN":"-Infinity"));if(d.eq(Ue))return new v(0);if(t==null?(pe=!1,s=p):s=t,d.eq(10))return t==null&&(pe=!0),Ks(v,s);if(s+=h,v.precision=s,r=ut(y),n=r.charAt(0),a=be(d),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)d=d.times(e),r=ut(d.d),n=r.charAt(0),l++;a=be(d),n>1?(d=new v("0."+r),a++):d=new v(n+"."+r.slice(1))}else return c=Ks(v,s+2,p).times(a+""),d=Hn(new v(n+"."+r.slice(1)),s-h).plus(c),v.precision=p,t==null?(pe=!0,ue(d,p)):d;for(u=o=d=Ot(d.minus(Ue),d.plus(Ue),s),f=ue(d.times(d),s),i=3;;){if(o=ue(o.times(f),s),c=u.plus(Ot(o,new v(i),s)),ut(c.d).slice(0,s)===ut(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(Ks(v,s+2,p).times(a+""))),u=Ot(u,new v(l),s),v.precision=p,t==null?(pe=!0,ue(u,p)):u;u=c,i+=2}}function qm(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=fn(r/he),e.d=[],n=(r+1)%he,r<0&&(n+=he),nca||e.e<-ca))throw Error(Bh+r)}else e.s=0,e.e=0,e.d=[0];return e}function ue(e,t,r){var n,i,a,o,u,c,s,f,l=e.d;for(o=1,a=l[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=he,i=t,s=l[f=0];else{if(f=Math.ceil((n+1)/he),a=l.length,f>=a)return e;for(s=a=l[f],o=1;a>=10;a/=10)o++;n%=he,i=n-he+o}if(r!==void 0&&(a=Xt(10,o-i-1),u=s/a%10|0,c=t<0||l[f+1]!==void 0||s%a,c=r<4?(u||c)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||c||r==6&&(n>0?i>0?s/Xt(10,o-i):0:l[f-1])%10&1||r==(e.s<0?8:7))),t<1||!l[0])return c?(a=be(e),l.length=1,t=t-a-1,l[0]=Xt(10,(he-t%he)%he),e.e=fn(-t/he)||0):(l.length=1,l[0]=e.e=e.s=0),e;if(n==0?(l.length=f,a=1,f--):(l.length=f+1,a=Xt(10,he-n),l[f]=i>0?(s/Xt(10,o-i)%Xt(10,i)|0)*a:0),c)for(;;)if(f==0){(l[0]+=a)==Te&&(l[0]=1,++e.e);break}else{if(l[f]+=a,l[f]!=Te)break;l[f--]=0,a=1}for(n=l.length;l[--n]===0;)l.pop();if(pe&&(e.e>ca||e.e<-ca))throw Error(Bh+be(e));return e}function Fx(e,t){var r,n,i,a,o,u,c,s,f,l,h=e.constructor,d=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),pe?ue(t,d):t;if(c=e.d,l=t.d,n=t.e,s=e.e,c=c.slice(),o=s-n,o){for(f=o<0,f?(r=c,o=-o,u=l.length):(r=l,n=s,u=c.length),i=Math.max(Math.ceil(d/he),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,u=l.length,f=i0;--i)c[u++]=0;for(i=l.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+Mt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Mt(-i-1)+a,r&&(n=r-o)>0&&(a+=Mt(n))):i>=o?(a+=Mt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Mt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=Mt(n))),e.s<0?"-"+a:a}function Lm(e,t){if(e.length>t)return e.length=t,!0}function Wx(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(nr+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return qm(o,a.toString())}else if(typeof a!="string")throw Error(nr+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,mj.test(a))qm(o,a);else throw Error(nr+a)}if(i.prototype=z,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=Wx,i.config=i.set=gj,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(nr+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(nr+r+": "+n);return this}var Fh=Wx(yj);Ue=new Fh(1);const ae=Fh;function bj(e){return _j(e)||Oj(e)||wj(e)||xj()}function xj(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wj(e,t){if(e){if(typeof e=="string")return Ql(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ql(e,t)}}function Oj(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function _j(e){if(Array.isArray(e))return Ql(e)}function Ql(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-o,Bm(function(){for(var u=arguments.length,c=new Array(u),s=0;se.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function qj(e){if(Array.isArray(e))return e}function Gx(e){var t=Kn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function Vx(e,t,r){if(e.lte(0))return new ae(0);var n=uo.getDigitCount(e.toNumber()),i=new ae(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ae(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ae(Math.ceil(c))}function Lj(e,t,r){var n=1,i=new ae(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ae(10).pow(uo.getDigitCount(e)-1),i=new ae(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ae(Math.floor(e)))}else e===0?i=new ae(Math.floor((t-1)/2)):r||(i=new ae(Math.floor(e)));var o=Math.floor((t-1)/2),u=Tj(Pj(function(c){return i.add(new ae(c-o).mul(n)).toNumber()}),ef);return u(0,t)}function Xx(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ae(0),tickMin:new ae(0),tickMax:new ae(0)};var a=Vx(new ae(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ae(0):(o=new ae(e).add(t).div(2),o=o.sub(new ae(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ae(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?Xx(e,t,r,n,i+1):(s0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ae(u).mul(a)),tickMax:o.add(new ae(c).mul(a))})}function Bj(e){var t=Kn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=Gx([r,n]),c=Kn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(rf(ef(0,i-1).map(function(){return 1/0}))):[].concat(rf(ef(0,i-1).map(function(){return-1/0})),[f]);return r>n?tf(l):l}if(s===f)return Lj(s,i,a);var h=Xx(s,f,o,a),d=h.step,y=h.tickMin,v=h.tickMax,p=uo.rangeStep(y,v.add(new ae(.1).mul(d)),d);return r>n?tf(p):p}function Fj(e,t){var r=Kn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Gx([n,i]),u=Kn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=Vx(new ae(s).sub(c).div(f-1),a,0),h=[].concat(rf(uo.rangeStep(new ae(c),new ae(s).sub(new ae(.99).mul(l)),l)),[s]);return n>i?tf(h):h}var Wj=Hx(Bj),zj=Hx(Fj),Uj="Invariant failed";function lr(e,t){throw new Error(Uj)}var Hj=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function sa(){return sa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Jj(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function e$(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,d=void 0;if(Ce(l-f)!==Ce(h-l)){var y=[];if(Ce(h-l)===Ce(c[1]-c[0])){d=h;var v=l+c[1]-c[0];y[0]=Math.min(v,(v+f)/2),y[1]=Math.max(v,(v+f)/2)}else{d=f;var p=h+c[1]-c[0];y[0]=Math.min(l,(p+l)/2),y[1]=Math.max(l,(p+l)/2)}var g=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(t>g[0]&&t<=g[1]||t>=y[0]&&t<=y[1]){o=i[s].index;break}}else{var b=Math.min(f,h),w=Math.max(f,h);if(t>(b+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O0&&O(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},Wh=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},m$=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c=0});if(g&&g.length){var b=g[0].type.defaultProps,w=b!==void 0?ve(ve({},b),g[0].props):g[0].props,O=w.barSize,m=w[p];o[m]||(o[m]=[]);var x=Y(O)?r:O;o[m].push({item:g[0],stackList:g.slice(1),barSize:Y(x)?void 0:ke(x,n,0)})}}return o},g$=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=ke(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,d=i/c,y=o.reduce(function(O,m){return O+m.barSize||0},0);y+=(c-1)*s,y>=i&&(y-=(c-1)*s,s=0),y>=i&&d>0&&(h=!0,d*=.9,y=c*d);var v=(i-y)/2>>0,p={offset:v-s,size:0};f=o.reduce(function(O,m){var x={item:m.item,position:{offset:p.offset+p.size+s,size:h?d:m.barSize}},_=[].concat(zm(O),[x]);return p=_[_.length-1].position,m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:p})}),_},l)}else{var g=ke(n,i,0,!0);i-2*g-(c-1)*s<=0&&(s=0);var b=(i-2*g-(c-1)*s)/c;b>1&&(b>>=0);var w=u===+u?Math.min(b,u):b;f=o.reduce(function(O,m,x){var _=[].concat(zm(O),[{item:m.item,position:{offset:g+(b+s)*x+(b-w)/2,size:w}}]);return m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},l)}return f},b$=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.right||0),s=Qx({children:a,legendWidth:c});if(s){var f=i||{},l=f.width,h=f.height,d=s.align,y=s.verticalAlign,v=s.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&d!=="center"&&q(t[d]))return ve(ve({},t),{},Mr({},d,t[d]+(l||0)));if((v==="horizontal"||v==="vertical"&&d==="center")&&y!=="middle"&&q(t[y]))return ve(ve({},t),{},Mr({},y,t[y]+(h||0)))}return t},x$=function(t,r,n){return Y(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},ew=function(t,r,n,i,a){var o=r.props.children,u=Ke(o,xi).filter(function(s){return x$(i,a,s.props.direction)});if(u&&u.length){var c=u.map(function(s){return s.props.dataKey});return t.reduce(function(s,f){var l=ye(f,n);if(Y(l))return s;var h=Array.isArray(l)?[ao(l),Ct(l)]:[l,l],d=c.reduce(function(y,v){var p=ye(f,v,0),g=h[0]-Math.abs(Array.isArray(p)?p[0]:p),b=h[1]+Math.abs(Array.isArray(p)?p[1]:p);return[Math.min(g,y[0]),Math.max(b,y[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0])}return null},w$=function(t,r,n,i,a){var o=r.map(function(u){return ew(t,u,n,a,i)}).filter(function(u){return!Y(u)});return o&&o.length?o.reduce(function(u,c){return[Math.min(u[0],c[0]),Math.max(u[1],c[1])]},[1/0,-1/0]):null},tw=function(t,r,n,i,a){var o=r.map(function(c){var s=c.props.dataKey;return n==="number"&&s&&ew(t,c,s,i)||En(t,s,n,a)});if(n==="number")return o.reduce(function(c,s){return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);var u={};return o.reduce(function(c,s){for(var f=0,l=s.length;f=2?Ce(u[0]-u[1])*2*s:s,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(l){var h=a?a.indexOf(l):l;return{coordinate:i(h)+s,value:l,offset:s}});return f.filter(function(l){return!un(l.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(l,h){return{coordinate:i(l)+s,value:l,index:h,offset:s}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(l){return{coordinate:i(l)+s,value:l,offset:s}}):i.domain().map(function(l,h){return{coordinate:i(l)+s,value:a?a[l]:l,index:h,offset:s}})},Gs=new WeakMap,Ci=function(t,r){if(typeof r!="function")return t;Gs.has(t)||Gs.set(t,new WeakMap);var n=Gs.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},iw=function(t,r,n){var i=t.scale,a=t.type,o=t.layout,u=t.axisType;if(i==="auto")return o==="radial"&&u==="radiusAxis"?{scale:Bn(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:ia(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Tn(),realScaleType:"point"}:a==="category"?{scale:Bn(),realScaleType:"band"}:{scale:ia(),realScaleType:"linear"};if(ar(i)){var c="scale".concat(Ha(i));return{scale:(jm[c]||Tn)(),realScaleType:jm[c]?c:"point"}}return G(i)?{scale:i}:{scale:Tn(),realScaleType:"point"}},Hm=1e-4,aw=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),a=Math.min(i[0],i[1])-Hm,o=Math.max(i[0],i[1])+Hm,u=t(r[0]),c=t(r[n-1]);(uo||co)&&t.domain([r[0],r[n-1]])}},O$=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[u][n][0]=a,t[u][n][1]=a+c,a=t[u][n][1]):(t[u][n][0]=o,t[u][n][1]=o+c,o=t[u][n][1])}},S$=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[o][n][0]=a,t[o][n][1]=a+u,a=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},P$={sign:A$,expand:pA,none:Ir,silhouette:dA,wiggle:vA,positive:S$},T$=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),a=P$[n],o=hA().keys(i).value(function(u,c){return+ye(u,c,0)}).order(Rl).offset(a);return o(t)},E$=function(t,r,n,i,a,o){if(!t)return null;var u=o?r.reverse():r,c={},s=u.reduce(function(l,h){var d,y=(d=h.type)!==null&&d!==void 0&&d.defaultProps?ve(ve({},h.type.defaultProps),h.props):h.props,v=y.stackId,p=y.hide;if(p)return l;var g=y[n],b=l[g]||{hasStack:!1,stackGroups:{}};if(Se(v)){var w=b.stackGroups[v]||{numericAxisId:n,cateAxisId:i,items:[]};w.items.push(h),b.hasStack=!0,b.stackGroups[v]=w}else b.stackGroups[pr("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return ve(ve({},l),{},Mr({},g,b))},c),f={};return Object.keys(s).reduce(function(l,h){var d=s[h];if(d.hasStack){var y={};d.stackGroups=Object.keys(d.stackGroups).reduce(function(v,p){var g=d.stackGroups[p];return ve(ve({},v),{},Mr({},p,{numericAxisId:n,cateAxisId:i,items:g.items,stackedData:T$(t,g.items,a)}))},y)}return ve(ve({},l),{},Mr({},h,d))},f)},ow=function(t,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,u=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var s=t.domain();if(!s.length)return null;var f=Wj(s,a,u);return t.domain([ao(f),Ct(f)]),{niceTicks:f}}if(a&&i==="number"){var l=t.domain(),h=zj(l,a,u);return{niceTicks:h}}return null};function fa(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Y(i[t.dataKey])){var u=Bi(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=ye(i,Y(o)?t.dataKey:o);return Y(c)?null:t.scale(c)}var Km=function(t){var r=t.axis,n=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var c=ye(o,r.dataKey,r.domain[u]);return Y(c)?null:r.scale(c)-a/2+i},j$=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},$$=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Se(a)){var o=r[a];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},M$=function(t){return t.reduce(function(r,n){return[ao(n.concat([r[0]]).filter(q)),Ct(n.concat([r[1]]).filter(q))]},[1/0,-1/0])},uw=function(t,r,n){return Object.keys(t).reduce(function(i,a){var o=t[a],u=o.stackedData,c=u.reduce(function(s,f){var l=M$(f.slice(r,n+1));return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Gm=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vm=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uf=function(t,r,n){if(G(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(q(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(Gm.test(t[0])){var a=+Gm.exec(t[0])[1];i[0]=r[0]-a}else G(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(q(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(Vm.test(t[1])){var o=+Vm.exec(t[1])[1];i[1]=r[1]+o}else G(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},ha=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var a=vh(r,function(l){return l.coordinate}),o=1/0,u=1,c=a.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},B$=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=ke(t.cx,o,o/2),l=ke(t.cy,u,u/2),h=lw(o,u,n),d=ke(t.innerRadius,h,0),y=ke(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(p,g){var b=r[g],w=b.domain,O=b.reversed,m;if(Y(b.range))i==="angleAxis"?m=[c,s]:i==="radiusAxis"&&(m=[d,y]),O&&(m=[m[1],m[0]]);else{m=b.range;var x=m,_=k$(x,2);c=_[0],s=_[1]}var A=iw(b,a),T=A.realScaleType,$=A.scale;$.domain(w).range(m),aw($);var P=ow($,mt(mt({},b),{},{realScaleType:T})),E=mt(mt(mt({},b),P),{},{range:m,radius:y,realScaleType:T,scale:$,cx:f,cy:l,innerRadius:d,outerRadius:y,startAngle:c,endAngle:s});return mt(mt({},p),{},sw({},g,E))},{})},F$=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},W$=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=F$({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:L$(s),angleInRadian:s}},z$=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},U$=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},Jm=function(t,r){var n=t.x,i=t.y,a=W$({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(os)return!1;if(o===0)return!0;var f=z$(r),l=f.startAngle,h=f.endAngle,d=u,y;if(l<=h){for(;d>h;)d-=360;for(;d=l&&d<=h}else{for(;d>l;)d-=360;for(;d=h&&d<=l}return y?mt(mt({},r),{},{radius:o,angle:U$(d,r)}):null},fw=function(t){return!N.isValidElement(t)&&!G(t)&&typeof t!="boolean"?t.className:""};function Yn(e){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(e)}var H$=["offset"];function K$(e){return Y$(e)||X$(e)||V$(e)||G$()}function G$(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V$(e,t){if(e){if(typeof e=="string")return cf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cf(e,t)}}function X$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Y$(e){if(Array.isArray(e))return cf(e)}function cf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function J$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _e(e){for(var t=1;t=0?1:-1,w,O;i==="insideStart"?(w=d+b*o,O=v):i==="insideEnd"?(w=y-b*o,O=!v):i==="end"&&(w=y+b*o,O=v),O=g<=0?O:!O;var m=le(s,f,p,w),x=le(s,f,p,w+(O?1:-1)*359),_="M".concat(m.x,",").concat(m.y,` + A`).concat(p,",").concat(p,",0,1,").concat(O?0:1,`, + `).concat(x.x,",").concat(x.y),A=Y(t.id)?pr("recharts-radial-line-"):t.id;return S.createElement("text",Zn({},n,{dominantBaseline:"central",className:Z("recharts-radial-bar-label",u)}),S.createElement("defs",null,S.createElement("path",{id:A,d:_})),S.createElement("textPath",{xlinkHref:"#".concat(A)},r))},aM=function(t){var r=t.viewBox,n=t.offset,i=t.position,a=r,o=a.cx,u=a.cy,c=a.innerRadius,s=a.outerRadius,f=a.startAngle,l=a.endAngle,h=(f+l)/2;if(i==="outside"){var d=le(o,u,s+n,h),y=d.x,v=d.y;return{x:y,y:v,textAnchor:y>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var p=(c+s)/2,g=le(o,u,p,h),b=g.x,w=g.y;return{x:b,y:w,textAnchor:"middle",verticalAnchor:"middle"}},oM=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,d=l>0?"end":"start",y=l>0?"start":"end",v=s>=0?1:-1,p=v*i,g=v>0?"end":"start",b=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:d};return _e(_e({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:y};return _e(_e({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var m={x:u-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"};return _e(_e({},m),n?{width:Math.max(m.x-n.x,0),height:f}:{})}if(a==="right"){var x={x:u+s+p,y:c+f/2,textAnchor:b,verticalAnchor:"middle"};return _e(_e({},x),n?{width:Math.max(n.x+n.width-x.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?_e({x:u+p,y:c+f/2,textAnchor:b,verticalAnchor:"middle"},_):a==="insideRight"?_e({x:u+s-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"},_):a==="insideTop"?_e({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:y},_):a==="insideBottom"?_e({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:d},_):a==="insideTopLeft"?_e({x:u+p,y:c+h,textAnchor:b,verticalAnchor:y},_):a==="insideTopRight"?_e({x:u+s-p,y:c+h,textAnchor:g,verticalAnchor:y},_):a==="insideBottomLeft"?_e({x:u+p,y:c+f-h,textAnchor:b,verticalAnchor:d},_):a==="insideBottomRight"?_e({x:u+s-p,y:c+f-h,textAnchor:g,verticalAnchor:d},_):on(a)&&(q(a.x)||Zt(a.x))&&(q(a.y)||Zt(a.y))?_e({x:u+ke(a.x,s),y:c+ke(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):_e({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},uM=function(t){return"cx"in t&&q(t.cx)};function Ee(e){var t=e.offset,r=t===void 0?5:t,n=Z$(e,H$),i=_e({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||Y(u)&&Y(c)&&!N.isValidElement(s)&&!G(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var d;if(G(s)){if(d=N.createElement(s,i),N.isValidElement(d))return d}else d=rM(i);var y=uM(a),v=U(i,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return iM(i,d,v);var p=y?aM(i):oM(i);return S.createElement(ur,Zn({className:Z("recharts-label",l)},v,p,{breakAll:h}),d)}Ee.displayName="Label";var hw=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,d=t.top,y=t.left,v=t.width,p=t.height,g=t.clockWise,b=t.labelViewBox;if(b)return b;if(q(v)&&q(p)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:p};if(q(d)&&q(y))return{x:d,y,width:v,height:p}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:g}:t.viewBox?t.viewBox:{}},cM=function(t,r){return t?t===!0?S.createElement(Ee,{key:"label-implicit",viewBox:r}):Se(t)?S.createElement(Ee,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Ee?N.cloneElement(t,{key:"label-implicit",viewBox:r}):S.createElement(Ee,{key:"label-implicit",content:t,viewBox:r}):G(t)?S.createElement(Ee,{key:"label-implicit",content:t,viewBox:r}):on(t)?S.createElement(Ee,Zn({viewBox:r},t,{key:"label-implicit"})):null:null},sM=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=hw(t),o=Ke(i,Ee).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=cM(t.label,r||a);return[u].concat(K$(o))};Ee.parseViewBox=hw;Ee.renderCallByParent=sM;var Vs,eg;function lM(){if(eg)return Vs;eg=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Vs=e,Vs}var fM=lM();const hM=oe(fM);function Jn(e){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jn(e)}var pM=["valueAccessor"],dM=["data","dataKey","clockWise","id","textBreakAll"];function vM(e){return bM(e)||gM(e)||mM(e)||yM()}function yM(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mM(e,t){if(e){if(typeof e=="string")return sf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sf(e,t)}}function gM(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bM(e){if(Array.isArray(e))return sf(e)}function sf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _M(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var AM=function(t){return Array.isArray(t.value)?hM(t.value):t.value};function lt(e){var t=e.valueAccessor,r=t===void 0?AM:t,n=ng(e,pM),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=ng(n,dM);return!i||!i.length?null:S.createElement(ee,{className:"recharts-label-list"},i.map(function(f,l){var h=Y(a)?r(f,l):ye(f&&f.payload,a),d=Y(u)?{}:{id:"".concat(u,"-").concat(l)};return S.createElement(Ee,da({},U(f,!0),s,d,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:Ee.parseViewBox(Y(o)?f:rg(rg({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}lt.displayName="LabelList";function SM(e,t){return e?e===!0?S.createElement(lt,{key:"labelList-implicit",data:t}):S.isValidElement(e)||G(e)?S.createElement(lt,{key:"labelList-implicit",data:t,content:e}):on(e)?S.createElement(lt,da({data:t},e,{key:"labelList-implicit"})):null:null}function PM(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Ke(n,lt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=SM(e.label,t);return[a].concat(vM(i))}lt.renderCallByParent=PM;function Qn(e){"@babel/helpers - typeof";return Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qn(e)}function lf(){return lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>s),`, + `).concat(l.x,",").concat(l.y,` + `);if(i>0){var d=le(r,n,i,o),y=le(r,n,i,s);h+="L ".concat(y.x,",").concat(y.y,` + A `).concat(i,",").concat(i,`,0, + `).concat(+(Math.abs(c)>180),",").concat(+(o<=s),`, + `).concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},MM=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=Ce(f-s),h=ki({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),d=h.circleTangency,y=h.lineTangency,v=h.theta,p=ki({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),g=p.circleTangency,b=p.lineTangency,w=p.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(y.x,",").concat(y.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):pw({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var m="M ".concat(y.x,",").concat(y.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(d.x,",").concat(d.y,` + A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(l<0),",").concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(b.x,",").concat(b.y,` + `);if(i>0){var x=ki({cx:r,cy:n,radius:i,angle:s,sign:l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=x.circleTangency,A=x.lineTangency,T=x.theta,$=ki({cx:r,cy:n,radius:i,angle:f,sign:-l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=$.circleTangency,E=$.lineTangency,j=$.theta,I=c?Math.abs(s-f):Math.abs(s-f)-T-j;if(I<0&&o===0)return"".concat(m,"L").concat(r,",").concat(n,"Z");m+="L".concat(E.x,",").concat(E.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(P.x,",").concat(P.y,` + A`).concat(i,",").concat(i,",0,").concat(+(I>180),",").concat(+(l>0),",").concat(_.x,",").concat(_.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,"Z")}else m+="L".concat(r,",").concat(n,"Z");return m},IM={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},dw=function(t){var r=ag(ag({},IM),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o0&&Math.abs(f-l)<360?p=MM({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):p=pw({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),S.createElement("path",lf({},U(r,!0),{className:d,d:p,role:"img"}))};function ei(e){"@babel/helpers - typeof";return ei=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ei(e)}function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;tUM.call(e,t));function yr(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const GM="__v",VM="__o",XM="_owner",{getOwnPropertyDescriptor:pg,keys:dg}=Object;function YM(e,t){return e.byteLength===t.byteLength&&va(new Uint8Array(e),new Uint8Array(t))}function ZM(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function JM(e,t){return e.byteLength===t.byteLength&&va(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function QM(e,t){return yr(e.getTime(),t.getTime())}function eI(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function tI(e,t){return e===t}function vg(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const i=new Array(n),a=e.entries();let o,u,c=0;for(;(o=a.next())&&!o.done;){const s=t.entries();let f=!1,l=0;for(;(u=s.next())&&!u.done;){if(i[l]){l++;continue}const h=o.value,d=u.value;if(r.equals(h[0],d[0],c,l,e,t,r)&&r.equals(h[1],d[1],h[0],d[0],e,t,r)){f=i[l]=!0;break}l++}if(!f)return!1;c++}return!0}const rI=yr;function nI(e,t,r){const n=dg(e);let i=n.length;if(dg(t).length!==i)return!1;for(;i-- >0;)if(!vw(e,t,r,n[i]))return!1;return!0}function wn(e,t,r){const n=hg(e);let i=n.length;if(hg(t).length!==i)return!1;let a,o,u;for(;i-- >0;)if(a=n[i],!vw(e,t,r,a)||(o=pg(e,a),u=pg(t,a),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function iI(e,t){return yr(e.valueOf(),t.valueOf())}function aI(e,t){return e.source===t.source&&e.flags===t.flags}function yg(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const i=new Array(n),a=e.values();let o,u;for(;(o=a.next())&&!o.done;){const c=t.values();let s=!1,f=0;for(;(u=c.next())&&!u.done;){if(!i[f]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){s=i[f]=!0;break}f++}if(!s)return!1}return!0}function va(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function oI(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function vw(e,t,r,n){return(n===XM||n===VM||n===GM)&&(e.$$typeof||t.$$typeof)?!0:KM(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const uI="[object ArrayBuffer]",cI="[object Arguments]",sI="[object Boolean]",lI="[object DataView]",fI="[object Date]",hI="[object Error]",pI="[object Map]",dI="[object Number]",vI="[object Object]",yI="[object RegExp]",mI="[object Set]",gI="[object String]",bI={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},xI="[object URL]",wI=Object.prototype.toString;function OI({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:u,areObjectsEqual:c,arePrimitiveWrappersEqual:s,areRegExpsEqual:f,areSetsEqual:l,areTypedArraysEqual:h,areUrlsEqual:d,unknownTagComparators:y}){return function(p,g,b){if(p===g)return!0;if(p==null||g==null)return!1;const w=typeof p;if(w!==typeof g)return!1;if(w!=="object")return w==="number"?u(p,g,b):w==="function"?a(p,g,b):!1;const O=p.constructor;if(O!==g.constructor)return!1;if(O===Object)return c(p,g,b);if(Array.isArray(p))return t(p,g,b);if(O===Date)return n(p,g,b);if(O===RegExp)return f(p,g,b);if(O===Map)return o(p,g,b);if(O===Set)return l(p,g,b);const m=wI.call(p);if(m===fI)return n(p,g,b);if(m===yI)return f(p,g,b);if(m===pI)return o(p,g,b);if(m===mI)return l(p,g,b);if(m===vI)return typeof p.then!="function"&&typeof g.then!="function"&&c(p,g,b);if(m===xI)return d(p,g,b);if(m===hI)return i(p,g,b);if(m===cI)return c(p,g,b);if(bI[m])return h(p,g,b);if(m===uI)return e(p,g,b);if(m===lI)return r(p,g,b);if(m===sI||m===dI||m===gI)return s(p,g,b);if(y){let x=y[m];if(!x){const _=HM(p);_&&(x=y[_])}if(x)return x(p,g,b)}return!1}}function _I({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:YM,areArraysEqual:r?wn:ZM,areDataViewsEqual:JM,areDatesEqual:QM,areErrorsEqual:eI,areFunctionsEqual:tI,areMapsEqual:r?Js(vg,wn):vg,areNumbersEqual:rI,areObjectsEqual:r?wn:nI,arePrimitiveWrappersEqual:iI,areRegExpsEqual:aI,areSetsEqual:r?Js(yg,wn):yg,areTypedArraysEqual:r?Js(va,wn):va,areUrlsEqual:oI,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const i=Di(n.areArraysEqual),a=Di(n.areMapsEqual),o=Di(n.areObjectsEqual),u=Di(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:u})}return n}function AI(e){return function(t,r,n,i,a,o,u){return e(t,r,u)}}function SI({circular:e,comparator:t,createState:r,equals:n,strict:i}){if(r)return function(u,c){const{cache:s=e?new WeakMap:void 0,meta:f}=r();return t(u,c,{cache:s,equals:n,meta:f,strict:i})};if(e)return function(u,c){return t(u,c,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const a={cache:void 0,equals:n,meta:void 0,strict:i};return function(u,c){return t(u,c,a)}}const PI=Bt();Bt({strict:!0});Bt({circular:!0});Bt({circular:!0,strict:!0});Bt({createInternalComparator:()=>yr});Bt({strict:!0,createInternalComparator:()=>yr});Bt({circular:!0,createInternalComparator:()=>yr});Bt({circular:!0,createInternalComparator:()=>yr,strict:!0});function Bt(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:i=!1}=e,a=_I(e),o=OI(a),u=r?r(o):AI(o);return SI({circular:t,comparator:o,createState:n,equals:u,strict:i})}function TI(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function mg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>t?(e(a),r=-1):TI(i)};requestAnimationFrame(n)}function hf(e){"@babel/helpers - typeof";return hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hf(e)}function EI(e){return II(e)||MI(e)||$I(e)||jI()}function jI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $I(e,t){if(e){if(typeof e=="string")return gg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gg(e,t)}}function gg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:g<0?0:g},v=function(g){for(var b=g>1?1:g,w=b,O=0;O<8;++O){var m=l(w)-b,x=d(w);if(Math.abs(m-b)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var d=-(f-l)*n,y=h*a,v=h+(d-y)*u/1e3,p=h*u/1e3+f;return Math.abs(p-l)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}function Qs(e){return pC(e)||hC(e)||fC(e)||lC()}function lC(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fC(e,t){if(e){if(typeof e=="string")return mf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mf(e,t)}}function hC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pC(e){if(Array.isArray(e))return mf(e)}function mf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ga(e){return ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ga(e)}var at=(function(e){gC(r,e);var t=bC(r);function r(n,i){var a;dC(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,d=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(xf(a)),a.changeStyle=a.changeStyle.bind(xf(a)),!u||d<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),bf(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},bf(a);a.state={style:c?Sn({},c,s):s}}else a.state={style:{}};return a}return yC(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var d={style:c?Sn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(d);return}if(!(PI(i.to,f)&&i.canBegin&&i.isActive)){var y=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||s?l:i.to;if(this.state&&h){var p={style:c?Sn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(p)}this.runAnimation(et(et({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,u=i.to,c=i.duration,s=i.easing,f=i.begin,l=i.onAnimationEnd,h=i.onAnimationStart,d=oC(o,u,XI(s),c,this.changeStyle),y=function(){a.stopJSAnimation=d()};this.manager.start([h,f,y,c,l])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,u=i.begin,c=i.onAnimationStart,s=o[0],f=s.style,l=s.duration,h=l===void 0?0:l,d=function(v,p,g){if(g===0)return v;var b=p.duration,w=p.easing,O=w===void 0?"ease":w,m=p.style,x=p.properties,_=p.onAnimationEnd,A=g>0?o[g-1]:p,T=x||Object.keys(m);if(typeof O=="function"||O==="spring")return[].concat(Qs(v),[a.runJSAnimation.bind(a,{from:A.style,to:m,duration:b,easing:O}),b]);var $=wg(T,b,O),P=et(et(et({},A.style),m),{},{transition:$});return[].concat(Qs(v),[P,b,_]).filter(NI)};return this.manager.start([c].concat(Qs(o.reduce(d,[f,Math.max(h,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=CI());var a=i.begin,o=i.duration,u=i.attributeName,c=i.to,s=i.easing,f=i.onAnimationStart,l=i.onAnimationEnd,h=i.steps,d=i.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof s=="function"||typeof d=="function"||s==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var v=u?Sn({},u,c):c,p=wg(Object.keys(v),o,s);y.start([f,a,et(et({},v),{},{transition:p}),o,l])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=cC(i,uC),s=N.Children.count(a),f=this.state.style;if(typeof a=="function")return a(f);if(!u||s===0||o<=0)return a;var l=function(d){var y=d.props,v=y.style,p=v===void 0?{}:v,g=y.className,b=N.cloneElement(d,et(et({},c),{},{style:et(et({},p),f),className:g}));return b};return s===1?l(N.Children.only(a)):S.createElement("div",null,N.Children.map(a,function(h){return l(h)}))}}]),r})(N.PureComponent);at.displayName="Animate";at.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};at.propTypes={from:ie.oneOfType([ie.object,ie.string]),to:ie.oneOfType([ie.object,ie.string]),attributeName:ie.string,duration:ie.number,begin:ie.number,easing:ie.oneOfType([ie.string,ie.func]),steps:ie.arrayOf(ie.shape({duration:ie.number.isRequired,style:ie.object.isRequired,easing:ie.oneOfType([ie.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ie.func]),properties:ie.arrayOf("string"),onAnimationEnd:ie.func})),children:ie.oneOfType([ie.node,ie.func]),isActive:ie.bool,canBegin:ie.bool,onAnimationEnd:ie.func,shouldReAnimate:ie.bool,onAnimationStart:ie.func,onAnimationReStart:ie.func};function ni(e){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ni(e)}function ba(){return ba=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,d=4;ho?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`, + `).concat(t+n,",").concat(r+u*l[1])),f+="L ".concat(t+n,",").concat(r+i-u*l[2]),l[2]>0&&(f+="A ".concat(l[2],",").concat(l[2],",0,0,").concat(s,`, + `).concat(t+n-c*l[2],",").concat(r+i)),f+="L ".concat(t+c*l[3],",").concat(r+i),l[3]>0&&(f+="A ".concat(l[3],",").concat(l[3],",0,0,").concat(s,`, + `).concat(t,",").concat(r+i-u*l[3])),f+="Z"}else if(o>0&&a===+a&&a>0){var y=Math.min(o,a);f="M ".concat(t,",").concat(r+u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+c*y,",").concat(r,` + L `).concat(t+n-c*y,",").concat(r,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n,",").concat(r+u*y,` + L `).concat(t+n,",").concat(r+i-u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n-c*y,",").concat(r+i,` + L `).concat(t+c*y,",").concat(r+i,` + A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t,",").concat(r+i-u*y," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return f},jC=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,u=r.width,c=r.height;if(Math.abs(u)>0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},$C={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zh=function(t){var r=jg(jg({},$C),t),n=N.useRef(),i=N.useState(-1),a=wC(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,d=r.className,y=r.animationEasing,v=r.animationDuration,p=r.animationBegin,g=r.isAnimationActive,b=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=Z("recharts-rectangle",d);return b?S.createElement(at,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:y,isActive:b},function(O){var m=O.width,x=O.height,_=O.x,A=O.y;return S.createElement(at,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,isActive:g,easing:y},S.createElement("path",ba({},U(r,!0),{className:w,d:$g(_,A,m,x,h),ref:n})))}):S.createElement("path",ba({},U(r,!0),{className:w,d:$g(c,s,f,l,h)}))},MC=["points","className","baseLinePoints","connectNulls"];function Ar(){return Ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function CC(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Mg(e){return NC(e)||DC(e)||RC(e)||kC()}function kC(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RC(e,t){if(e){if(typeof e=="string")return wf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wf(e,t)}}function DC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function NC(e){if(Array.isArray(e))return wf(e)}function wf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){Ig(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Ig(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},$n=function(t,r){var n=qC(t);r&&(n=[n.reduce(function(a,o){return[].concat(Mg(a),Mg(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,u,c){return"".concat(o).concat(c===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},LC=function(t,r,n){var i=$n(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat($n(r.reverse(),n).slice(1))},BC=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=IC(t,MC);if(!r||!r.length)return null;var u=Z("recharts-polygon",n);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=LC(r,i,a);return S.createElement("g",{className:u},S.createElement("path",Ar({},U(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?S.createElement("path",Ar({},U(o,!0),{fill:"none",d:$n(r,a)})):null,c?S.createElement("path",Ar({},U(o,!0),{fill:"none",d:$n(i,a)})):null)}var f=$n(r,a);return S.createElement("path",Ar({},U(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:u,d:f}))};function Of(){return Of=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function GC(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var VC=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},XC=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,d=h===void 0?0:h,y=t.className,v=KC(t,FC),p=WC({x:n,y:a,top:u,left:s,width:l,height:d},v);return!q(n)||!q(a)||!q(l)||!q(d)||!q(u)||!q(s)?null:S.createElement("path",_f({},U(p,!0),{className:Z("recharts-cross",y),d:VC(n,a,l,d,u,s)}))},el,kg;function YC(){if(kg)return el;kg=1;var e=io(),t=Dx(),r=dt();function n(i,a){return i&&i.length?e(i,r(a,2),t):void 0}return el=n,el}var ZC=YC();const JC=oe(ZC);var tl,Rg;function QC(){if(Rg)return tl;Rg=1;var e=io(),t=dt(),r=Nx();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return tl=n,tl}var ek=QC();const tk=oe(ek);var rk=["cx","cy","angle","ticks","axisLine"],nk=["ticks","tick","angle","tickFormatter","stroke"];function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ik(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ak(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qg(e,t){for(var r=0;rFg?o=i==="outer"?"start":"end":a<-Fg?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,u=n.axisLine,c=n.axisLineType,s=Gt(Gt({},U(this.props,!1)),{},{fill:"none"},U(u,!1));if(c==="circle")return S.createElement(wi,Yt({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,l=f.map(function(h){return le(i,a,o,h.coordinate)});return S.createElement(BC,Yt({className:"recharts-polar-angle-axis-line"},s,{points:l}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,u=i.tickLine,c=i.tickFormatter,s=i.stroke,f=U(this.props,!1),l=U(o,!1),h=Gt(Gt({},f),{},{fill:"none"},U(u,!1)),d=a.map(function(y,v){var p=n.getTickLineCoord(y),g=n.getTickTextAnchor(y),b=Gt(Gt(Gt({textAnchor:g},f),{},{stroke:"none",fill:s},l),{},{index:v,payload:y,x:p.x2,y:p.y2});return S.createElement(ee,Yt({className:Z("recharts-polar-angle-axis-tick",fw(o)),key:"tick-".concat(y.coordinate)},or(n.props,y,v)),u&&S.createElement("line",Yt({className:"recharts-polar-angle-axis-tick-line"},h,p)),o&&t.renderTickItem(o,b,c?c(y.value,v):y.value))});return S.createElement(ee,{className:"recharts-polar-angle-axis-ticks"},d)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:S.createElement(ee,{className:Z("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return S.isValidElement(n)?o=S.cloneElement(n,i):G(n)?o=n(i):o=S.createElement(ur,Yt({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(N.PureComponent);lo(fo,"displayName","PolarAngleAxis");lo(fo,"axisType","angleAxis");lo(fo,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var rl,Wg;function xk(){if(Wg)return rl;Wg=1;var e=R0(),t=e(Object.getPrototypeOf,Object);return rl=t,rl}var nl,zg;function wk(){if(zg)return nl;zg=1;var e=Pt(),t=xk(),r=Tt(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return nl=s,nl}var Ok=wk();const _k=oe(Ok);var il,Ug;function Ak(){if(Ug)return il;Ug=1;var e=Pt(),t=Tt(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return il=n,il}var Sk=Ak();const Pk=oe(Sk);function ai(e){"@babel/helpers - typeof";return ai=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ai(e)}function Oa(){return Oa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:y,isActive:g},function(w){var O=w.upperWidth,m=w.lowerWidth,x=w.height,_=w.x,A=w.y;return S.createElement(at,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,easing:y},S.createElement("path",Oa({},U(r,!0),{className:b,d:Vg(_,A,O,m,x),ref:n})))}):S.createElement("g",null,S.createElement("path",Oa({},U(r,!0),{className:b,d:Vg(c,s,f,l,h)})))},Nk=["option","shapeType","propTransformer","activeClassName","isActive"];function oi(e){"@babel/helpers - typeof";return oi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oi(e)}function qk(e,t){if(e==null)return{};var r=Lk(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Lk(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Xg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _a(e){for(var t=1;t0?He(w,"paddingAngle",0):0;if(m){var _=Ae(m.endAngle-m.startAngle,w.endAngle-w.startAngle),A=ce(ce({},w),{},{startAngle:b+x,endAngle:b+_(v)+x});p.push(A),b=A.endAngle}else{var T=w.endAngle,$=w.startAngle,P=Ae(0,T-$),E=P(v),j=ce(ce({},w),{},{startAngle:b+x,endAngle:b+E+x});p.push(j),b=j.endAngle}}),S.createElement(ee,null,n.renderSectorsStatically(p))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!cr(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,u=i.className,c=i.label,s=i.cx,f=i.cy,l=i.innerRadius,h=i.outerRadius,d=i.isAnimationActive,y=this.state.isAnimationFinished;if(a||!o||!o.length||!q(s)||!q(f)||!q(l)||!q(h))return null;var v=Z("recharts-pie",u);return S.createElement(ee,{tabIndex:this.props.rootTabIndex,className:v,ref:function(g){n.pieRef=g}},this.renderSectors(),c&&this.renderLabels(o),Ee.renderCallByParent(this.props,null,!1),(!d||y)&<.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?b:b-1)*c,O=p-b*d-w,m=i.reduce(function(A,T){var $=ye(T,g,0);return A+(q($)?$:0)},0),x;if(m>0){var _;x=i.map(function(A,T){var $=ye(A,g,0),P=ye(A,f,T),E=(q($)?$:0)/m,j;T?j=_.endAngle+Ce(v)*c*($!==0?1:0):j=o;var I=j+Ce(v)*(($!==0?d:0)+E*O),M=(j+I)/2,k=(y.innerRadius+y.outerRadius)/2,R=[{name:P,value:$,payload:A,dataKey:g,type:h}],L=le(y.cx,y.cy,k,M);return _=ce(ce(ce({percent:E,cornerRadius:a,name:P,tooltipPayload:R,midAngle:M,middleRadius:k,tooltipPosition:L},A),y),{},{value:ye(A,g),startAngle:j,endAngle:I,payload:A,paddingAngle:Ce(v)*c}),_})}return ce(ce({},y),{},{sectors:x,data:i})});var al,Qg;function oR(){if(Qg)return al;Qg=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var u=-1,c=t(e((i-n)/(a||1)),0),s=Array(c);c--;)s[o?c:++u]=n,n+=a;return s}return al=r,al}var ol,eb;function jw(){if(eb)return ol;eb=1;var e=Z0(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return ol=n,ol}var ul,tb;function uR(){if(tb)return ul;tb=1;var e=oR(),t=Za(),r=jw();function n(i){return function(a,o,u){return u&&typeof u!="number"&&t(a,o,u)&&(o=u=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),u=u===void 0?a0&&n.handleDrag(i.changedTouches[0])}),We(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,u=i.startIndex;o?.({endIndex:a,startIndex:u})}),n.detachDragEndListener()}),We(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),We(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),We(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),We(n,"handleSlideDragStart",function(i){var a=ub(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return bR(t,e),vR(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,u=this.props,c=u.gap,s=u.data,f=s.length-1,l=Math.min(i,a),h=Math.max(i,a),d=t.getIndexInRange(o,l),y=t.getIndexInRange(o,h);return{startIndex:d-d%c,endIndex:y===f?f:y-y%c}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,u=i.dataKey,c=ye(a[n],u,n);return G(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,u=i.endX,c=this.props,s=c.x,f=c.width,l=c.travellerWidth,h=c.startIndex,d=c.endIndex,y=c.onChange,v=n.pageX-a;v>0?v=Math.min(v,s+f-l-u,s+f-l-o):v<0&&(v=Math.max(v,s-o,s-u));var p=this.getIndex({startX:o+v,endX:u+v});(p.startIndex!==h||p.endIndex!==d)&&y&&y(p),this.setState({startX:o+v,endX:u+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=ub(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,u=i.endX,c=i.startX,s=this.state[o],f=this.props,l=f.x,h=f.width,d=f.travellerWidth,y=f.onChange,v=f.gap,p=f.data,g={startX:this.state.startX,endX:this.state.endX},b=n.pageX-a;b>0?b=Math.min(b,l+h-d-s):b<0&&(b=Math.max(b,l-s)),g[o]=s+b;var w=this.getIndex(g),O=w.startIndex,m=w.endIndex,x=function(){var A=p.length-1;return o==="startX"&&(u>c?O%v===0:m%v===0)||uc?m%v===0:O%v===0)||u>c&&m===A};this.setState(We(We({},o,s+b),"brushMoveStartX",n.pageX),function(){y&&x()&&y(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,u=o.scaleValues,c=o.startX,s=o.endX,f=this.state[i],l=u.indexOf(f);if(l!==-1){var h=l+n;if(!(h===-1||h>=u.length)){var d=u[h];i==="startX"&&d>=s||i==="endX"&&d<=c||this.setState(We({},i,d),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.fill,s=n.stroke;return S.createElement("rect",{stroke:s,fill:c,x:i,y:a,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.data,s=n.children,f=n.padding,l=N.Children.only(s);return l?S.cloneElement(l,{x:i,y:a,width:o,height:u,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,u=this,c=this.props,s=c.y,f=c.travellerWidth,l=c.height,h=c.traveller,d=c.ariaLabel,y=c.data,v=c.startIndex,p=c.endIndex,g=Math.max(n,this.props.x),b=sl(sl({},U(this.props,!1)),{},{x:g,y:s,width:f,height:l}),w=d||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[p])===null||o===void 0?void 0:o.name);return S.createElement(ee,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(m){["ArrowLeft","ArrowRight"].includes(m.key)&&(m.preventDefault(),m.stopPropagation(),u.handleTravellerMoveKeyboard(m.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,b))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,u=a.height,c=a.stroke,s=a.travellerWidth,f=Math.min(n,i)+s,l=Math.max(Math.abs(i-n)-s,0);return S.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:l,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,u=n.height,c=n.travellerWidth,s=n.stroke,f=this.state,l=f.startX,h=f.endX,d=5,y={pointerEvents:"none",fill:s};return S.createElement(ee,{className:"recharts-brush-texts"},S.createElement(ur,Pa({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,h)-d,y:o+u/2},y),this.getTextOfTick(i)),S.createElement(ur,Pa({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,h)+c+d,y:o+u/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,u=n.x,c=n.y,s=n.width,f=n.height,l=n.alwaysShowText,h=this.state,d=h.startX,y=h.endX,v=h.isTextActive,p=h.isSlideMoving,g=h.isTravellerMoving,b=h.isTravellerFocused;if(!i||!i.length||!q(u)||!q(c)||!q(s)||!q(f)||s<=0||f<=0)return null;var w=Z("recharts-brush",a),O=S.Children.count(o)===1,m=pR("userSelect","none");return S.createElement(ee,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:m},this.renderBackground(),O&&this.renderPanorama(),this.renderSlide(d,y),this.renderTravellerLayer(d,"startX"),this.renderTravellerLayer(y,"endX"),(v||p||g||b||l)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,u=n.height,c=n.stroke,s=Math.floor(a+u/2)-1;return S.createElement(S.Fragment,null,S.createElement("rect",{x:i,y:a,width:o,height:u,fill:c,stroke:"none"}),S.createElement("line",{x1:i+1,y1:s,x2:i+o-1,y2:s,fill:"none",stroke:"#fff"}),S.createElement("line",{x1:i+1,y1:s+2,x2:i+o-1,y2:s+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return S.isValidElement(n)?a=S.cloneElement(n,i):G(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,u=n.x,c=n.travellerWidth,s=n.updateId,f=n.startIndex,l=n.endIndex;if(a!==i.prevData||s!==i.prevUpdateId)return sl({prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o},a&&a.length?wR({data:a,width:o,x:u,travellerWidth:c,startIndex:f,endIndex:l}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||u!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([u,u+o-c]);var h=i.scale.domain().map(function(d){return i.scale(d)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,u=a-1;u-o>1;){var c=Math.floor((o+u)/2);n[c]>i?u=c:o=c}return i>=n[u]?u:o}}])})(N.PureComponent);We(Kr,"displayName","Brush");We(Kr,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var ll,cb;function OR(){if(cb)return ll;cb=1;var e=dh();function t(r,n){var i;return e(r,function(a,o,u){return i=n(a,o,u),!i}),!!i}return ll=t,ll}var fl,sb;function _R(){if(sb)return fl;sb=1;var e=E0(),t=dt(),r=OR(),n=Le(),i=Za();function a(o,u,c){var s=n(o)?e:r;return c&&i(o,u,c)&&(u=void 0),s(o,t(u,3))}return fl=a,fl}var AR=_R();const SR=oe(AR);var ft=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},hl,lb;function PR(){if(lb)return hl;lb=1;var e=K0();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return hl=t,hl}var pl,fb;function TR(){if(fb)return pl;fb=1;var e=PR(),t=U0(),r=dt();function n(i,a){var o={};return a=r(a,3),t(i,function(u,c,s){e(o,c,a(u,c,s))}),o}return pl=n,pl}var ER=TR();const jR=oe(ER);var dl,hb;function $R(){if(hb)return dl;hb=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function LR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function BR(e,t){var r=e.x,n=e.y,i=qR(e,kR),a="".concat(r),o=parseInt(a,10),u="".concat(n),c=parseInt(u,10),s="".concat(t.height||i.height),f=parseInt(s,10),l="".concat(t.width||i.width),h=parseInt(l,10);return On(On(On(On(On({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:h,name:t.name,radius:t.radius})}function yb(e){return S.createElement(Pw,Ef({shapeType:"rectangle",propTransformer:BR,activeClassName:"recharts-active-bar"},e))}var FR=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||c_(n);return a?t(n,i):(a||lr(),r)}},WR=["value","background"],kw;function Gr(e){"@babel/helpers - typeof";return Gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gr(e)}function zR(e,t){if(e==null)return{};var r=UR(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(M)0&&Math.abs(I)0&&(j=Math.min((fe||0)-(I[me-1]||0),j))}),Number.isFinite(j)){var M=j/E,k=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(_=M*k/2),v.padding==="no-gap"){var R=ke(t.barCategoryGap,M*k),L=M*k/2;_=L-R-(L-R)/k*R}}}i==="xAxis"?A=[n.left+(w.left||0)+(_||0),n.left+n.width-(w.right||0)-(_||0)]:i==="yAxis"?A=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(_||0),n.top+n.height-(w.bottom||0)-(_||0)]:A=v.range,m&&(A=[A[1],A[0]]);var B=iw(v,a,h),H=B.scale,V=B.realScaleType;H.domain(g).range(A),aw(H);var W=ow(H,tt(tt({},v),{},{realScaleType:V}));i==="xAxis"?(P=p==="top"&&!O||p==="bottom"&&O,T=n.left,$=l[x]-P*v.height):i==="yAxis"&&(P=p==="left"&&!O||p==="right"&&O,T=l[x]-P*v.width,$=n.top);var X=tt(tt(tt({},v),W),{},{realScaleType:V,x:T,y:$,scale:H,width:i==="xAxis"?n.width:v.width,height:i==="yAxis"?n.height:v.height});return X.bandSize=ha(X,W),!v.hide&&i==="xAxis"?l[x]+=(P?-1:1)*X.height:v.hide||(l[x]+=(P?-1:1)*X.width),tt(tt({},d),{},vo({},y,X))},{})},qw=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},tD=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return qw({x:r,y:n},{x:i,y:a})},Lw=(function(){function e(t){JR(this,e),this.scale=t}return QR(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();vo(Lw,"EPS",1e-4);var Hh=function(t){var r=Object.keys(t).reduce(function(n,i){return tt(tt({},n),{},vo({},i,Lw.create(t[i])))},{});return tt(tt({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,u=a.position;return jR(i,function(c,s){return r[s].apply(c,{bandAware:o,position:u})})},isInRange:function(i){return Cw(i,function(a,o){return r[o].isInRange(a)})}})};function rD(e){return(e%180+180)%180}var nD=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=rD(i),o=a*Math.PI/180,u=Math.atan(n/r),c=o>u&&o-1?c[s?a[f]:f]:void 0}}return ml=n,ml}var gl,Ob;function aD(){if(Ob)return gl;Ob=1;var e=jw();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return gl=t,gl}var bl,_b;function oD(){if(_b)return bl;_b=1;var e=L0(),t=dt(),r=aD(),n=Math.max;function i(a,o,u){var c=a==null?0:a.length;if(!c)return-1;var s=u==null?0:r(u);return s<0&&(s=n(c+s,0)),e(a,t(o,3),s)}return bl=i,bl}var xl,Ab;function uD(){if(Ab)return xl;Ab=1;var e=iD(),t=oD(),r=e(t);return xl=r,xl}var cD=uD();const sD=oe(cD);var lD=e0();const fD=oe(lD);var hD=fD(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),Kh=N.createContext(void 0),Gh=N.createContext(void 0),Bw=N.createContext(void 0),Fw=N.createContext({}),Ww=N.createContext(void 0),zw=N.createContext(0),Uw=N.createContext(0),Sb=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,u=t.children,c=t.width,s=t.height,f=hD(a);return S.createElement(Kh.Provider,{value:n},S.createElement(Gh.Provider,{value:i},S.createElement(Fw.Provider,{value:a},S.createElement(Bw.Provider,{value:f},S.createElement(Ww.Provider,{value:o},S.createElement(zw.Provider,{value:s},S.createElement(Uw.Provider,{value:c},u)))))))},pD=function(){return N.useContext(Ww)},Hw=function(t){var r=N.useContext(Kh);r==null&&lr();var n=r[t];return n==null&&lr(),n},dD=function(){var t=N.useContext(Kh);return It(t)},vD=function(){var t=N.useContext(Gh),r=sD(t,function(n){return Cw(n.domain,Number.isFinite)});return r||It(t)},Kw=function(t){var r=N.useContext(Gh);r==null&&lr();var n=r[t];return n==null&&lr(),n},yD=function(){var t=N.useContext(Bw);return t},mD=function(){return N.useContext(Fw)},Vh=function(){return N.useContext(Uw)},Xh=function(){return N.useContext(zw)};function Vr(e){"@babel/helpers - typeof";return Vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vr(e)}function gD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bD(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function eN(e,t){return Qw(e,t+1)}function tN(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,u=t.end,c=0,s=1,f=o,l=function(){var y=n?.[c];if(y===void 0)return{v:Qw(n,s)};var v=c,p,g=function(){return p===void 0&&(p=r(y,v)),p},b=y.coordinate,w=c===0||Ca(e,b,g,f,u);w||(c=0,f=o,s+=1),w&&(f=b+e*(g()/2+i),c+=s)},h;s<=a.length;)if(h=l(),h)return h.v;return[]}function fi(e){"@babel/helpers - typeof";return fi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fi(e)}function Cb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Me(e){for(var t=1;t0?d.coordinate-p*e:d.coordinate})}else a[h]=d=Me(Me({},d),{},{tickCoord:d.coordinate});var g=Ca(e,d.tickCoord,v,u,c);g&&(c=d.tickCoord-e*(v()/2+i),a[h]=Me(Me({},d),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function oN(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,c=t.start,s=t.end;if(a){var f=n[u-1],l=r(f,u-1),h=e*(f.coordinate+e*l/2-s);o[u-1]=f=Me(Me({},f),{},{tickCoord:h>0?f.coordinate-h*e:f.coordinate});var d=Ca(e,f.tickCoord,function(){return l},c,s);d&&(s=f.tickCoord-e*(l/2+i),o[u-1]=Me(Me({},f),{},{isShow:!0}))}for(var y=a?u-1:u,v=function(b){var w=o[b],O,m=function(){return O===void 0&&(O=r(w,b)),O};if(b===0){var x=e*(w.coordinate-e*m()/2-c);o[b]=w=Me(Me({},w),{},{tickCoord:x<0?w.coordinate-x*e:w.coordinate})}else o[b]=w=Me(Me({},w),{},{tickCoord:w.coordinate});var _=Ca(e,w.tickCoord,m,c,s);_&&(c=w.tickCoord+e*(m()/2+i),o[b]=Me(Me({},w),{},{isShow:!0}))},p=0;p=2?Ce(i[1].coordinate-i[0].coordinate):1,g=QD(a,p,d);return c==="equidistantPreserveStart"?tN(p,g,v,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=oN(p,g,v,i,o,c==="preserveStartEnd"):h=aN(p,g,v,i,o),h.filter(function(b){return b.isShow}))}var uN=["viewBox"],cN=["viewBox"],sN=["ticks"];function Zr(e){"@babel/helpers - typeof";return Zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zr(e)}function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function lN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function fN(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rb(e,t){for(var r=0;r0?c(this.props):c(d)),o<=0||u<=0||!y||!y.length?null:S.createElement(ee,{className:Z("recharts-cartesian-axis",s),ref:function(p){n.layerReference=p}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Ee.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,u=Z(i.className,"recharts-cartesian-axis-tick-value");return S.isValidElement(n)?o=S.cloneElement(n,Oe(Oe({},i),{},{className:u})):G(n)?o=n(Oe(Oe({},i),{},{className:u})):o=S.createElement(ur,Pr({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(N.Component);Qh(pn,"displayName","CartesianAxis");Qh(pn,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var gN=["x1","y1","x2","y2","key"],bN=["offset"];function fr(e){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(e)}function Db(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _N(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var AN=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,u=t.height,c=t.ry;return S.createElement("rect",{x:i,y:a,ry:c,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function rO(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(G(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,u=t.key,c=Nb(t,gN),s=U(c,!1);s.offset;var f=Nb(s,bN);r=S.createElement("line",er({},f,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:u}))}return r}function SN(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=Ie(Ie({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(c),index:c});return rO(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function PN(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=Ie(Ie({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(c),index:c});return rO(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function TN(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,u=e.horizontalPoints,c=e.horizontal,s=c===void 0?!0:c;if(!s||!t||!t.length)return null;var f=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,d){return h-d});i!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?i+o-h:f[d+1]-h;if(v<=0)return null;var p=d%t.length;return S.createElement("rect",{key:"react-".concat(d),y:h,x:n,height:v,width:a,stroke:"none",fill:t[p],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},l)}function EN(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,u=e.width,c=e.height,s=e.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(h){return Math.round(h+a-a)}).sort(function(h,d){return h-d});a!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?a+u-h:f[d+1]-h;if(v<=0)return null;var p=d%n.length;return S.createElement("rect",{key:"react-".concat(d),x:h,y:o,width:v,height:c,stroke:"none",fill:n[p],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},l)}var jN=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return nw(Jh(Ie(Ie(Ie({},pn.defaultProps),n),{},{ticks:xt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},$N=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return nw(Jh(Ie(Ie(Ie({},pn.defaultProps),n),{},{ticks:xt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},wr={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function MN(e){var t,r,n,i,a,o,u=Vh(),c=Xh(),s=mD(),f=Ie(Ie({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:wr.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:wr.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:wr.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:wr.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:wr.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:wr.verticalFill,x:q(e.x)?e.x:s.left,y:q(e.y)?e.y:s.top,width:q(e.width)?e.width:s.width,height:q(e.height)?e.height:s.height}),l=f.x,h=f.y,d=f.width,y=f.height,v=f.syncWithTicks,p=f.horizontalValues,g=f.verticalValues,b=dD(),w=vD();if(!q(d)||d<=0||!q(y)||y<=0||!q(l)||l!==+l||!q(h)||h!==+h)return null;var O=f.verticalCoordinatesGenerator||jN,m=f.horizontalCoordinatesGenerator||$N,x=f.horizontalPoints,_=f.verticalPoints;if((!x||!x.length)&&G(m)){var A=p&&p.length,T=m({yAxis:w?Ie(Ie({},w),{},{ticks:A?p:w.ticks}):void 0,width:u,height:c,offset:s},A?!0:v);it(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(fr(T),"]")),Array.isArray(T)&&(x=T)}if((!_||!_.length)&&G(O)){var $=g&&g.length,P=O({xAxis:b?Ie(Ie({},b),{},{ticks:$?g:b.ticks}):void 0,width:u,height:c,offset:s},$?!0:v);it(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(fr(P),"]")),Array.isArray(P)&&(_=P)}return S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(AN,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),S.createElement(SN,er({},f,{offset:s,horizontalPoints:x,xAxis:b,yAxis:w})),S.createElement(PN,er({},f,{offset:s,verticalPoints:_,xAxis:b,yAxis:w})),S.createElement(TN,er({},f,{horizontalPoints:x})),S.createElement(EN,er({},f,{verticalPoints:_})))}MN.displayName="CartesianGrid";var IN=["type","layout","connectNulls","ref"],CN=["key"];function Jr(e){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jr(e)}function qb(e,t){if(e==null)return{};var r=kN(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function In(){return In=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rl){d=[].concat(Or(c.slice(0,y)),[l-v]);break}var p=d.length%2===0?[0,h]:[h];return[].concat(Or(t.repeat(c,f)),Or(d),p).map(function(g){return"".concat(g,"px")}).join(", ")}),rt(r,"id",pr("recharts-line-")),rt(r,"pathRef",function(o){r.mainCurve=o}),rt(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),rt(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return UN(t,e),BN(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,u=a.xAxis,c=a.yAxis,s=a.layout,f=a.children,l=Ke(f,xi);if(!l)return null;var h=function(v,p){return{x:v.x,y:v.y,value:v.value,errorVal:ye(v.payload,p)}},d={clipPath:n?"url(#clipPath-".concat(i,")"):null};return S.createElement(ee,d,l.map(function(y){return S.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:u,yAxis:c,layout:s,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,c=u.dot,s=u.points,f=u.dataKey,l=U(this.props,!1),h=U(c,!0),d=s.map(function(v,p){var g=Fe(Fe(Fe({key:"dot-".concat(p),r:3},l),h),{},{index:p,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:s});return t.renderDotItem(c,g)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return S.createElement(ee,In({className:"recharts-line-dots",key:"dots"},y),d)}},{key:"renderCurveStatically",value:function(n,i,a,o){var u=this.props,c=u.type,s=u.layout,f=u.connectNulls;u.ref;var l=qb(u,IN),h=Fe(Fe(Fe({},U(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:c,layout:s,connectNulls:f});return S.createElement(ir,In({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,u=o.points,c=o.strokeDasharray,s=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,h=o.animationEasing,d=o.animationId,y=o.animateNewValues,v=o.width,p=o.height,g=this.state,b=g.prevPoints,w=g.totalLength;return S.createElement(at,{begin:f,duration:l,isActive:s,easing:h,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var m=O.t;if(b){var x=b.length/u.length,_=u.map(function(E,j){var I=Math.floor(j*x);if(b[I]){var M=b[I],k=Ae(M.x,E.x),R=Ae(M.y,E.y);return Fe(Fe({},E),{},{x:k(m),y:R(m)})}if(y){var L=Ae(v*2,E.x),B=Ae(p/2,E.y);return Fe(Fe({},E),{},{x:L(m),y:B(m)})}return Fe(Fe({},E),{},{x:E.x,y:E.y})});return a.renderCurveStatically(_,n,i)}var A=Ae(0,w),T=A(m),$;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});$=a.getStrokeDasharray(T,w,P)}else $=a.generateSimpleStrokeDasharray(w,T);return a.renderCurveStatically(u,n,i,{strokeDasharray:$})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,u=a.isAnimationActive,c=this.state,s=c.prevPoints,f=c.totalLength;return u&&o&&o.length&&(!s&&f>0||!cr(s,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.xAxis,f=i.yAxis,l=i.top,h=i.left,d=i.width,y=i.height,v=i.isAnimationActive,p=i.id;if(a||!u||!u.length)return null;var g=this.state.isAnimationFinished,b=u.length===1,w=Z("recharts-line",c),O=s&&s.allowDataOverflow,m=f&&f.allowDataOverflow,x=O||m,_=Y(p)?this.id:p,A=(n=U(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=A.r,$=T===void 0?3:T,P=A.strokeWidth,E=P===void 0?2:P,j=a0(o)?o:{},I=j.clipDot,M=I===void 0?!0:I,k=$*2+E;return S.createElement(ee,{className:w},O||m?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?h:h-d/2,y:m?l:l-y/2,width:O?d:d*2,height:m?y:y*2})),!M&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:h-k/2,y:l-k/2,width:d+k,height:y+k}))):null,!b&&this.renderCurve(x,_),this.renderErrorBar(x,_),(b||o)&&this.renderDots(x,M,_),(!v||g)&<.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Or(n),[0]):n,o=[],u=0;u=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function VN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tr(){return tr=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!cr(f,o)||!cr(l,u))?this.renderAreaWithAnimation(n,i):this.renderAreaStatically(o,u,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.top,f=i.left,l=i.xAxis,h=i.yAxis,d=i.width,y=i.height,v=i.isAnimationActive,p=i.id;if(a||!u||!u.length)return null;var g=this.state.isAnimationFinished,b=u.length===1,w=Z("recharts-area",c),O=l&&l.allowDataOverflow,m=h&&h.allowDataOverflow,x=O||m,_=Y(p)?this.id:p,A=(n=U(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=A.r,$=T===void 0?3:T,P=A.strokeWidth,E=P===void 0?2:P,j=a0(o)?o:{},I=j.clipDot,M=I===void 0?!0:I,k=$*2+E;return S.createElement(ee,{className:w},O||m?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?f:f-d/2,y:m?s:s-y/2,width:O?d:d*2,height:m?y:y*2})),!M&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:f-k/2,y:s-k/2,width:d+k,height:y+k}))):null,b?null:this.renderArea(x,_),(o||b)&&this.renderDots(x,M,_),(!v||g)&<.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,curBaseLine:n.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:n.points!==i.curPoints||n.baseLine!==i.curBaseLine?{curPoints:n.points,curBaseLine:n.baseLine}:null}}])})(N.PureComponent);aO=mr;ct(mr,"displayName","Area");ct(mr,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Nt.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});ct(mr,"getBaseValue",function(e,t,r,n){var i=e.layout,a=e.baseValue,o=t.props.baseValue,u=o??a;if(q(u)&&typeof u=="number")return u;var c=i==="horizontal"?n:r,s=c.scale.domain();if(c.type==="number"){var f=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return u==="dataMin"?l:u==="dataMax"||f<0?f:Math.max(Math.min(s[0],s[1]),0)}return u==="dataMin"?s[0]:u==="dataMax"?s[1]:s[0]});ct(mr,"getComposedData",function(e){var t=e.props,r=e.item,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,u=e.bandSize,c=e.dataKey,s=e.stackedData,f=e.dataStartIndex,l=e.displayedData,h=e.offset,d=t.layout,y=s&&s.length,v=aO.getBaseValue(t,r,n,i),p=d==="horizontal",g=!1,b=l.map(function(O,m){var x;y?x=s[f+m]:(x=ye(O,c),Array.isArray(x)?g=!0:x=[v,x]);var _=x[1]==null||y&&ye(O,c)==null;return p?{x:fa({axis:n,ticks:a,bandSize:u,entry:O,index:m}),y:_?null:i.scale(x[1]),value:x,payload:O}:{x:_?null:n.scale(x[1]),y:fa({axis:i,ticks:o,bandSize:u,entry:O,index:m}),value:x,payload:O}}),w;return y||g?w=b.map(function(O){var m=Array.isArray(O.value)?O.value[0]:null;return p?{x:O.x,y:m!=null&&O.y!=null?i.scale(m):null}:{x:m!=null?n.scale(m):null,y:O.y}}):w=p?i.scale(v):n.scale(v),$t({points:b,baseLine:w,layout:d,isRange:g},h)});ct(mr,"renderDotItem",function(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(G(e))r=e(t);else{var n=Z("recharts-area-dot",typeof e!="boolean"?e.className:""),i=t.key,a=oO(t,GN);r=S.createElement(wi,tr({},a,{key:i,className:n}))}return r});function en(e){"@babel/helpers - typeof";return en=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},en(e)}function r2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function U2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function H2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function wO(e){return e==="number"?[0,"auto"]:void 0}var Vf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=wo(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var d=l===void 0?u:l;h=Bi(d,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(nn(c),[cw(s,h)]):c},[])},Xb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=iq(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=y$(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=Vf(t,r,f,l),d=aq(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:d}}return null},oq=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,d=rw(f,a);return n.reduce(function(y,v){var p,g=v.type.defaultProps!==void 0?C(C({},v.type.defaultProps),v.props):v.props,b=g.type,w=g.dataKey,O=g.allowDataOverflow,m=g.allowDuplicatedCategory,x=g.scale,_=g.ticks,A=g.includeHidden,T=g[o];if(y[T])return y;var $=wo(t.data,{graphicalItems:i.filter(function(W){var X,fe=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o];return fe===T}),dataStartIndex:c,dataEndIndex:s}),P=$.length,E,j,I;I2(g.domain,O,b)&&(E=uf(g.domain,null,O),d&&(b==="number"||x!=="auto")&&(I=En($,w,"category")));var M=wO(b);if(!E||E.length===0){var k,R=(k=g.domain)!==null&&k!==void 0?k:M;if(w){if(E=En($,w,b),b==="category"&&d){var L=l_(E);m&&L?(j=E,E=Sa(0,P)):m||(E=Xm(R,E,v).reduce(function(W,X){return W.indexOf(X)>=0?W:[].concat(nn(W),[X])},[]))}else if(b==="category")m?E=E.filter(function(W){return W!==""&&!Y(W)}):E=Xm(R,E,v).reduce(function(W,X){return W.indexOf(X)>=0||X===""||Y(X)?W:[].concat(nn(W),[X])},[]);else if(b==="number"){var B=w$($,i.filter(function(W){var X,fe,me=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o],Be="hide"in W.props?W.props.hide:(fe=W.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return me===T&&(A||!Be)}),w,a,f);B&&(E=B)}d&&(b==="number"||x!=="auto")&&(I=En($,w,"category"))}else d?E=Sa(0,P):u&&u[T]&&u[T].hasStack&&b==="number"?E=h==="expand"?[0,1]:uw(u[T].stackGroups,c,s):E=tw($,i.filter(function(W){var X=o in W.props?W.props[o]:W.type.defaultProps[o],fe="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return X===T&&(A||!fe)}),b,f,!0);if(b==="number")E=Hf(l,E,T,a,_),R&&(E=uf(R,E,O));else if(b==="category"&&R){var H=R,V=E.every(function(W){return H.indexOf(W)>=0});V&&(E=H)}}return C(C({},y),{},K({},T,C(C({},g),{},{axisType:a,domain:E,categoricalDomain:I,duplicateDomain:j,originalDomain:(p=g.domain)!==null&&p!==void 0?p:M,isCategorical:d,layout:f})))},{})},uq=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=wo(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:s}),d=h.length,y=rw(f,a),v=-1;return n.reduce(function(p,g){var b=g.type.defaultProps!==void 0?C(C({},g.type.defaultProps),g.props):g.props,w=b[o],O=wO("number");if(!p[w]){v++;var m;return y?m=Sa(0,d):u&&u[w]&&u[w].hasStack?(m=uw(u[w].stackGroups,c,s),m=Hf(l,m,w,a)):(m=uf(O,tw(h,n.filter(function(x){var _,A,T=o in x.props?x.props[o]:(_=x.type.defaultProps)===null||_===void 0?void 0:_[o],$="hide"in x.props?x.props.hide:(A=x.type.defaultProps)===null||A===void 0?void 0:A.hide;return T===w&&!$}),"number",f),i.defaultProps.allowDataOverflow),m=Hf(l,m,w,a)),C(C({},p),{},K({},w,C(C({axisType:a},i.defaultProps),{},{hide:!0,orientation:He(rq,"".concat(a,".").concat(v%2),null),domain:m,originalDomain:O,isCategorical:y,layout:f})))}return p},{})},cq=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),h=Ke(f,a),d={};return h&&h.length?d=oq(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s}):o&&o.length&&(d=uq(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s})),d},sq=function(t){var r=It(t),n=xt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:vh(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:ha(r,n)}},Yb=function(t){var r=t.children,n=t.defaultShowTooltip,i=ze(r,Kr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},lq=function(t){return!t||!t.length?!1:t.some(function(r){var n=wt(r&&r.type);return n&&n.indexOf("Bar")>=0})},Zb=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},fq=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,u=t.yAxisMap,c=u===void 0?{}:u,s=n.width,f=n.height,l=n.children,h=n.margin||{},d=ze(l,Kr),y=ze(l,jr),v=Object.keys(c).reduce(function(m,x){var _=c[x],A=_.orientation;return!_.mirror&&!_.hide?C(C({},m),{},K({},A,m[A]+_.width)):m},{left:h.left||0,right:h.right||0}),p=Object.keys(o).reduce(function(m,x){var _=o[x],A=_.orientation;return!_.mirror&&!_.hide?C(C({},m),{},K({},A,He(m,"".concat(A))+_.height)):m},{top:h.top||0,bottom:h.bottom||0}),g=C(C({},p),v),b=g.bottom;d&&(g.bottom+=d.props.height||Kr.defaultProps.height),y&&r&&(g=b$(g,i,n,r));var w=s-g.left-g.right,O=f-g.top-g.bottom;return C(C({brushBottom:b},g),{},{width:Math.max(w,0),height:Math.max(O,0)})},hq=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Oo=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,c=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,h=function(g,b){var w=b.graphicalItems,O=b.stackGroups,m=b.offset,x=b.updateId,_=b.dataStartIndex,A=b.dataEndIndex,T=g.barSize,$=g.layout,P=g.barGap,E=g.barCategoryGap,j=g.maxBarSize,I=Zb($),M=I.numericAxisName,k=I.cateAxisName,R=lq(w),L=[];return w.forEach(function(B,H){var V=wo(g.data,{graphicalItems:[B],dataStartIndex:_,dataEndIndex:A}),W=B.type.defaultProps!==void 0?C(C({},B.type.defaultProps),B.props):B.props,X=W.dataKey,fe=W.maxBarSize,me=W["".concat(M,"Id")],Be=W["".concat(k,"Id")],Wt={},De=c.reduce(function(zt,Ut){var _o=b["".concat(Ut.axisType,"Map")],ep=W["".concat(Ut.axisType,"Id")];_o&&_o[ep]||Ut.axisType==="zAxis"||lr();var tp=_o[ep];return C(C({},zt),{},K(K({},Ut.axisType,tp),"".concat(Ut.axisType,"Ticks"),xt(tp)))},Wt),F=De[k],J=De["".concat(k,"Ticks")],Q=O&&O[me]&&O[me].hasStack&&$$(B,O[me].stackGroups),D=wt(B.type).indexOf("Bar")>=0,de=ha(F,J),te=[],xe=R&&m$({barSize:T,stackGroups:O,totalSize:hq(De,k)});if(D){var we,Ne,jt=Y(fe)?j:fe,gr=(we=(Ne=ha(F,J,!0))!==null&&Ne!==void 0?Ne:jt)!==null&&we!==void 0?we:0;te=g$({barGap:P,barCategoryGap:E,bandSize:gr!==de?gr:de,sizeList:xe[Be],maxBarSize:jt}),gr!==de&&(te=te.map(function(zt){return C(C({},zt),{},{position:C(C({},zt.position),{},{offset:zt.position.offset-gr/2})})}))}var Ai=B&&B.type&&B.type.getComposedData;Ai&&L.push({props:C(C({},Ai(C(C({},De),{},{displayedData:V,props:g,dataKey:X,item:B,bandSize:de,barPosition:te,offset:m,stackedData:Q,layout:$,dataStartIndex:_,dataEndIndex:A}))),{},K(K(K({key:B.key||"item-".concat(H)},M,De[M]),k,De[k]),"animationId",x)),childIndex:O_(B,g.children),item:B})}),L},d=function(g,b){var w=g.props,O=g.dataStartIndex,m=g.dataEndIndex,x=g.updateId;if(!ld({props:w}))return null;var _=w.children,A=w.layout,T=w.stackOffset,$=w.data,P=w.reverseStackOrder,E=Zb(A),j=E.numericAxisName,I=E.cateAxisName,M=Ke(_,n),k=E$($,M,"".concat(j,"Id"),"".concat(I,"Id"),T,P),R=c.reduce(function(W,X){var fe="".concat(X.axisType,"Map");return C(C({},W),{},K({},fe,cq(w,C(C({},X),{},{graphicalItems:M,stackGroups:X.axisType===j&&k,dataStartIndex:O,dataEndIndex:m}))))},{}),L=fq(C(C({},R),{},{props:w,graphicalItems:M}),b?.legendBBox);Object.keys(R).forEach(function(W){R[W]=f(w,R[W],L,W.replace("Map",""),r)});var B=R["".concat(I,"Map")],H=sq(B),V=h(w,C(C({},R),{},{dataStartIndex:O,dataEndIndex:m,updateId:x,graphicalItems:M,stackGroups:k,offset:L}));return C(C({formattedGraphicalItems:V,graphicalItems:M,offset:L,stackGroups:k},H),R)},y=(function(p){function g(b){var w,O,m;return H2(this,g),m=V2(this,g,[b]),K(m,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),K(m,"accessibilityManager",new M2),K(m,"handleLegendBBoxUpdate",function(x){if(x){var _=m.state,A=_.dataStartIndex,T=_.dataEndIndex,$=_.updateId;m.setState(C({legendBBox:x},d({props:m.props,dataStartIndex:A,dataEndIndex:T,updateId:$},C(C({},m.state),{},{legendBBox:x}))))}}),K(m,"handleReceiveSyncEvent",function(x,_,A){if(m.props.syncId===x){if(A===m.eventEmitterSymbol&&typeof m.props.syncMethod!="function")return;m.applySyncEvent(_)}}),K(m,"handleBrushChange",function(x){var _=x.startIndex,A=x.endIndex;if(_!==m.state.dataStartIndex||A!==m.state.dataEndIndex){var T=m.state.updateId;m.setState(function(){return C({dataStartIndex:_,dataEndIndex:A},d({props:m.props,dataStartIndex:_,dataEndIndex:A,updateId:T},m.state))}),m.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),K(m,"handleMouseEnter",function(x){var _=m.getMouseInfo(x);if(_){var A=C(C({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseEnter;G(T)&&T(A,x)}}),K(m,"triggeredAfterMouseMove",function(x){var _=m.getMouseInfo(x),A=_?C(C({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseMove;G(T)&&T(A,x)}),K(m,"handleItemMouseEnter",function(x){m.setState(function(){return{isTooltipActive:!0,activeItem:x,activePayload:x.tooltipPayload,activeCoordinate:x.tooltipPosition||{x:x.cx,y:x.cy}}})}),K(m,"handleItemMouseLeave",function(){m.setState(function(){return{isTooltipActive:!1}})}),K(m,"handleMouseMove",function(x){x.persist(),m.throttleTriggeredAfterMouseMove(x)}),K(m,"handleMouseLeave",function(x){m.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};m.setState(_),m.triggerSyncEvent(_);var A=m.props.onMouseLeave;G(A)&&A(_,x)}),K(m,"handleOuterEvent",function(x){var _=w_(x),A=He(m.props,"".concat(_));if(_&&G(A)){var T,$;/.*touch.*/i.test(_)?$=m.getMouseInfo(x.changedTouches[0]):$=m.getMouseInfo(x),A((T=$)!==null&&T!==void 0?T:{},x)}}),K(m,"handleClick",function(x){var _=m.getMouseInfo(x);if(_){var A=C(C({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onClick;G(T)&&T(A,x)}}),K(m,"handleMouseDown",function(x){var _=m.props.onMouseDown;if(G(_)){var A=m.getMouseInfo(x);_(A,x)}}),K(m,"handleMouseUp",function(x){var _=m.props.onMouseUp;if(G(_)){var A=m.getMouseInfo(x);_(A,x)}}),K(m,"handleTouchMove",function(x){x.changedTouches!=null&&x.changedTouches.length>0&&m.throttleTriggeredAfterMouseMove(x.changedTouches[0])}),K(m,"handleTouchStart",function(x){x.changedTouches!=null&&x.changedTouches.length>0&&m.handleMouseDown(x.changedTouches[0])}),K(m,"handleTouchEnd",function(x){x.changedTouches!=null&&x.changedTouches.length>0&&m.handleMouseUp(x.changedTouches[0])}),K(m,"handleDoubleClick",function(x){var _=m.props.onDoubleClick;if(G(_)){var A=m.getMouseInfo(x);_(A,x)}}),K(m,"handleContextMenu",function(x){var _=m.props.onContextMenu;if(G(_)){var A=m.getMouseInfo(x);_(A,x)}}),K(m,"triggerSyncEvent",function(x){m.props.syncId!==void 0&&_l.emit(Al,m.props.syncId,x,m.eventEmitterSymbol)}),K(m,"applySyncEvent",function(x){var _=m.props,A=_.layout,T=_.syncMethod,$=m.state.updateId,P=x.dataStartIndex,E=x.dataEndIndex;if(x.dataStartIndex!==void 0||x.dataEndIndex!==void 0)m.setState(C({dataStartIndex:P,dataEndIndex:E},d({props:m.props,dataStartIndex:P,dataEndIndex:E,updateId:$},m.state)));else if(x.activeTooltipIndex!==void 0){var j=x.chartX,I=x.chartY,M=x.activeTooltipIndex,k=m.state,R=k.offset,L=k.tooltipTicks;if(!R)return;if(typeof T=="function")M=T(L,x);else if(T==="value"){M=-1;for(var B=0;B=0){var Q,D;if(j.dataKey&&!j.allowDuplicatedCategory){var de=typeof j.dataKey=="function"?J:"payload.".concat(j.dataKey.toString());Q=Bi(B,de,M),D=H&&V&&Bi(V,de,M)}else Q=B?.[I],D=H&&V&&V[I];if(Be||me){var te=x.props.activeIndex!==void 0?x.props.activeIndex:I;return[N.cloneElement(x,C(C(C({},T.props),De),{},{activeIndex:te})),null,null]}if(!Y(Q))return[F].concat(nn(m.renderActivePoints({item:T,activePoint:Q,basePoint:D,childIndex:I,isRange:H})))}else{var xe,we=(xe=m.getItemByXY(m.state.activeCoordinate))!==null&&xe!==void 0?xe:{graphicalItem:F},Ne=we.graphicalItem,jt=Ne.item,gr=jt===void 0?x:jt,Ai=Ne.childIndex,zt=C(C(C({},T.props),De),{},{activeIndex:Ai});return[N.cloneElement(gr,zt),null,null]}return H?[F,null,null]:[F,null]}),K(m,"renderCustomized",function(x,_,A){return N.cloneElement(x,C(C({key:"recharts-customized-".concat(A)},m.props),m.state))}),K(m,"renderMap",{CartesianGrid:{handler:qi,once:!0},ReferenceArea:{handler:m.renderReferenceElement},ReferenceLine:{handler:qi},ReferenceDot:{handler:m.renderReferenceElement},XAxis:{handler:qi},YAxis:{handler:qi},Brush:{handler:m.renderBrush,once:!0},Bar:{handler:m.renderGraphicChild},Line:{handler:m.renderGraphicChild},Area:{handler:m.renderGraphicChild},Radar:{handler:m.renderGraphicChild},RadialBar:{handler:m.renderGraphicChild},Scatter:{handler:m.renderGraphicChild},Pie:{handler:m.renderGraphicChild},Funnel:{handler:m.renderGraphicChild},Tooltip:{handler:m.renderCursor,once:!0},PolarGrid:{handler:m.renderPolarGrid,once:!0},PolarAngleAxis:{handler:m.renderPolarAxis},PolarRadiusAxis:{handler:m.renderPolarAxis},Customized:{handler:m.renderCustomized}}),m.clipPathId="".concat((w=b.id)!==null&&w!==void 0?w:pr("recharts"),"-clip"),m.throttleTriggeredAfterMouseMove=J0(m.triggeredAfterMouseMove,(O=b.throttleDelay)!==null&&O!==void 0?O:1e3/60),m.state={},m}return Z2(g,p),G2(g,[{key:"componentDidMount",value:function(){var w,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,O=w.children,m=w.data,x=w.height,_=w.layout,A=ze(O,yt);if(A){var T=A.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length-1)){var $=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,P=Vf(this.state,m,T,$),E=this.state.tooltipTicks[T].coordinate,j=(this.state.offset.top+x)/2,I=_==="horizontal",M=I?{x:E,y:j}:{y:E,x:j},k=this.state.formattedGraphicalItems.find(function(L){var B=L.item;return B.type.name==="Scatter"});k&&(M=C(C({},M),k.props.points[T].tooltipPosition),P=k.props.points[T].tooltipPayload);var R={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:$,activePayload:P,activeCoordinate:M};this.setState(R),this.renderCursor(A),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var m,x;this.accessibilityManager.setDetails({offset:{left:(m=this.props.margin.left)!==null&&m!==void 0?m:0,top:(x=this.props.margin.top)!==null&&x!==void 0?x:0}})}return null}},{key:"componentDidUpdate",value:function(w){El([ze(w.children,yt)],[ze(this.props.children,yt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=ze(this.props.children,yt);if(w&&typeof w.props.shared=="boolean"){var O=w.props.shared?"axis":"item";return u.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var O=this.container,m=O.getBoundingClientRect(),x=cP(m),_={chartX:Math.round(w.pageX-x.left),chartY:Math.round(w.pageY-x.top)},A=m.width/O.offsetWidth||1,T=this.inRange(_.chartX,_.chartY,A);if(!T)return null;var $=this.state,P=$.xAxisMap,E=$.yAxisMap,j=this.getTooltipEventType(),I=Xb(this.state,this.props.data,this.props.layout,T);if(j!=="axis"&&P&&E){var M=It(P).scale,k=It(E).scale,R=M&&M.invert?M.invert(_.chartX):null,L=k&&k.invert?k.invert(_.chartY):null;return C(C({},_),{},{xValue:R,yValue:L},I)}return I?C(C({},_),I):null}},{key:"inRange",value:function(w,O){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,x=this.props.layout,_=w/m,A=O/m;if(x==="horizontal"||x==="vertical"){var T=this.state.offset,$=_>=T.left&&_<=T.left+T.width&&A>=T.top&&A<=T.top+T.height;return $?{x:_,y:A}:null}var P=this.state,E=P.angleAxisMap,j=P.radiusAxisMap;if(E&&j){var I=It(E);return Jm({x:_,y:A},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,O=this.getTooltipEventType(),m=ze(w,yt),x={};m&&O==="axis"&&(m.props.trigger==="click"?x={onClick:this.handleClick}:x={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Fi(this.props,this.handleOuterEvent);return C(C({},_),x)}},{key:"addListener",value:function(){_l.on(Al,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){_l.removeListener(Al,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,O,m){for(var x=this.state.formattedGraphicalItems,_=0,A=x.length;_ true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","/**\n * Checks if `value` is `null` or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\nfunction isNil(value) {\n return value == null;\n}\n\nmodule.exports = isNil;\n","var baseGetTag = require('./_baseGetTag'),\n isArray = require('./isArray'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nmodule.exports = isString;\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar numberTag = '[object Number]';\n\n/**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\nfunction isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n}\n\nmodule.exports = isNumber;\n","var isNumber = require('./isNumber');\n\n/**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\nfunction isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n}\n\nmodule.exports = isNaN;\n","import isString from 'lodash/isString';\nimport isNan from 'lodash/isNaN';\nimport get from 'lodash/get';\nimport lodashIsNumber from 'lodash/isNumber';\nimport isNil from 'lodash/isNil';\nexport var mathSign = function mathSign(value) {\n if (value === 0) {\n return 0;\n }\n if (value > 0) {\n return 1;\n }\n return -1;\n};\nexport var isPercent = function isPercent(value) {\n return isString(value) && value.indexOf('%') === value.length - 1;\n};\nexport var isNumber = function isNumber(value) {\n return lodashIsNumber(value) && !isNan(value);\n};\nexport var isNullish = function isNullish(value) {\n return isNil(value);\n};\nexport var isNumOrStr = function isNumOrStr(value) {\n return isNumber(value) || isString(value);\n};\nvar idCounter = 0;\nexport var uniqueId = function uniqueId(prefix) {\n var id = ++idCounter;\n return \"\".concat(prefix || '').concat(id);\n};\n\n/**\n * Get percent value of a total value\n * @param {number|string} percent A percent\n * @param {number} totalValue Total value\n * @param {number} defaultValue The value returned when percent is undefined or invalid\n * @param {boolean} validate If set to be true, the result will be validated\n * @return {number} value\n */\nexport var getPercentValue = function getPercentValue(percent, totalValue) {\n var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (!isNumber(percent) && !isString(percent)) {\n return defaultValue;\n }\n var value;\n if (isPercent(percent)) {\n var index = percent.indexOf('%');\n value = totalValue * parseFloat(percent.slice(0, index)) / 100;\n } else {\n value = +percent;\n }\n if (isNan(value)) {\n value = defaultValue;\n }\n if (validate && value > totalValue) {\n value = totalValue;\n }\n return value;\n};\nexport var getAnyElementOfObject = function getAnyElementOfObject(obj) {\n if (!obj) {\n return null;\n }\n var keys = Object.keys(obj);\n if (keys && keys.length) {\n return obj[keys[0]];\n }\n return null;\n};\nexport var hasDuplicate = function hasDuplicate(ary) {\n if (!Array.isArray(ary)) {\n return false;\n }\n var len = ary.length;\n var cache = {};\n for (var i = 0; i < len; i++) {\n if (!cache[ary[i]]) {\n cache[ary[i]] = true;\n } else {\n return true;\n }\n }\n return false;\n};\n\n/* @todo consider to rename this function into `getInterpolator` */\nexport var interpolateNumber = function interpolateNumber(numberA, numberB) {\n if (isNumber(numberA) && isNumber(numberB)) {\n return function (t) {\n return numberA + t * (numberB - numberA);\n };\n }\n return function () {\n return numberB;\n };\n};\nexport function findEntryInArray(ary, specifiedKey, specifiedValue) {\n if (!ary || !ary.length) {\n return null;\n }\n return ary.find(function (entry) {\n return entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : get(entry, specifiedKey)) === specifiedValue;\n });\n}\n\n/**\n * The least square linear regression\n * @param {Array} data The array of points\n * @returns {Object} The domain of x, and the parameter of linear function\n */\nexport var getLinearRegression = function getLinearRegression(data) {\n if (!data || !data.length) {\n return null;\n }\n var len = data.length;\n var xsum = 0;\n var ysum = 0;\n var xysum = 0;\n var xxsum = 0;\n var xmin = Infinity;\n var xmax = -Infinity;\n var xcurrent = 0;\n var ycurrent = 0;\n for (var i = 0; i < len; i++) {\n xcurrent = data[i].cx || 0;\n ycurrent = data[i].cy || 0;\n xsum += xcurrent;\n ysum += ycurrent;\n xysum += xcurrent * ycurrent;\n xxsum += xcurrent * xcurrent;\n xmin = Math.min(xmin, xcurrent);\n xmax = Math.max(xmax, xcurrent);\n }\n var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;\n return {\n xmin: xmin,\n xmax: xmax,\n a: a,\n b: (ysum - a * xsum) / len\n };\n};\n\n/**\n * Compare values.\n *\n * This function is intended to be passed to `Array.prototype.sort()`. It properly compares generic homogeneous arrays that are either `string[]`,\n * `number[]`, or `Date[]`. When comparing heterogeneous arrays or homogeneous arrays of other types, it will attempt to compare items properly but\n * will fall back to string comparison for mismatched or unsupported types.\n *\n * For some background, `Array.prototype.sort()`'s default comparator coerces each of the array's items into a string and compares the strings. This\n * often leads to undesirable behavior, especially with numerical items.\n *\n * @param {unknown} a The first item to compare\n * @param {unknown} b The second item to compare\n * @return {number} A negative number if a < b, a positive number if a > b, 0 if equal\n */\nexport var compareValues = function compareValues(a, b) {\n if (isNumber(a) && isNumber(b)) {\n return a - b;\n }\n if (isString(a) && isString(b)) {\n return a.localeCompare(b);\n }\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() - b.getTime();\n }\n return String(a).localeCompare(String(b));\n};","export function shallowEqual(a, b) {\n /* eslint-disable no-restricted-syntax */\n for (var key in a) {\n if ({}.hasOwnProperty.call(a, key) && (!{}.hasOwnProperty.call(b, key) || a[key] !== b[key])) {\n return false;\n }\n }\n for (var _key in b) {\n if ({}.hasOwnProperty.call(b, _key) && !{}.hasOwnProperty.call(a, _key)) {\n return false;\n }\n }\n return true;\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nimport { isValidElement } from 'react';\nimport isObject from 'lodash/isObject';\n\n/**\n * Determines how values are stacked:\n *\n * - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap.\n * - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle.\n * - `wiggle` and `silhouette` tries to keep the chart centered.\n * - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives.\n * - `positive` ignores all negative values, and then behaves like \\`none\\`.\n *\n * Also see https://d3js.org/d3-shape/stack#stack-offsets\n * (note that the `diverging` offset in d3 is named `sign` in recharts)\n */\n\n//\n// Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props.\n//\n\nvar SVGContainerPropKeys = ['viewBox', 'children'];\nexport var SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style',\n/*\n * removed 'type' SVGElementPropKey because we do not currently use any SVG elements\n * that can use it and it conflicts with the recharts prop 'type'\n * https://github.com/recharts/recharts/pull/3327\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type\n */\n// 'type',\n'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle'];\nvar PolyElementKeys = ['points', 'pathLength'];\n\n/** svg element types that have specific attribute filtration requirements */\n\n/** map of svg element types to unique svg attributes that belong to that element */\nexport var FilteredElementKeyMap = {\n svg: SVGContainerPropKeys,\n polygon: PolyElementKeys,\n polyline: PolyElementKeys\n};\nexport var EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];\n\n/** The type of easing function to use for animations */\n\n/** Specifies the duration of animation, the unit of this option is ms. */\n\n/** the offset of a chart, which define the blank space all around */\n\n/**\n * The domain of axis.\n * This is the definition\n *\n * Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis.\n * Categorical domain is defined as array of all possible values.\n *\n * Can be specified in many ways:\n * - array of numbers\n * - with special strings like 'dataMin' and 'dataMax'\n * - with special string math like 'dataMin - 100'\n * - with keyword 'auto'\n * - or a function\n * - array of functions\n * - or a combination of the above\n */\n\n/**\n * NumberDomain is an evaluated {@link AxisDomain}.\n * Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number.\n * This is after all the keywords and functions were evaluated and what is left is [min, max].\n *\n * Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible.\n *\n * There are also `category` axes that have different things than numbers in their domain.\n */\n\n/** The props definition of base axis */\n\n/** Defines how ticks are placed and whether / how tick collisions are handled.\n * 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown.\n * 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown.\n * 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks are always shown.\n * 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision.\n */\n\nexport var adaptEventHandlers = function adaptEventHandlers(props, newHandler) {\n if (!props || typeof props === 'function' || typeof props === 'boolean') {\n return null;\n }\n var inputProps = props;\n if ( /*#__PURE__*/isValidElement(props)) {\n inputProps = props.props;\n }\n if (!isObject(inputProps)) {\n return null;\n }\n var out = {};\n Object.keys(inputProps).forEach(function (key) {\n if (EventKeys.includes(key)) {\n out[key] = newHandler || function (e) {\n return inputProps[key](inputProps, e);\n };\n }\n });\n return out;\n};\nvar getEventHandlerOfChild = function getEventHandlerOfChild(originalHandler, data, index) {\n return function (e) {\n originalHandler(data, index, e);\n return null;\n };\n};\nexport var adaptEventsOfChild = function adaptEventsOfChild(props, data, index) {\n if (!isObject(props) || _typeof(props) !== 'object') {\n return null;\n }\n var out = null;\n Object.keys(props).forEach(function (key) {\n var item = props[key];\n if (EventKeys.includes(key) && typeof item === 'function') {\n if (!out) out = {};\n out[key] = getEventHandlerOfChild(item, data, index);\n }\n });\n return out;\n};","var _excluded = [\"children\"],\n _excluded2 = [\"children\"];\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nimport get from 'lodash/get';\nimport isNil from 'lodash/isNil';\nimport isString from 'lodash/isString';\nimport isFunction from 'lodash/isFunction';\nimport isObject from 'lodash/isObject';\nimport { Children, isValidElement } from 'react';\nimport { isFragment } from 'react-is';\nimport { isNumber } from './DataUtils';\nimport { shallowEqual } from './ShallowEqual';\nimport { FilteredElementKeyMap, SVGElementPropKeys, EventKeys } from './types';\nvar REACT_BROWSER_EVENT_MAP = {\n click: 'onClick',\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n mouseover: 'onMouseOver',\n mousemove: 'onMouseMove',\n mouseout: 'onMouseOut',\n mouseenter: 'onMouseEnter',\n mouseleave: 'onMouseLeave',\n touchcancel: 'onTouchCancel',\n touchend: 'onTouchEnd',\n touchmove: 'onTouchMove',\n touchstart: 'onTouchStart',\n contextmenu: 'onContextMenu',\n dblclick: 'onDoubleClick'\n};\nexport var SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];\nexport var LEGEND_TYPES = ['plainline', 'line', 'square', 'rect', 'circle', 'cross', 'diamond', 'star', 'triangle', 'wye', 'none'];\nexport var TOOLTIP_TYPES = ['none'];\n\n/**\n * Get the display name of a component\n * @param {Object} Comp Specified Component\n * @return {String} Display name of Component\n */\nexport var getDisplayName = function getDisplayName(Comp) {\n if (typeof Comp === 'string') {\n return Comp;\n }\n if (!Comp) {\n return '';\n }\n return Comp.displayName || Comp.name || 'Component';\n};\n\n// `toArray` gets called multiple times during the render\n// so we can memoize last invocation (since reference to `children` is the same)\nvar lastChildren = null;\nvar lastResult = null;\nexport var toArray = function toArray(children) {\n if (children === lastChildren && Array.isArray(lastResult)) {\n return lastResult;\n }\n var result = [];\n Children.forEach(children, function (child) {\n if (isNil(child)) return;\n if (isFragment(child)) {\n result = result.concat(toArray(child.props.children));\n } else {\n // @ts-expect-error this could still be Iterable and TS does not like that\n result.push(child);\n }\n });\n lastResult = result;\n lastChildren = children;\n return result;\n};\n\n/*\n * Find and return all matched children by type.\n * `type` must be a React.ComponentType\n */\nexport function findAllByType(children, type) {\n var result = [];\n var types = [];\n if (Array.isArray(type)) {\n types = type.map(function (t) {\n return getDisplayName(t);\n });\n } else {\n types = [getDisplayName(type)];\n }\n toArray(children).forEach(function (child) {\n var childType = get(child, 'type.displayName') || get(child, 'type.name');\n if (types.indexOf(childType) !== -1) {\n result.push(child);\n }\n });\n return result;\n}\n\n/*\n * Return the first matched child by type, return null otherwise.\n * `type` must be a React.ComponentType\n */\nexport function findChildByType(children, type) {\n var result = findAllByType(children, type);\n return result && result[0];\n}\n\n/*\n * Create a new array of children excluding the ones matched the type\n */\nexport var withoutType = function withoutType(children, type) {\n var newChildren = [];\n var types;\n if (Array.isArray(type)) {\n types = type.map(function (t) {\n return getDisplayName(t);\n });\n } else {\n types = [getDisplayName(type)];\n }\n toArray(children).forEach(function (child) {\n var displayName = get(child, 'type.displayName');\n if (displayName && types.indexOf(displayName) !== -1) {\n return;\n }\n newChildren.push(child);\n });\n return newChildren;\n};\n\n/**\n * validate the width and height props of a chart element\n * @param {Object} el A chart element\n * @return {Boolean} true If the props width and height are number, and greater than 0\n */\nexport var validateWidthHeight = function validateWidthHeight(el) {\n if (!el || !el.props) {\n return false;\n }\n var _el$props = el.props,\n width = _el$props.width,\n height = _el$props.height;\n if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0) {\n return false;\n }\n return true;\n};\nvar SVG_TAGS = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColormatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-url', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'lineGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern'];\nvar isSvgElement = function isSvgElement(child) {\n return child && child.type && isString(child.type) && SVG_TAGS.indexOf(child.type) >= 0;\n};\nexport var hasClipDot = function hasClipDot(dot) {\n return dot && _typeof(dot) === 'object' && 'clipDot' in dot;\n};\n\n/**\n * Checks if the property is valid to spread onto an SVG element or onto a specific component\n * @param {unknown} property property value currently being compared\n * @param {string} key property key currently being compared\n * @param {boolean} includeEvents if events are included in spreadable props\n * @param {boolean} svgElementType checks against map of SVG element types to attributes\n * @returns {boolean} is prop valid\n */\nexport var isValidSpreadableProp = function isValidSpreadableProp(property, key, includeEvents, svgElementType) {\n var _FilteredElementKeyMa;\n /**\n * If the svg element type is explicitly included, check against the filtered element key map\n * to determine if there are attributes that should only exist on that element type.\n * @todo Add an internal cjs version of https://github.com/wooorm/svg-element-attributes for full coverage.\n */\n var matchingElementTypeKeys = (_FilteredElementKeyMa = FilteredElementKeyMap === null || FilteredElementKeyMap === void 0 ? void 0 : FilteredElementKeyMap[svgElementType]) !== null && _FilteredElementKeyMa !== void 0 ? _FilteredElementKeyMa : [];\n return key.startsWith('data-') || !isFunction(property) && (svgElementType && matchingElementTypeKeys.includes(key) || SVGElementPropKeys.includes(key)) || includeEvents && EventKeys.includes(key);\n};\n\n/**\n * Filter all the svg elements of children\n * @param {Array} children The children of a react element\n * @return {Array} All the svg elements\n */\nexport var filterSvgElements = function filterSvgElements(children) {\n var svgElements = [];\n toArray(children).forEach(function (entry) {\n if (isSvgElement(entry)) {\n svgElements.push(entry);\n }\n });\n return svgElements;\n};\nexport var filterProps = function filterProps(props, includeEvents, svgElementType) {\n if (!props || typeof props === 'function' || typeof props === 'boolean') {\n return null;\n }\n var inputProps = props;\n if ( /*#__PURE__*/isValidElement(props)) {\n inputProps = props.props;\n }\n if (!isObject(inputProps)) {\n return null;\n }\n var out = {};\n\n /**\n * Props are blindly spread onto SVG elements. This loop filters out properties that we don't want to spread.\n * Items filtered out are as follows:\n * - functions in properties that are SVG attributes (functions are included when includeEvents is true)\n * - props that are SVG attributes but don't matched the passed svgElementType\n * - any prop that is not in SVGElementPropKeys (or in EventKeys if includeEvents is true)\n */\n Object.keys(inputProps).forEach(function (key) {\n var _inputProps;\n if (isValidSpreadableProp((_inputProps = inputProps) === null || _inputProps === void 0 ? void 0 : _inputProps[key], key, includeEvents, svgElementType)) {\n out[key] = inputProps[key];\n }\n });\n return out;\n};\n\n/**\n * Wether props of children changed\n * @param {Object} nextChildren The latest children\n * @param {Object} prevChildren The prev children\n * @return {Boolean} equal or not\n */\nexport var isChildrenEqual = function isChildrenEqual(nextChildren, prevChildren) {\n if (nextChildren === prevChildren) {\n return true;\n }\n var count = Children.count(nextChildren);\n if (count !== Children.count(prevChildren)) {\n return false;\n }\n if (count === 0) {\n return true;\n }\n if (count === 1) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return isSingleChildEqual(Array.isArray(nextChildren) ? nextChildren[0] : nextChildren, Array.isArray(prevChildren) ? prevChildren[0] : prevChildren);\n }\n for (var i = 0; i < count; i++) {\n var nextChild = nextChildren[i];\n var prevChild = prevChildren[i];\n if (Array.isArray(nextChild) || Array.isArray(prevChild)) {\n if (!isChildrenEqual(nextChild, prevChild)) {\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n } else if (!isSingleChildEqual(nextChild, prevChild)) {\n return false;\n }\n }\n return true;\n};\nexport var isSingleChildEqual = function isSingleChildEqual(nextChild, prevChild) {\n if (isNil(nextChild) && isNil(prevChild)) {\n return true;\n }\n if (!isNil(nextChild) && !isNil(prevChild)) {\n var _ref = nextChild.props || {},\n nextChildren = _ref.children,\n nextProps = _objectWithoutProperties(_ref, _excluded);\n var _ref2 = prevChild.props || {},\n prevChildren = _ref2.children,\n prevProps = _objectWithoutProperties(_ref2, _excluded2);\n if (nextChildren && prevChildren) {\n return shallowEqual(nextProps, prevProps) && isChildrenEqual(nextChildren, prevChildren);\n }\n if (!nextChildren && !prevChildren) {\n return shallowEqual(nextProps, prevProps);\n }\n return false;\n }\n return false;\n};\nexport var renderByOrder = function renderByOrder(children, renderMap) {\n var elements = [];\n var record = {};\n toArray(children).forEach(function (child, index) {\n if (isSvgElement(child)) {\n elements.push(child);\n } else if (child) {\n var displayName = getDisplayName(child.type);\n var _ref3 = renderMap[displayName] || {},\n handler = _ref3.handler,\n once = _ref3.once;\n if (handler && (!once || !record[displayName])) {\n var results = handler(child, displayName, index);\n elements.push(results);\n record[displayName] = true;\n }\n }\n });\n return elements;\n};\nexport var getReactEventByType = function getReactEventByType(e) {\n var type = e && e.type;\n if (type && REACT_BROWSER_EVENT_MAP[type]) {\n return REACT_BROWSER_EVENT_MAP[type];\n }\n return null;\n};\nexport var parseChildIndex = function parseChildIndex(child, children) {\n return toArray(children).indexOf(child);\n};","var _excluded = [\"children\", \"width\", \"height\", \"viewBox\", \"className\", \"style\", \"title\", \"desc\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\n/**\n * @fileOverview Surface\n */\nimport React from 'react';\nimport clsx from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nexport function Surface(props) {\n var children = props.children,\n width = props.width,\n height = props.height,\n viewBox = props.viewBox,\n className = props.className,\n style = props.style,\n title = props.title,\n desc = props.desc,\n others = _objectWithoutProperties(props, _excluded);\n var svgView = viewBox || {\n width: width,\n height: height,\n x: 0,\n y: 0\n };\n var layerClass = clsx('recharts-surface', className);\n return /*#__PURE__*/React.createElement(\"svg\", _extends({}, filterProps(others, true, 'svg'), {\n className: layerClass,\n width: width,\n height: height,\n style: style,\n viewBox: \"\".concat(svgView.x, \" \").concat(svgView.y, \" \").concat(svgView.width, \" \").concat(svgView.height)\n }), /*#__PURE__*/React.createElement(\"title\", null, title), /*#__PURE__*/React.createElement(\"desc\", null, desc), children);\n}","var _excluded = [\"children\", \"className\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nimport React from 'react';\nimport clsx from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nexport var Layer = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var children = props.children,\n className = props.className,\n others = _objectWithoutProperties(props, _excluded);\n var layerClass = clsx('recharts-layer', className);\n return /*#__PURE__*/React.createElement(\"g\", _extends({\n className: layerClass\n }, filterProps(others, true), {\n ref: ref\n }), children);\n});","/* eslint no-console: 0 */\nvar isDev = process.env.NODE_ENV !== 'production';\nexport var warn = function warn(condition, format) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n if (isDev && typeof console !== 'undefined' && console.warn) {\n if (format === undefined) {\n console.warn('LogUtils requires an error message argument');\n }\n if (!condition) {\n if (format === undefined) {\n console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var argIndex = 0;\n console.warn(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n }\n }\n }\n};","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","var baseSlice = require('./_baseSlice');\n\n/**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\nfunction castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n}\n\nmodule.exports = castSlice;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nmodule.exports = hasUnicode;\n","/**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction asciiToArray(string) {\n return string.split('');\n}\n\nmodule.exports = asciiToArray;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction unicodeToArray(string) {\n return string.match(reUnicode) || [];\n}\n\nmodule.exports = unicodeToArray;\n","var asciiToArray = require('./_asciiToArray'),\n hasUnicode = require('./_hasUnicode'),\n unicodeToArray = require('./_unicodeToArray');\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\nmodule.exports = stringToArray;\n","var castSlice = require('./_castSlice'),\n hasUnicode = require('./_hasUnicode'),\n stringToArray = require('./_stringToArray'),\n toString = require('./toString');\n\n/**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\nfunction createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n}\n\nmodule.exports = createCaseFirst;\n","var createCaseFirst = require('./_createCaseFirst');\n\n/**\n * Converts the first character of `string` to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.upperFirst('fred');\n * // => 'Fred'\n *\n * _.upperFirst('FRED');\n * // => 'FRED'\n */\nvar upperFirst = createCaseFirst('toUpperCase');\n\nmodule.exports = upperFirst;\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n","import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n","export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","import pointRadial from \"../pointRadial.js\";\n\nclass Bump {\n constructor(context, x) {\n this._context = context;\n this._x = x;\n }\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n }\n point(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: {\n this._point = 1;\n if (this._line) this._context.lineTo(x, y);\n else this._context.moveTo(x, y);\n break;\n }\n case 1: this._point = 2; // falls through\n default: {\n if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);\n else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);\n break;\n }\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nclass BumpRadial {\n constructor(context) {\n this._context = context;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {}\n point(x, y) {\n x = +x, y = +y;\n if (this._point === 0) {\n this._point = 1;\n } else {\n const p0 = pointRadial(this._x0, this._y0);\n const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);\n const p2 = pointRadial(x, this._y0);\n const p3 = pointRadial(x, y);\n this._context.moveTo(...p0);\n this._context.bezierCurveTo(...p1, ...p2, ...p3);\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nexport function bumpX(context) {\n return new Bump(context, true);\n}\n\nexport function bumpY(context) {\n return new Bump(context, false);\n}\n\nexport function bumpRadial(context) {\n return new BumpRadial(context);\n}\n","import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const w = sqrt(size);\n const x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n","import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n","import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n","import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n","import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n","function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n","export default function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n}\n","export default function(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport offsetNone from \"./offset/none.js\";\nimport orderNone from \"./order/none.js\";\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nfunction stackSeries(key) {\n const series = [];\n series.key = key;\n return series;\n}\n\nexport default function() {\n var keys = constant([]),\n order = orderNone,\n offset = offsetNone,\n value = stackValue;\n\n function stack(data) {\n var sz = Array.from(keys.apply(this, arguments), stackSeries),\n i, n = sz.length, j = -1,\n oz;\n\n for (const d of data) {\n for (i = 0, ++j; i < n; ++i) {\n (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d;\n }\n }\n\n for (i = 0, oz = array(order(sz)); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant(Array.from(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? orderNone : typeof _ === \"function\" ? _ : constant(Array.from(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset;\n };\n\n return stack;\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {\n for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;\n if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;\n }\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y / 2;\n }\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]],\n sij0 = si[j][1] || 0,\n sij1 = si[j - 1][1] || 0,\n s3 = (sij0 - sij1) / 2;\n for (var k = 0; k < i; ++k) {\n var sk = series[order[k]],\n skj0 = sk[j][1] || 0,\n skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n if (s1) y -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n none(series, order);\n}\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"type\", \"size\", \"sizeType\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\n/**\n * @fileOverview Curve\n */\nimport React from 'react';\nimport upperFirst from 'lodash/upperFirst';\nimport { symbol as shapeSymbol, symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye } from 'victory-vendor/d3-shape';\nimport clsx from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nvar symbolFactories = {\n symbolCircle: symbolCircle,\n symbolCross: symbolCross,\n symbolDiamond: symbolDiamond,\n symbolSquare: symbolSquare,\n symbolStar: symbolStar,\n symbolTriangle: symbolTriangle,\n symbolWye: symbolWye\n};\nvar RADIAN = Math.PI / 180;\nvar getSymbolFactory = function getSymbolFactory(type) {\n var name = \"symbol\".concat(upperFirst(type));\n return symbolFactories[name] || symbolCircle;\n};\nvar calculateAreaSize = function calculateAreaSize(size, sizeType, type) {\n if (sizeType === 'area') {\n return size;\n }\n switch (type) {\n case 'cross':\n return 5 * size * size / 9;\n case 'diamond':\n return 0.5 * size * size / Math.sqrt(3);\n case 'square':\n return size * size;\n case 'star':\n {\n var angle = 18 * RADIAN;\n return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.pow(Math.tan(angle), 2));\n }\n case 'triangle':\n return Math.sqrt(3) * size * size / 4;\n case 'wye':\n return (21 - 10 * Math.sqrt(3)) * size * size / 8;\n default:\n return Math.PI * size * size / 4;\n }\n};\nvar registerSymbol = function registerSymbol(key, factory) {\n symbolFactories[\"symbol\".concat(upperFirst(key))] = factory;\n};\nexport var Symbols = function Symbols(_ref) {\n var _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'circle' : _ref$type,\n _ref$size = _ref.size,\n size = _ref$size === void 0 ? 64 : _ref$size,\n _ref$sizeType = _ref.sizeType,\n sizeType = _ref$sizeType === void 0 ? 'area' : _ref$sizeType,\n rest = _objectWithoutProperties(_ref, _excluded);\n var props = _objectSpread(_objectSpread({}, rest), {}, {\n type: type,\n size: size,\n sizeType: sizeType\n });\n\n /**\n * Calculate the path of curve\n * @return {String} path\n */\n var getPath = function getPath() {\n var symbolFactory = getSymbolFactory(type);\n var symbol = shapeSymbol().type(symbolFactory).size(calculateAreaSize(size, sizeType, type));\n return symbol();\n };\n var className = props.className,\n cx = props.cx,\n cy = props.cy;\n var filteredProps = filterProps(props, true);\n if (cx === +cx && cy === +cy && size === +size) {\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filteredProps, {\n className: clsx('recharts-symbols', className),\n transform: \"translate(\".concat(cx, \", \").concat(cy, \")\"),\n d: getPath()\n }));\n }\n return null;\n};\nSymbols.registerSymbol = registerSymbol;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Default Legend Content\n */\nimport React, { PureComponent } from 'react';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { warn } from '../util/LogUtils';\nimport { Surface } from '../container/Surface';\nimport { Symbols } from '../shape/Symbols';\nimport { adaptEventsOfChild } from '../util/types';\nvar SIZE = 32;\nexport var DefaultLegendContent = /*#__PURE__*/function (_PureComponent) {\n function DefaultLegendContent() {\n _classCallCheck(this, DefaultLegendContent);\n return _callSuper(this, DefaultLegendContent, arguments);\n }\n _inherits(DefaultLegendContent, _PureComponent);\n return _createClass(DefaultLegendContent, [{\n key: \"renderIcon\",\n value:\n /**\n * Render the path of icon\n * @param {Object} data Data of each legend item\n * @return {String} Path element\n */\n function renderIcon(data) {\n var inactiveColor = this.props.inactiveColor;\n var halfSize = SIZE / 2;\n var sixthSize = SIZE / 6;\n var thirdSize = SIZE / 3;\n var color = data.inactive ? inactiveColor : data.color;\n if (data.type === 'plainline') {\n return /*#__PURE__*/React.createElement(\"line\", {\n strokeWidth: 4,\n fill: \"none\",\n stroke: color,\n strokeDasharray: data.payload.strokeDasharray,\n x1: 0,\n y1: halfSize,\n x2: SIZE,\n y2: halfSize,\n className: \"recharts-legend-icon\"\n });\n }\n if (data.type === 'line') {\n return /*#__PURE__*/React.createElement(\"path\", {\n strokeWidth: 4,\n fill: \"none\",\n stroke: color,\n d: \"M0,\".concat(halfSize, \"h\").concat(thirdSize, \"\\n A\").concat(sixthSize, \",\").concat(sixthSize, \",0,1,1,\").concat(2 * thirdSize, \",\").concat(halfSize, \"\\n H\").concat(SIZE, \"M\").concat(2 * thirdSize, \",\").concat(halfSize, \"\\n A\").concat(sixthSize, \",\").concat(sixthSize, \",0,1,1,\").concat(thirdSize, \",\").concat(halfSize),\n className: \"recharts-legend-icon\"\n });\n }\n if (data.type === 'rect') {\n return /*#__PURE__*/React.createElement(\"path\", {\n stroke: \"none\",\n fill: color,\n d: \"M0,\".concat(SIZE / 8, \"h\").concat(SIZE, \"v\").concat(SIZE * 3 / 4, \"h\").concat(-SIZE, \"z\"),\n className: \"recharts-legend-icon\"\n });\n }\n if ( /*#__PURE__*/React.isValidElement(data.legendIcon)) {\n var iconProps = _objectSpread({}, data);\n delete iconProps.legendIcon;\n return /*#__PURE__*/React.cloneElement(data.legendIcon, iconProps);\n }\n return /*#__PURE__*/React.createElement(Symbols, {\n fill: color,\n cx: halfSize,\n cy: halfSize,\n size: SIZE,\n sizeType: \"diameter\",\n type: data.type\n });\n }\n\n /**\n * Draw items of legend\n * @return {ReactElement} Items\n */\n }, {\n key: \"renderItems\",\n value: function renderItems() {\n var _this = this;\n var _this$props = this.props,\n payload = _this$props.payload,\n iconSize = _this$props.iconSize,\n layout = _this$props.layout,\n formatter = _this$props.formatter,\n inactiveColor = _this$props.inactiveColor;\n var viewBox = {\n x: 0,\n y: 0,\n width: SIZE,\n height: SIZE\n };\n var itemStyle = {\n display: layout === 'horizontal' ? 'inline-block' : 'block',\n marginRight: 10\n };\n var svgStyle = {\n display: 'inline-block',\n verticalAlign: 'middle',\n marginRight: 4\n };\n return payload.map(function (entry, i) {\n var finalFormatter = entry.formatter || formatter;\n var className = clsx(_defineProperty(_defineProperty({\n 'recharts-legend-item': true\n }, \"legend-item-\".concat(i), true), \"inactive\", entry.inactive));\n if (entry.type === 'none') {\n return null;\n }\n\n // Do not render entry.value as functions. Always require static string properties.\n var entryValue = !isFunction(entry.value) ? entry.value : null;\n warn(!isFunction(entry.value), \"The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: \" // eslint-disable-line max-len\n );\n var color = entry.inactive ? inactiveColor : entry.color;\n return /*#__PURE__*/React.createElement(\"li\", _extends({\n className: className,\n style: itemStyle\n // eslint-disable-next-line react/no-array-index-key\n ,\n key: \"legend-item-\".concat(i)\n }, adaptEventsOfChild(_this.props, entry, i)), /*#__PURE__*/React.createElement(Surface, {\n width: iconSize,\n height: iconSize,\n viewBox: viewBox,\n style: svgStyle\n }, _this.renderIcon(entry)), /*#__PURE__*/React.createElement(\"span\", {\n className: \"recharts-legend-item-text\",\n style: {\n color: color\n }\n }, finalFormatter ? finalFormatter(entryValue, entry, i) : entryValue));\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props2 = this.props,\n payload = _this$props2.payload,\n layout = _this$props2.layout,\n align = _this$props2.align;\n if (!payload || !payload.length) {\n return null;\n }\n var finalStyle = {\n padding: 0,\n margin: 0,\n textAlign: layout === 'horizontal' ? align : 'left'\n };\n return /*#__PURE__*/React.createElement(\"ul\", {\n className: \"recharts-default-legend\",\n style: finalStyle\n }, this.renderItems());\n }\n }]);\n}(PureComponent);\n_defineProperty(DefaultLegendContent, \"displayName\", 'Legend');\n_defineProperty(DefaultLegendContent, \"defaultProps\", {\n iconSize: 14,\n layout: 'horizontal',\n align: 'center',\n verticalAlign: 'middle',\n inactiveColor: '#ccc'\n});","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nmodule.exports = setCacheAdd;\n","/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nmodule.exports = setCacheHas;\n","var MapCache = require('./_MapCache'),\n setCacheAdd = require('./_setCacheAdd'),\n setCacheHas = require('./_setCacheHas');\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nmodule.exports = SetCache;\n","/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n","/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nmodule.exports = cacheHas;\n","var SetCache = require('./_SetCache'),\n arraySome = require('./_arraySome'),\n cacheHas = require('./_cacheHas');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalArrays;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nmodule.exports = mapToArray;\n","/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nmodule.exports = setToArray;\n","var Symbol = require('./_Symbol'),\n Uint8Array = require('./_Uint8Array'),\n eq = require('./eq'),\n equalArrays = require('./_equalArrays'),\n mapToArray = require('./_mapToArray'),\n setToArray = require('./_setToArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var getAllKeys = require('./_getAllKeys');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalObjects;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","var Stack = require('./_Stack'),\n equalArrays = require('./_equalArrays'),\n equalByTag = require('./_equalByTag'),\n equalObjects = require('./_equalObjects'),\n getTag = require('./_getTag'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isTypedArray = require('./isTypedArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nmodule.exports = baseIsEqualDeep;\n","var baseIsEqualDeep = require('./_baseIsEqualDeep'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nmodule.exports = baseIsEqual;\n","var Stack = require('./_Stack'),\n baseIsEqual = require('./_baseIsEqual');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n","var isObject = require('./isObject');\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n","var isStrictComparable = require('./_isStrictComparable'),\n keys = require('./keys');\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n","/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nmodule.exports = matchesStrictComparable;\n","var baseIsMatch = require('./_baseIsMatch'),\n getMatchData = require('./_getMatchData'),\n matchesStrictComparable = require('./_matchesStrictComparable');\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n","/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var baseIsEqual = require('./_baseIsEqual'),\n get = require('./get'),\n hasIn = require('./hasIn'),\n isKey = require('./_isKey'),\n isStrictComparable = require('./_isStrictComparable'),\n matchesStrictComparable = require('./_matchesStrictComparable'),\n toKey = require('./_toKey');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n","var baseGet = require('./_baseGet');\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nmodule.exports = basePropertyDeep;\n","var baseProperty = require('./_baseProperty'),\n basePropertyDeep = require('./_basePropertyDeep'),\n isKey = require('./_isKey'),\n toKey = require('./_toKey');\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n","var baseMatches = require('./_baseMatches'),\n baseMatchesProperty = require('./_baseMatchesProperty'),\n identity = require('./identity'),\n isArray = require('./isArray'),\n property = require('./property');\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nmodule.exports = baseIteratee;\n","/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nmodule.exports = baseIsNaN;\n","/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = strictIndexOf;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIsNaN = require('./_baseIsNaN'),\n strictIndexOf = require('./_strictIndexOf');\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nmodule.exports = baseIndexOf;\n","var baseIndexOf = require('./_baseIndexOf');\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nmodule.exports = arrayIncludes;\n","/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arrayIncludesWith;\n","/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n","var Set = require('./_Set'),\n noop = require('./noop'),\n setToArray = require('./_setToArray');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nmodule.exports = createSet;\n","var SetCache = require('./_SetCache'),\n arrayIncludes = require('./_arrayIncludes'),\n arrayIncludesWith = require('./_arrayIncludesWith'),\n cacheHas = require('./_cacheHas'),\n createSet = require('./_createSet'),\n setToArray = require('./_setToArray');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n","var baseIteratee = require('./_baseIteratee'),\n baseUniq = require('./_baseUniq');\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];\n}\n\nmodule.exports = uniqBy;\n","import uniqBy from 'lodash/uniqBy';\nimport isFunction from 'lodash/isFunction';\n\n/**\n * This is configuration option that decides how to filter for unique values only:\n *\n * - `false` means \"no filter\"\n * - `true` means \"use recharts default filter\"\n * - function means \"use return of this function as the default key\"\n */\n\nexport function getUniqPayload(payload, option, defaultUniqBy) {\n if (option === true) {\n return uniqBy(payload, defaultUniqBy);\n }\n if (isFunction(option)) {\n return uniqBy(payload, option);\n }\n return payload;\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"ref\"];\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\n/**\n * @fileOverview Legend\n */\nimport React, { PureComponent } from 'react';\nimport { DefaultLegendContent } from './DefaultLegendContent';\nimport { isNumber } from '../util/DataUtils';\nimport { getUniqPayload } from '../util/payload/getUniqPayload';\nfunction defaultUniqBy(entry) {\n return entry.value;\n}\nfunction renderContent(content, props) {\n if ( /*#__PURE__*/React.isValidElement(content)) {\n return /*#__PURE__*/React.cloneElement(content, props);\n }\n if (typeof content === 'function') {\n return /*#__PURE__*/React.createElement(content, props);\n }\n var ref = props.ref,\n otherProps = _objectWithoutProperties(props, _excluded);\n return /*#__PURE__*/React.createElement(DefaultLegendContent, otherProps);\n}\nvar EPS = 1;\nexport var Legend = /*#__PURE__*/function (_PureComponent) {\n function Legend() {\n var _this;\n _classCallCheck(this, Legend);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, Legend, [].concat(args));\n _defineProperty(_this, \"lastBoundingBox\", {\n width: -1,\n height: -1\n });\n return _this;\n }\n _inherits(Legend, _PureComponent);\n return _createClass(Legend, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.updateBBox();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.updateBBox();\n }\n }, {\n key: \"getBBox\",\n value: function getBBox() {\n if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {\n var box = this.wrapperNode.getBoundingClientRect();\n box.height = this.wrapperNode.offsetHeight;\n box.width = this.wrapperNode.offsetWidth;\n return box;\n }\n return null;\n }\n }, {\n key: \"updateBBox\",\n value: function updateBBox() {\n var onBBoxUpdate = this.props.onBBoxUpdate;\n var box = this.getBBox();\n if (box) {\n if (Math.abs(box.width - this.lastBoundingBox.width) > EPS || Math.abs(box.height - this.lastBoundingBox.height) > EPS) {\n this.lastBoundingBox.width = box.width;\n this.lastBoundingBox.height = box.height;\n if (onBBoxUpdate) {\n onBBoxUpdate(box);\n }\n }\n } else if (this.lastBoundingBox.width !== -1 || this.lastBoundingBox.height !== -1) {\n this.lastBoundingBox.width = -1;\n this.lastBoundingBox.height = -1;\n if (onBBoxUpdate) {\n onBBoxUpdate(null);\n }\n }\n }\n }, {\n key: \"getBBoxSnapshot\",\n value: function getBBoxSnapshot() {\n if (this.lastBoundingBox.width >= 0 && this.lastBoundingBox.height >= 0) {\n return _objectSpread({}, this.lastBoundingBox);\n }\n return {\n width: 0,\n height: 0\n };\n }\n }, {\n key: \"getDefaultPosition\",\n value: function getDefaultPosition(style) {\n var _this$props = this.props,\n layout = _this$props.layout,\n align = _this$props.align,\n verticalAlign = _this$props.verticalAlign,\n margin = _this$props.margin,\n chartWidth = _this$props.chartWidth,\n chartHeight = _this$props.chartHeight;\n var hPos, vPos;\n if (!style || (style.left === undefined || style.left === null) && (style.right === undefined || style.right === null)) {\n if (align === 'center' && layout === 'vertical') {\n var box = this.getBBoxSnapshot();\n hPos = {\n left: ((chartWidth || 0) - box.width) / 2\n };\n } else {\n hPos = align === 'right' ? {\n right: margin && margin.right || 0\n } : {\n left: margin && margin.left || 0\n };\n }\n }\n if (!style || (style.top === undefined || style.top === null) && (style.bottom === undefined || style.bottom === null)) {\n if (verticalAlign === 'middle') {\n var _box = this.getBBoxSnapshot();\n vPos = {\n top: ((chartHeight || 0) - _box.height) / 2\n };\n } else {\n vPos = verticalAlign === 'bottom' ? {\n bottom: margin && margin.bottom || 0\n } : {\n top: margin && margin.top || 0\n };\n }\n }\n return _objectSpread(_objectSpread({}, hPos), vPos);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var _this$props2 = this.props,\n content = _this$props2.content,\n width = _this$props2.width,\n height = _this$props2.height,\n wrapperStyle = _this$props2.wrapperStyle,\n payloadUniqBy = _this$props2.payloadUniqBy,\n payload = _this$props2.payload;\n var outerStyle = _objectSpread(_objectSpread({\n position: 'absolute',\n width: width || 'auto',\n height: height || 'auto'\n }, this.getDefaultPosition(wrapperStyle)), wrapperStyle);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"recharts-legend-wrapper\",\n style: outerStyle,\n ref: function ref(node) {\n _this2.wrapperNode = node;\n }\n }, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {\n payload: getUniqPayload(payload, payloadUniqBy, defaultUniqBy)\n })));\n }\n }], [{\n key: \"getWithHeight\",\n value: function getWithHeight(item, chartWidth) {\n var _this$defaultProps$it = _objectSpread(_objectSpread({}, this.defaultProps), item.props),\n layout = _this$defaultProps$it.layout;\n if (layout === 'vertical' && isNumber(item.props.height)) {\n return {\n height: item.props.height\n };\n }\n if (layout === 'horizontal') {\n return {\n width: item.props.width || chartWidth\n };\n }\n return null;\n }\n }]);\n}(PureComponent);\n_defineProperty(Legend, \"displayName\", 'Legend');\n_defineProperty(Legend, \"defaultProps\", {\n iconSize: 14,\n layout: 'horizontal',\n align: 'center',\n verticalAlign: 'bottom'\n});","var Symbol = require('./_Symbol'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray');\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n","var arrayPush = require('./_arrayPush'),\n isFlattenable = require('./_isFlattenable');\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n","/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var createBaseFor = require('./_createBaseFor');\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var baseFor = require('./_baseFor'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n","var isArrayLike = require('./isArrayLike');\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n","var baseForOwn = require('./_baseForOwn'),\n createBaseEach = require('./_createBaseEach');\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","/**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nmodule.exports = baseSortBy;\n","var isSymbol = require('./isSymbol');\n\n/**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n}\n\nmodule.exports = compareAscending;\n","var compareAscending = require('./_compareAscending');\n\n/**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n}\n\nmodule.exports = compareMultiple;\n","var arrayMap = require('./_arrayMap'),\n baseGet = require('./_baseGet'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n baseSortBy = require('./_baseSortBy'),\n baseUnary = require('./_baseUnary'),\n compareMultiple = require('./_compareMultiple'),\n identity = require('./identity'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\nfunction baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(baseIteratee));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n}\n\nmodule.exports = baseOrderBy;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var identity = require('./identity'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nmodule.exports = baseRest;\n","var eq = require('./eq'),\n isArrayLike = require('./isArrayLike'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject');\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var baseFlatten = require('./_baseFlatten'),\n baseOrderBy = require('./_baseOrderBy'),\n baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\nvar sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n});\n\nmodule.exports = sortBy;\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Default Tooltip Content\n */\n\nimport React from 'react';\nimport sortBy from 'lodash/sortBy';\nimport isNil from 'lodash/isNil';\nimport clsx from 'clsx';\nimport { isNumOrStr } from '../util/DataUtils';\nfunction defaultFormatter(value) {\n return Array.isArray(value) && isNumOrStr(value[0]) && isNumOrStr(value[1]) ? value.join(' ~ ') : value;\n}\nexport var DefaultTooltipContent = function DefaultTooltipContent(props) {\n var _props$separator = props.separator,\n separator = _props$separator === void 0 ? ' : ' : _props$separator,\n _props$contentStyle = props.contentStyle,\n contentStyle = _props$contentStyle === void 0 ? {} : _props$contentStyle,\n _props$itemStyle = props.itemStyle,\n itemStyle = _props$itemStyle === void 0 ? {} : _props$itemStyle,\n _props$labelStyle = props.labelStyle,\n labelStyle = _props$labelStyle === void 0 ? {} : _props$labelStyle,\n payload = props.payload,\n formatter = props.formatter,\n itemSorter = props.itemSorter,\n wrapperClassName = props.wrapperClassName,\n labelClassName = props.labelClassName,\n label = props.label,\n labelFormatter = props.labelFormatter,\n _props$accessibilityL = props.accessibilityLayer,\n accessibilityLayer = _props$accessibilityL === void 0 ? false : _props$accessibilityL;\n var renderContent = function renderContent() {\n if (payload && payload.length) {\n var listStyle = {\n padding: 0,\n margin: 0\n };\n var items = (itemSorter ? sortBy(payload, itemSorter) : payload).map(function (entry, i) {\n if (entry.type === 'none') {\n return null;\n }\n var finalItemStyle = _objectSpread({\n display: 'block',\n paddingTop: 4,\n paddingBottom: 4,\n color: entry.color || '#000'\n }, itemStyle);\n var finalFormatter = entry.formatter || formatter || defaultFormatter;\n var value = entry.value,\n name = entry.name;\n var finalValue = value;\n var finalName = name;\n if (finalFormatter && finalValue != null && finalName != null) {\n var formatted = finalFormatter(value, name, entry, i, payload);\n if (Array.isArray(formatted)) {\n var _formatted = _slicedToArray(formatted, 2);\n finalValue = _formatted[0];\n finalName = _formatted[1];\n } else {\n finalValue = formatted;\n }\n }\n return (\n /*#__PURE__*/\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(\"li\", {\n className: \"recharts-tooltip-item\",\n key: \"tooltip-item-\".concat(i),\n style: finalItemStyle\n }, isNumOrStr(finalName) ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"recharts-tooltip-item-name\"\n }, finalName) : null, isNumOrStr(finalName) ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"recharts-tooltip-item-separator\"\n }, separator) : null, /*#__PURE__*/React.createElement(\"span\", {\n className: \"recharts-tooltip-item-value\"\n }, finalValue), /*#__PURE__*/React.createElement(\"span\", {\n className: \"recharts-tooltip-item-unit\"\n }, entry.unit || ''))\n );\n });\n return /*#__PURE__*/React.createElement(\"ul\", {\n className: \"recharts-tooltip-item-list\",\n style: listStyle\n }, items);\n }\n return null;\n };\n var finalStyle = _objectSpread({\n margin: 0,\n padding: 10,\n backgroundColor: '#fff',\n border: '1px solid #ccc',\n whiteSpace: 'nowrap'\n }, contentStyle);\n var finalLabelStyle = _objectSpread({\n margin: 0\n }, labelStyle);\n var hasLabel = !isNil(label);\n var finalLabel = hasLabel ? label : '';\n var wrapperCN = clsx('recharts-default-tooltip', wrapperClassName);\n var labelCN = clsx('recharts-tooltip-label', labelClassName);\n if (hasLabel && labelFormatter && payload !== undefined && payload !== null) {\n finalLabel = labelFormatter(label, payload);\n }\n var accessibilityAttributes = accessibilityLayer ? {\n role: 'status',\n 'aria-live': 'assertive'\n } : {};\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n className: wrapperCN,\n style: finalStyle\n }, accessibilityAttributes), /*#__PURE__*/React.createElement(\"p\", {\n className: labelCN,\n style: finalLabelStyle\n }, /*#__PURE__*/React.isValidElement(finalLabel) ? finalLabel : \"\".concat(finalLabel)), renderContent());\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport clsx from 'clsx';\nimport { isNumber } from '../DataUtils';\nvar CSS_CLASS_PREFIX = 'recharts-tooltip-wrapper';\nvar TOOLTIP_HIDDEN = {\n visibility: 'hidden'\n};\nexport function getTooltipCSSClassName(_ref) {\n var coordinate = _ref.coordinate,\n translateX = _ref.translateX,\n translateY = _ref.translateY;\n return clsx(CSS_CLASS_PREFIX, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, \"\".concat(CSS_CLASS_PREFIX, \"-right\"), isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX >= coordinate.x), \"\".concat(CSS_CLASS_PREFIX, \"-left\"), isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX < coordinate.x), \"\".concat(CSS_CLASS_PREFIX, \"-bottom\"), isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY >= coordinate.y), \"\".concat(CSS_CLASS_PREFIX, \"-top\"), isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY < coordinate.y));\n}\nexport function getTooltipTranslateXY(_ref2) {\n var allowEscapeViewBox = _ref2.allowEscapeViewBox,\n coordinate = _ref2.coordinate,\n key = _ref2.key,\n offsetTopLeft = _ref2.offsetTopLeft,\n position = _ref2.position,\n reverseDirection = _ref2.reverseDirection,\n tooltipDimension = _ref2.tooltipDimension,\n viewBox = _ref2.viewBox,\n viewBoxDimension = _ref2.viewBoxDimension;\n if (position && isNumber(position[key])) {\n return position[key];\n }\n var negative = coordinate[key] - tooltipDimension - offsetTopLeft;\n var positive = coordinate[key] + offsetTopLeft;\n if (allowEscapeViewBox[key]) {\n return reverseDirection[key] ? negative : positive;\n }\n if (reverseDirection[key]) {\n var _tooltipBoundary = negative;\n var _viewBoxBoundary = viewBox[key];\n if (_tooltipBoundary < _viewBoxBoundary) {\n return Math.max(positive, viewBox[key]);\n }\n return Math.max(negative, viewBox[key]);\n }\n var tooltipBoundary = positive + tooltipDimension;\n var viewBoxBoundary = viewBox[key] + viewBoxDimension;\n if (tooltipBoundary > viewBoxBoundary) {\n return Math.max(negative, viewBox[key]);\n }\n return Math.max(positive, viewBox[key]);\n}\nexport function getTransformStyle(_ref3) {\n var translateX = _ref3.translateX,\n translateY = _ref3.translateY,\n useTranslate3d = _ref3.useTranslate3d;\n return {\n transform: useTranslate3d ? \"translate3d(\".concat(translateX, \"px, \").concat(translateY, \"px, 0)\") : \"translate(\".concat(translateX, \"px, \").concat(translateY, \"px)\")\n };\n}\nexport function getTooltipTranslate(_ref4) {\n var allowEscapeViewBox = _ref4.allowEscapeViewBox,\n coordinate = _ref4.coordinate,\n offsetTopLeft = _ref4.offsetTopLeft,\n position = _ref4.position,\n reverseDirection = _ref4.reverseDirection,\n tooltipBox = _ref4.tooltipBox,\n useTranslate3d = _ref4.useTranslate3d,\n viewBox = _ref4.viewBox;\n var cssProperties, translateX, translateY;\n if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) {\n translateX = getTooltipTranslateXY({\n allowEscapeViewBox: allowEscapeViewBox,\n coordinate: coordinate,\n key: 'x',\n offsetTopLeft: offsetTopLeft,\n position: position,\n reverseDirection: reverseDirection,\n tooltipDimension: tooltipBox.width,\n viewBox: viewBox,\n viewBoxDimension: viewBox.width\n });\n translateY = getTooltipTranslateXY({\n allowEscapeViewBox: allowEscapeViewBox,\n coordinate: coordinate,\n key: 'y',\n offsetTopLeft: offsetTopLeft,\n position: position,\n reverseDirection: reverseDirection,\n tooltipDimension: tooltipBox.height,\n viewBox: viewBox,\n viewBoxDimension: viewBox.height\n });\n cssProperties = getTransformStyle({\n translateX: translateX,\n translateY: translateY,\n useTranslate3d: useTranslate3d\n });\n } else {\n cssProperties = TOOLTIP_HIDDEN;\n }\n return {\n cssProperties: cssProperties,\n cssClasses: getTooltipCSSClassName({\n translateX: translateX,\n translateY: translateY,\n coordinate: coordinate\n })\n };\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport React, { PureComponent } from 'react';\nimport { getTooltipTranslate } from '../util/tooltip/translate';\nvar EPSILON = 1;\nexport var TooltipBoundingBox = /*#__PURE__*/function (_PureComponent) {\n function TooltipBoundingBox() {\n var _this;\n _classCallCheck(this, TooltipBoundingBox);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, TooltipBoundingBox, [].concat(args));\n _defineProperty(_this, \"state\", {\n dismissed: false,\n dismissedAtCoordinate: {\n x: 0,\n y: 0\n },\n lastBoundingBox: {\n width: -1,\n height: -1\n }\n });\n _defineProperty(_this, \"handleKeyDown\", function (event) {\n if (event.key === 'Escape') {\n var _this$props$coordinat, _this$props$coordinat2, _this$props$coordinat3, _this$props$coordinat4;\n _this.setState({\n dismissed: true,\n dismissedAtCoordinate: {\n x: (_this$props$coordinat = (_this$props$coordinat2 = _this.props.coordinate) === null || _this$props$coordinat2 === void 0 ? void 0 : _this$props$coordinat2.x) !== null && _this$props$coordinat !== void 0 ? _this$props$coordinat : 0,\n y: (_this$props$coordinat3 = (_this$props$coordinat4 = _this.props.coordinate) === null || _this$props$coordinat4 === void 0 ? void 0 : _this$props$coordinat4.y) !== null && _this$props$coordinat3 !== void 0 ? _this$props$coordinat3 : 0\n }\n });\n }\n });\n return _this;\n }\n _inherits(TooltipBoundingBox, _PureComponent);\n return _createClass(TooltipBoundingBox, [{\n key: \"updateBBox\",\n value: function updateBBox() {\n if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {\n var box = this.wrapperNode.getBoundingClientRect();\n if (Math.abs(box.width - this.state.lastBoundingBox.width) > EPSILON || Math.abs(box.height - this.state.lastBoundingBox.height) > EPSILON) {\n this.setState({\n lastBoundingBox: {\n width: box.width,\n height: box.height\n }\n });\n }\n } else if (this.state.lastBoundingBox.width !== -1 || this.state.lastBoundingBox.height !== -1) {\n this.setState({\n lastBoundingBox: {\n width: -1,\n height: -1\n }\n });\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n document.addEventListener('keydown', this.handleKeyDown);\n this.updateBBox();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n document.removeEventListener('keydown', this.handleKeyDown);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n var _this$props$coordinat5, _this$props$coordinat6;\n if (this.props.active) {\n this.updateBBox();\n }\n if (!this.state.dismissed) {\n return;\n }\n if (((_this$props$coordinat5 = this.props.coordinate) === null || _this$props$coordinat5 === void 0 ? void 0 : _this$props$coordinat5.x) !== this.state.dismissedAtCoordinate.x || ((_this$props$coordinat6 = this.props.coordinate) === null || _this$props$coordinat6 === void 0 ? void 0 : _this$props$coordinat6.y) !== this.state.dismissedAtCoordinate.y) {\n this.state.dismissed = false;\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var _this$props = this.props,\n active = _this$props.active,\n allowEscapeViewBox = _this$props.allowEscapeViewBox,\n animationDuration = _this$props.animationDuration,\n animationEasing = _this$props.animationEasing,\n children = _this$props.children,\n coordinate = _this$props.coordinate,\n hasPayload = _this$props.hasPayload,\n isAnimationActive = _this$props.isAnimationActive,\n offset = _this$props.offset,\n position = _this$props.position,\n reverseDirection = _this$props.reverseDirection,\n useTranslate3d = _this$props.useTranslate3d,\n viewBox = _this$props.viewBox,\n wrapperStyle = _this$props.wrapperStyle;\n var _getTooltipTranslate = getTooltipTranslate({\n allowEscapeViewBox: allowEscapeViewBox,\n coordinate: coordinate,\n offsetTopLeft: offset,\n position: position,\n reverseDirection: reverseDirection,\n tooltipBox: this.state.lastBoundingBox,\n useTranslate3d: useTranslate3d,\n viewBox: viewBox\n }),\n cssClasses = _getTooltipTranslate.cssClasses,\n cssProperties = _getTooltipTranslate.cssProperties;\n var outerStyle = _objectSpread(_objectSpread({\n transition: isAnimationActive && active ? \"transform \".concat(animationDuration, \"ms \").concat(animationEasing) : undefined\n }, cssProperties), {}, {\n pointerEvents: 'none',\n visibility: !this.state.dismissed && active && hasPayload ? 'visible' : 'hidden',\n position: 'absolute',\n top: 0,\n left: 0\n }, wrapperStyle);\n return (\n /*#__PURE__*/\n // This element allow listening to the `Escape` key.\n // See https://github.com/recharts/recharts/pull/2925\n React.createElement(\"div\", {\n tabIndex: -1,\n className: cssClasses,\n style: outerStyle,\n ref: function ref(node) {\n _this2.wrapperNode = node;\n }\n }, children)\n );\n }\n }]);\n}(PureComponent);","var parseIsSsrByDefault = function parseIsSsrByDefault() {\n return !(typeof window !== 'undefined' && window.document && window.document.createElement && window.setTimeout);\n};\nexport var Global = {\n isSsr: parseIsSsrByDefault(),\n get: function get(key) {\n return Global[key];\n },\n set: function set(key, value) {\n if (typeof key === 'string') {\n Global[key] = value;\n } else {\n var keys = Object.keys(key);\n if (keys && keys.length) {\n keys.forEach(function (k) {\n Global[k] = key[k];\n });\n }\n }\n }\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Tooltip\n */\nimport React, { PureComponent } from 'react';\nimport { DefaultTooltipContent } from './DefaultTooltipContent';\nimport { TooltipBoundingBox } from './TooltipBoundingBox';\nimport { Global } from '../util/Global';\nimport { getUniqPayload } from '../util/payload/getUniqPayload';\nfunction defaultUniqBy(entry) {\n return entry.dataKey;\n}\nfunction renderContent(content, props) {\n if ( /*#__PURE__*/React.isValidElement(content)) {\n return /*#__PURE__*/React.cloneElement(content, props);\n }\n if (typeof content === 'function') {\n return /*#__PURE__*/React.createElement(content, props);\n }\n return /*#__PURE__*/React.createElement(DefaultTooltipContent, props);\n}\nexport var Tooltip = /*#__PURE__*/function (_PureComponent) {\n function Tooltip() {\n _classCallCheck(this, Tooltip);\n return _callSuper(this, Tooltip, arguments);\n }\n _inherits(Tooltip, _PureComponent);\n return _createClass(Tooltip, [{\n key: \"render\",\n value: function render() {\n var _this = this;\n var _this$props = this.props,\n active = _this$props.active,\n allowEscapeViewBox = _this$props.allowEscapeViewBox,\n animationDuration = _this$props.animationDuration,\n animationEasing = _this$props.animationEasing,\n content = _this$props.content,\n coordinate = _this$props.coordinate,\n filterNull = _this$props.filterNull,\n isAnimationActive = _this$props.isAnimationActive,\n offset = _this$props.offset,\n payload = _this$props.payload,\n payloadUniqBy = _this$props.payloadUniqBy,\n position = _this$props.position,\n reverseDirection = _this$props.reverseDirection,\n useTranslate3d = _this$props.useTranslate3d,\n viewBox = _this$props.viewBox,\n wrapperStyle = _this$props.wrapperStyle;\n var finalPayload = payload !== null && payload !== void 0 ? payload : [];\n if (filterNull && finalPayload.length) {\n finalPayload = getUniqPayload(payload.filter(function (entry) {\n return entry.value != null && (entry.hide !== true || _this.props.includeHidden);\n }), payloadUniqBy, defaultUniqBy);\n }\n var hasPayload = finalPayload.length > 0;\n return /*#__PURE__*/React.createElement(TooltipBoundingBox, {\n allowEscapeViewBox: allowEscapeViewBox,\n animationDuration: animationDuration,\n animationEasing: animationEasing,\n isAnimationActive: isAnimationActive,\n active: active,\n coordinate: coordinate,\n hasPayload: hasPayload,\n offset: offset,\n position: position,\n reverseDirection: reverseDirection,\n useTranslate3d: useTranslate3d,\n viewBox: viewBox,\n wrapperStyle: wrapperStyle\n }, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {\n payload: finalPayload\n })));\n }\n }]);\n}(PureComponent);\n_defineProperty(Tooltip, \"displayName\", 'Tooltip');\n_defineProperty(Tooltip, \"defaultProps\", {\n accessibilityLayer: false,\n allowEscapeViewBox: {\n x: false,\n y: false\n },\n animationDuration: 400,\n animationEasing: 'ease',\n contentStyle: {},\n coordinate: {\n x: 0,\n y: 0\n },\n cursor: true,\n cursorStyle: {},\n filterNull: true,\n isAnimationActive: !Global.isSsr,\n itemStyle: {},\n labelStyle: {},\n offset: 10,\n reverseDirection: {\n x: false,\n y: false\n },\n separator: ' : ',\n trigger: 'hover',\n useTranslate3d: false,\n viewBox: {\n x: 0,\n y: 0,\n height: 0,\n width: 0\n },\n wrapperStyle: {}\n});","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/**\n * @fileOverview Wrapper component to make charts adapt to the size of parent * DOM\n */\nimport clsx from 'clsx';\nimport React, { forwardRef, cloneElement, useState, useImperativeHandle, useRef, useEffect, useMemo, useCallback } from 'react';\nimport throttle from 'lodash/throttle';\nimport { isPercent } from '../util/DataUtils';\nimport { warn } from '../util/LogUtils';\nimport { getDisplayName } from '../util/ReactUtils';\nexport var ResponsiveContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {\n var aspect = _ref.aspect,\n _ref$initialDimension = _ref.initialDimension,\n initialDimension = _ref$initialDimension === void 0 ? {\n width: -1,\n height: -1\n } : _ref$initialDimension,\n _ref$width = _ref.width,\n width = _ref$width === void 0 ? '100%' : _ref$width,\n _ref$height = _ref.height,\n height = _ref$height === void 0 ? '100%' : _ref$height,\n _ref$minWidth = _ref.minWidth,\n minWidth = _ref$minWidth === void 0 ? 0 : _ref$minWidth,\n minHeight = _ref.minHeight,\n maxHeight = _ref.maxHeight,\n children = _ref.children,\n _ref$debounce = _ref.debounce,\n debounce = _ref$debounce === void 0 ? 0 : _ref$debounce,\n id = _ref.id,\n className = _ref.className,\n onResize = _ref.onResize,\n _ref$style = _ref.style,\n style = _ref$style === void 0 ? {} : _ref$style;\n var containerRef = useRef(null);\n var onResizeRef = useRef();\n onResizeRef.current = onResize;\n useImperativeHandle(ref, function () {\n return Object.defineProperty(containerRef.current, 'current', {\n get: function get() {\n // eslint-disable-next-line no-console\n console.warn('The usage of ref.current.current is deprecated and will no longer be supported.');\n return containerRef.current;\n },\n configurable: true\n });\n });\n var _useState = useState({\n containerWidth: initialDimension.width,\n containerHeight: initialDimension.height\n }),\n _useState2 = _slicedToArray(_useState, 2),\n sizes = _useState2[0],\n setSizes = _useState2[1];\n var setContainerSize = useCallback(function (newWidth, newHeight) {\n setSizes(function (prevState) {\n var roundedWidth = Math.round(newWidth);\n var roundedHeight = Math.round(newHeight);\n if (prevState.containerWidth === roundedWidth && prevState.containerHeight === roundedHeight) {\n return prevState;\n }\n return {\n containerWidth: roundedWidth,\n containerHeight: roundedHeight\n };\n });\n }, []);\n useEffect(function () {\n var callback = function callback(entries) {\n var _onResizeRef$current;\n var _entries$0$contentRec = entries[0].contentRect,\n containerWidth = _entries$0$contentRec.width,\n containerHeight = _entries$0$contentRec.height;\n setContainerSize(containerWidth, containerHeight);\n (_onResizeRef$current = onResizeRef.current) === null || _onResizeRef$current === void 0 || _onResizeRef$current.call(onResizeRef, containerWidth, containerHeight);\n };\n if (debounce > 0) {\n callback = throttle(callback, debounce, {\n trailing: true,\n leading: false\n });\n }\n var observer = new ResizeObserver(callback);\n var _containerRef$current = containerRef.current.getBoundingClientRect(),\n containerWidth = _containerRef$current.width,\n containerHeight = _containerRef$current.height;\n setContainerSize(containerWidth, containerHeight);\n observer.observe(containerRef.current);\n return function () {\n observer.disconnect();\n };\n }, [setContainerSize, debounce]);\n var chartContent = useMemo(function () {\n var containerWidth = sizes.containerWidth,\n containerHeight = sizes.containerHeight;\n if (containerWidth < 0 || containerHeight < 0) {\n return null;\n }\n warn(isPercent(width) || isPercent(height), \"The width(%s) and height(%s) are both fixed numbers,\\n maybe you don't need to use a ResponsiveContainer.\", width, height);\n warn(!aspect || aspect > 0, 'The aspect(%s) must be greater than zero.', aspect);\n var calculatedWidth = isPercent(width) ? containerWidth : width;\n var calculatedHeight = isPercent(height) ? containerHeight : height;\n if (aspect && aspect > 0) {\n // Preserve the desired aspect ratio\n if (calculatedWidth) {\n // Will default to using width for aspect ratio\n calculatedHeight = calculatedWidth / aspect;\n } else if (calculatedHeight) {\n // But we should also take height into consideration\n calculatedWidth = calculatedHeight * aspect;\n }\n\n // if maxHeight is set, overwrite if calculatedHeight is greater than maxHeight\n if (maxHeight && calculatedHeight > maxHeight) {\n calculatedHeight = maxHeight;\n }\n }\n warn(calculatedWidth > 0 || calculatedHeight > 0, \"The width(%s) and height(%s) of chart should be greater than 0,\\n please check the style of container, or the props width(%s) and height(%s),\\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\\n height and width.\", calculatedWidth, calculatedHeight, width, height, minWidth, minHeight, aspect);\n var isCharts = !Array.isArray(children) && getDisplayName(children.type).endsWith('Chart');\n return React.Children.map(children, function (child) {\n if ( /*#__PURE__*/React.isValidElement(child)) {\n return /*#__PURE__*/cloneElement(child, _objectSpread({\n width: calculatedWidth,\n height: calculatedHeight\n }, isCharts ? {\n style: _objectSpread({\n height: '100%',\n width: '100%',\n maxHeight: calculatedHeight,\n maxWidth: calculatedWidth\n }, child.props.style)\n } : {}));\n }\n return child;\n });\n }, [aspect, children, height, maxHeight, minHeight, minWidth, sizes, width]);\n return /*#__PURE__*/React.createElement(\"div\", {\n id: id ? \"\".concat(id) : undefined,\n className: clsx('recharts-responsive-container', className),\n style: _objectSpread(_objectSpread({}, style), {}, {\n width: width,\n height: height,\n minWidth: minWidth,\n minHeight: minHeight,\n maxHeight: maxHeight\n }),\n ref: containerRef\n }, chartContent);\n});","/**\n * @fileOverview Cross\n */\n\nexport var Cell = function Cell(_props) {\n return null;\n};\nCell.displayName = 'Cell';","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nimport { Global } from './Global';\nvar stringCache = {\n widthCache: {},\n cacheCount: 0\n};\nvar MAX_CACHE_NUM = 2000;\nvar SPAN_STYLE = {\n position: 'absolute',\n top: '-20000px',\n left: 0,\n padding: 0,\n margin: 0,\n border: 'none',\n whiteSpace: 'pre'\n};\nvar STYLE_LIST = ['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'lineHeight', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom'];\nvar MEASUREMENT_SPAN_ID = 'recharts_measurement_span';\nfunction autoCompleteStyle(name, value) {\n if (STYLE_LIST.indexOf(name) >= 0 && value === +value) {\n return \"\".concat(value, \"px\");\n }\n return value;\n}\nfunction camelToMiddleLine(text) {\n var strs = text.split('');\n var formatStrs = strs.reduce(function (result, entry) {\n if (entry === entry.toUpperCase()) {\n return [].concat(_toConsumableArray(result), ['-', entry.toLowerCase()]);\n }\n return [].concat(_toConsumableArray(result), [entry]);\n }, []);\n return formatStrs.join('');\n}\nexport var getStyleString = function getStyleString(style) {\n return Object.keys(style).reduce(function (result, s) {\n return \"\".concat(result).concat(camelToMiddleLine(s), \":\").concat(autoCompleteStyle(s, style[s]), \";\");\n }, '');\n};\nfunction removeInvalidKeys(obj) {\n var copyObj = _objectSpread({}, obj);\n Object.keys(copyObj).forEach(function (key) {\n if (!copyObj[key]) {\n delete copyObj[key];\n }\n });\n return copyObj;\n}\nexport var getStringSize = function getStringSize(text) {\n var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (text === undefined || text === null || Global.isSsr) {\n return {\n width: 0,\n height: 0\n };\n }\n var copyStyle = removeInvalidKeys(style);\n var cacheKey = JSON.stringify({\n text: text,\n copyStyle: copyStyle\n });\n if (stringCache.widthCache[cacheKey]) {\n return stringCache.widthCache[cacheKey];\n }\n try {\n var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);\n if (!measurementSpan) {\n measurementSpan = document.createElement('span');\n measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);\n measurementSpan.setAttribute('aria-hidden', 'true');\n document.body.appendChild(measurementSpan);\n }\n // Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)\n // https://en.wikipedia.org/wiki/Content_Security_Policy\n var measurementSpanStyle = _objectSpread(_objectSpread({}, SPAN_STYLE), copyStyle);\n Object.assign(measurementSpan.style, measurementSpanStyle);\n measurementSpan.textContent = \"\".concat(text);\n var rect = measurementSpan.getBoundingClientRect();\n var result = {\n width: rect.width,\n height: rect.height\n };\n stringCache.widthCache[cacheKey] = result;\n if (++stringCache.cacheCount > MAX_CACHE_NUM) {\n stringCache.cacheCount = 0;\n stringCache.widthCache = {};\n }\n return result;\n } catch (e) {\n return {\n width: 0,\n height: 0\n };\n }\n};\nexport var getOffset = function getOffset(rect) {\n return {\n top: rect.top + window.scrollY - document.documentElement.clientTop,\n left: rect.left + window.scrollX - document.documentElement.clientLeft\n };\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar MULTIPLY_OR_DIVIDE_REGEX = /(-?\\d+(?:\\.\\d+)?[a-zA-Z%]*)([*/])(-?\\d+(?:\\.\\d+)?[a-zA-Z%]*)/;\nvar ADD_OR_SUBTRACT_REGEX = /(-?\\d+(?:\\.\\d+)?[a-zA-Z%]*)([+-])(-?\\d+(?:\\.\\d+)?[a-zA-Z%]*)/;\nvar CSS_LENGTH_UNIT_REGEX = /^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/;\nvar NUM_SPLIT_REGEX = /(-?\\d+(?:\\.\\d+)?)([a-zA-Z%]+)?/;\nvar CONVERSION_RATES = {\n cm: 96 / 2.54,\n mm: 96 / 25.4,\n pt: 96 / 72,\n pc: 96 / 6,\n \"in\": 96,\n Q: 96 / (2.54 * 40),\n px: 1\n};\nvar FIXED_CSS_LENGTH_UNITS = Object.keys(CONVERSION_RATES);\nvar STR_NAN = 'NaN';\nfunction convertToPx(value, unit) {\n return value * CONVERSION_RATES[unit];\n}\nvar DecimalCSS = /*#__PURE__*/function () {\n function DecimalCSS(num, unit) {\n _classCallCheck(this, DecimalCSS);\n this.num = num;\n this.unit = unit;\n this.num = num;\n this.unit = unit;\n if (Number.isNaN(num)) {\n this.unit = '';\n }\n if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) {\n this.num = NaN;\n this.unit = '';\n }\n if (FIXED_CSS_LENGTH_UNITS.includes(unit)) {\n this.num = convertToPx(num, unit);\n this.unit = 'px';\n }\n }\n return _createClass(DecimalCSS, [{\n key: \"add\",\n value: function add(other) {\n if (this.unit !== other.unit) {\n return new DecimalCSS(NaN, '');\n }\n return new DecimalCSS(this.num + other.num, this.unit);\n }\n }, {\n key: \"subtract\",\n value: function subtract(other) {\n if (this.unit !== other.unit) {\n return new DecimalCSS(NaN, '');\n }\n return new DecimalCSS(this.num - other.num, this.unit);\n }\n }, {\n key: \"multiply\",\n value: function multiply(other) {\n if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {\n return new DecimalCSS(NaN, '');\n }\n return new DecimalCSS(this.num * other.num, this.unit || other.unit);\n }\n }, {\n key: \"divide\",\n value: function divide(other) {\n if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {\n return new DecimalCSS(NaN, '');\n }\n return new DecimalCSS(this.num / other.num, this.unit || other.unit);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.num).concat(this.unit);\n }\n }, {\n key: \"isNaN\",\n value: function isNaN() {\n return Number.isNaN(this.num);\n }\n }], [{\n key: \"parse\",\n value: function parse(str) {\n var _NUM_SPLIT_REGEX$exec;\n var _ref = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [],\n _ref2 = _slicedToArray(_ref, 3),\n numStr = _ref2[1],\n unit = _ref2[2];\n return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : '');\n }\n }]);\n}();\nfunction calculateArithmetic(expr) {\n if (expr.includes(STR_NAN)) {\n return STR_NAN;\n }\n var newExpr = expr;\n while (newExpr.includes('*') || newExpr.includes('/')) {\n var _MULTIPLY_OR_DIVIDE_R;\n var _ref3 = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [],\n _ref4 = _slicedToArray(_ref3, 4),\n leftOperand = _ref4[1],\n operator = _ref4[2],\n rightOperand = _ref4[3];\n var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : '');\n var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : '');\n var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs);\n if (result.isNaN()) {\n return STR_NAN;\n }\n newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString());\n }\n while (newExpr.includes('+') || /.-\\d+(?:\\.\\d+)?/.test(newExpr)) {\n var _ADD_OR_SUBTRACT_REGE;\n var _ref5 = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [],\n _ref6 = _slicedToArray(_ref5, 4),\n _leftOperand = _ref6[1],\n _operator = _ref6[2],\n _rightOperand = _ref6[3];\n var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : '');\n var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : '');\n var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs);\n if (_result.isNaN()) {\n return STR_NAN;\n }\n newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString());\n }\n return newExpr;\n}\nvar PARENTHESES_REGEX = /\\(([^()]*)\\)/;\nfunction calculateParentheses(expr) {\n var newExpr = expr;\n while (newExpr.includes('(')) {\n var _PARENTHESES_REGEX$ex = PARENTHESES_REGEX.exec(newExpr),\n _PARENTHESES_REGEX$ex2 = _slicedToArray(_PARENTHESES_REGEX$ex, 2),\n parentheticalExpression = _PARENTHESES_REGEX$ex2[1];\n newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression));\n }\n return newExpr;\n}\nfunction evaluateExpression(expression) {\n var newExpr = expression.replace(/\\s+/g, '');\n newExpr = calculateParentheses(newExpr);\n newExpr = calculateArithmetic(newExpr);\n return newExpr;\n}\nexport function safeEvaluateExpression(expression) {\n try {\n return evaluateExpression(expression);\n } catch (e) {\n /* istanbul ignore next */\n return STR_NAN;\n }\n}\nexport function reduceCSSCalc(expression) {\n var result = safeEvaluateExpression(expression.slice(5, -1));\n if (result === STR_NAN) {\n // notify the user\n return '';\n }\n return result;\n}","var _excluded = [\"x\", \"y\", \"lineHeight\", \"capHeight\", \"scaleToFit\", \"textAnchor\", \"verticalAnchor\", \"fill\"],\n _excluded2 = [\"dx\", \"dy\", \"angle\", \"className\", \"breakAll\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport React, { useMemo } from 'react';\nimport isNil from 'lodash/isNil';\nimport clsx from 'clsx';\nimport { isNumber, isNumOrStr } from '../util/DataUtils';\nimport { Global } from '../util/Global';\nimport { filterProps } from '../util/ReactUtils';\nimport { getStringSize } from '../util/DOMUtils';\nimport { reduceCSSCalc } from '../util/ReduceCSSCalc';\nvar BREAKING_SPACES = /[ \\f\\n\\r\\t\\v\\u2028\\u2029]+/;\nvar calculateWordWidths = function calculateWordWidths(_ref) {\n var children = _ref.children,\n breakAll = _ref.breakAll,\n style = _ref.style;\n try {\n var words = [];\n if (!isNil(children)) {\n if (breakAll) {\n words = children.toString().split('');\n } else {\n words = children.toString().split(BREAKING_SPACES);\n }\n }\n var wordsWithComputedWidth = words.map(function (word) {\n return {\n word: word,\n width: getStringSize(word, style).width\n };\n });\n var spaceWidth = breakAll ? 0 : getStringSize(\"\\xA0\", style).width;\n return {\n wordsWithComputedWidth: wordsWithComputedWidth,\n spaceWidth: spaceWidth\n };\n } catch (e) {\n return null;\n }\n};\nvar calculateWordsByLines = function calculateWordsByLines(_ref2, initialWordsWithComputedWith, spaceWidth, lineWidth, scaleToFit) {\n var maxLines = _ref2.maxLines,\n children = _ref2.children,\n style = _ref2.style,\n breakAll = _ref2.breakAll;\n var shouldLimitLines = isNumber(maxLines);\n var text = children;\n var calculate = function calculate() {\n var words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n return words.reduce(function (result, _ref3) {\n var word = _ref3.word,\n width = _ref3.width;\n var currentLine = result[result.length - 1];\n if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {\n // Word can be added to an existing line\n currentLine.words.push(word);\n currentLine.width += width + spaceWidth;\n } else {\n // Add first word to line or word is too long to scaleToFit on existing line\n var newLine = {\n words: [word],\n width: width\n };\n result.push(newLine);\n }\n return result;\n }, []);\n };\n var originalResult = calculate(initialWordsWithComputedWith);\n var findLongestLine = function findLongestLine(words) {\n return words.reduce(function (a, b) {\n return a.width > b.width ? a : b;\n });\n };\n if (!shouldLimitLines) {\n return originalResult;\n }\n var suffix = '…';\n var checkOverflow = function checkOverflow(index) {\n var tempText = text.slice(0, index);\n var words = calculateWordWidths({\n breakAll: breakAll,\n style: style,\n children: tempText + suffix\n }).wordsWithComputedWidth;\n var result = calculate(words);\n var doesOverflow = result.length > maxLines || findLongestLine(result).width > Number(lineWidth);\n return [doesOverflow, result];\n };\n var start = 0;\n var end = text.length - 1;\n var iterations = 0;\n var trimmedResult;\n while (start <= end && iterations <= text.length - 1) {\n var middle = Math.floor((start + end) / 2);\n var prev = middle - 1;\n var _checkOverflow = checkOverflow(prev),\n _checkOverflow2 = _slicedToArray(_checkOverflow, 2),\n doesPrevOverflow = _checkOverflow2[0],\n result = _checkOverflow2[1];\n var _checkOverflow3 = checkOverflow(middle),\n _checkOverflow4 = _slicedToArray(_checkOverflow3, 1),\n doesMiddleOverflow = _checkOverflow4[0];\n if (!doesPrevOverflow && !doesMiddleOverflow) {\n start = middle + 1;\n }\n if (doesPrevOverflow && doesMiddleOverflow) {\n end = middle - 1;\n }\n if (!doesPrevOverflow && doesMiddleOverflow) {\n trimmedResult = result;\n break;\n }\n iterations++;\n }\n\n // Fallback to originalResult (result without trimming) if we cannot find the\n // where to trim. This should not happen :tm:\n return trimmedResult || originalResult;\n};\nvar getWordsWithoutCalculate = function getWordsWithoutCalculate(children) {\n var words = !isNil(children) ? children.toString().split(BREAKING_SPACES) : [];\n return [{\n words: words\n }];\n};\nvar getWordsByLines = function getWordsByLines(_ref4) {\n var width = _ref4.width,\n scaleToFit = _ref4.scaleToFit,\n children = _ref4.children,\n style = _ref4.style,\n breakAll = _ref4.breakAll,\n maxLines = _ref4.maxLines;\n // Only perform calculations if using features that require them (multiline, scaleToFit)\n if ((width || scaleToFit) && !Global.isSsr) {\n var wordsWithComputedWidth, spaceWidth;\n var wordWidths = calculateWordWidths({\n breakAll: breakAll,\n children: children,\n style: style\n });\n if (wordWidths) {\n var wcw = wordWidths.wordsWithComputedWidth,\n sw = wordWidths.spaceWidth;\n wordsWithComputedWidth = wcw;\n spaceWidth = sw;\n } else {\n return getWordsWithoutCalculate(children);\n }\n return calculateWordsByLines({\n breakAll: breakAll,\n children: children,\n maxLines: maxLines,\n style: style\n }, wordsWithComputedWidth, spaceWidth, width, scaleToFit);\n }\n return getWordsWithoutCalculate(children);\n};\nvar DEFAULT_FILL = '#808080';\nexport var Text = function Text(_ref5) {\n var _ref5$x = _ref5.x,\n propsX = _ref5$x === void 0 ? 0 : _ref5$x,\n _ref5$y = _ref5.y,\n propsY = _ref5$y === void 0 ? 0 : _ref5$y,\n _ref5$lineHeight = _ref5.lineHeight,\n lineHeight = _ref5$lineHeight === void 0 ? '1em' : _ref5$lineHeight,\n _ref5$capHeight = _ref5.capHeight,\n capHeight = _ref5$capHeight === void 0 ? '0.71em' : _ref5$capHeight,\n _ref5$scaleToFit = _ref5.scaleToFit,\n scaleToFit = _ref5$scaleToFit === void 0 ? false : _ref5$scaleToFit,\n _ref5$textAnchor = _ref5.textAnchor,\n textAnchor = _ref5$textAnchor === void 0 ? 'start' : _ref5$textAnchor,\n _ref5$verticalAnchor = _ref5.verticalAnchor,\n verticalAnchor = _ref5$verticalAnchor === void 0 ? 'end' : _ref5$verticalAnchor,\n _ref5$fill = _ref5.fill,\n fill = _ref5$fill === void 0 ? DEFAULT_FILL : _ref5$fill,\n props = _objectWithoutProperties(_ref5, _excluded);\n var wordsByLines = useMemo(function () {\n return getWordsByLines({\n breakAll: props.breakAll,\n children: props.children,\n maxLines: props.maxLines,\n scaleToFit: scaleToFit,\n style: props.style,\n width: props.width\n });\n }, [props.breakAll, props.children, props.maxLines, scaleToFit, props.style, props.width]);\n var dx = props.dx,\n dy = props.dy,\n angle = props.angle,\n className = props.className,\n breakAll = props.breakAll,\n textProps = _objectWithoutProperties(props, _excluded2);\n if (!isNumOrStr(propsX) || !isNumOrStr(propsY)) {\n return null;\n }\n var x = propsX + (isNumber(dx) ? dx : 0);\n var y = propsY + (isNumber(dy) ? dy : 0);\n var startDy;\n switch (verticalAnchor) {\n case 'start':\n startDy = reduceCSSCalc(\"calc(\".concat(capHeight, \")\"));\n break;\n case 'middle':\n startDy = reduceCSSCalc(\"calc(\".concat((wordsByLines.length - 1) / 2, \" * -\").concat(lineHeight, \" + (\").concat(capHeight, \" / 2))\"));\n break;\n default:\n startDy = reduceCSSCalc(\"calc(\".concat(wordsByLines.length - 1, \" * -\").concat(lineHeight, \")\"));\n break;\n }\n var transforms = [];\n if (scaleToFit) {\n var lineWidth = wordsByLines[0].width;\n var width = props.width;\n transforms.push(\"scale(\".concat((isNumber(width) ? width / lineWidth : 1) / lineWidth, \")\"));\n }\n if (angle) {\n transforms.push(\"rotate(\".concat(angle, \", \").concat(x, \", \").concat(y, \")\"));\n }\n if (transforms.length) {\n textProps.transform = transforms.join(' ');\n }\n return /*#__PURE__*/React.createElement(\"text\", _extends({}, filterProps(textProps, true), {\n x: x,\n y: y,\n className: clsx('recharts-text', className),\n textAnchor: textAnchor,\n fill: fill.includes('url') ? DEFAULT_FILL : fill\n }), wordsByLines.map(function (line, index) {\n var words = line.words.join(breakAll ? '' : ' ');\n return (\n /*#__PURE__*/\n // duplicate words will cause duplicate keys\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(\"tspan\", {\n x: x,\n dy: index === 0 ? startDy : lineHeight,\n key: \"\".concat(words, \"-\").concat(index)\n }, words)\n );\n }));\n};","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n","import ascending from \"./ascending.js\";\nimport permute from \"./permute.js\";\n\nexport default function sort(values, ...F) {\n if (typeof values[Symbol.iterator] !== \"function\") throw new TypeError(\"values is not iterable\");\n values = Array.from(values);\n let [f] = F;\n if ((f && f.length !== 2) || F.length > 1) {\n const index = Uint32Array.from(values, (d, i) => i);\n if (F.length > 1) {\n F = F.map(f => values.map(f));\n index.sort((i, j) => {\n for (const f of F) {\n const c = ascendingDefined(f[i], f[j]);\n if (c) return c;\n }\n });\n } else {\n f = values.map(f);\n index.sort((i, j) => ascendingDefined(f[i], f[j]));\n }\n return permute(values, index);\n }\n return values.sort(compareDefined(f));\n}\n\nexport function compareDefined(compare = ascending) {\n if (compare === ascending) return ascendingDefined;\n if (typeof compare !== \"function\") throw new TypeError(\"compare is not a function\");\n return (a, b) => {\n const x = compare(a, b);\n if (x || x === 0) return x;\n return (compare(b, b) === 0) - (compare(a, a) === 0);\n };\n}\n\nexport function ascendingDefined(a, b) {\n return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);\n}\n","const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n","import {ascendingDefined, compareDefined} from \"./sort.js\";\n\n// Based on https://github.com/mourner/quickselect\n// ISC license, Copyright 2018 Vladimir Agafonkin.\nexport default function quickselect(array, k, left = 0, right = Infinity, compare) {\n k = Math.floor(k);\n left = Math.floor(Math.max(0, left));\n right = Math.floor(Math.min(array.length - 1, right));\n\n if (!(left <= k && k <= right)) return array;\n\n compare = compare === undefined ? ascendingDefined : compareDefined(compare);\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(array, k, newLeft, newRight, compare);\n }\n\n const t = array[k];\n let i = left;\n let j = right;\n\n swap(array, left, k);\n if (compare(array[right], t) > 0) swap(array, left, right);\n\n while (i < j) {\n swap(array, i, j), ++i, --j;\n while (compare(array[i], t) < 0) ++i;\n while (compare(array[j], t) > 0) --j;\n }\n\n if (compare(array[left], t) === 0) swap(array, left, j);\n else ++j, swap(array, j, right);\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n\n return array;\n}\n\nfunction swap(array, i, j) {\n const t = array[i];\n array[i] = array[j];\n array[j] = t;\n}\n","import max from \"./max.js\";\nimport maxIndex from \"./maxIndex.js\";\nimport min from \"./min.js\";\nimport minIndex from \"./minIndex.js\";\nimport quickselect from \"./quickselect.js\";\nimport number, {numbers} from \"./number.js\";\nimport {ascendingDefined} from \"./sort.js\";\nimport greatest from \"./greatest.js\";\n\nexport default function quantile(values, p, valueof) {\n values = Float64Array.from(numbers(values, valueof));\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return min(values);\n if (p >= 1) return max(values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),\n value1 = min(values.subarray(i0 + 1));\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileSorted(values, p, valueof = number) {\n if (!(n = values.length) || isNaN(p = +p)) return;\n if (p <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n\nexport function quantileIndex(values, p, valueof = number) {\n if (isNaN(p = +p)) return;\n numbers = Float64Array.from(values, (_, i) => number(valueof(values[i], i, values)));\n if (p <= 0) return minIndex(numbers);\n if (p >= 1) return maxIndex(numbers);\n var numbers,\n index = Uint32Array.from(values, (_, i) => i),\n j = numbers.length - 1,\n i = Math.floor(j * p);\n quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));\n i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);\n return i >= 0 ? i : -1;\n}\n","export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n","import {range as sequence} from \"d3-array\";\nimport {initRange} from \"./init.js\";\nimport ordinal from \"./ordinal.js\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n r0 = 0,\n r1 = 1,\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = r1 < r0,\n start = reverse ? r1 : r0,\n stop = reverse ? r0 : r1;\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];\n };\n\n scale.rangeRound = function(_) {\n return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band(domain(), [r0, r1])\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return initRange.apply(rescale(), arguments);\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band.apply(null, arguments).paddingInner(1));\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","import {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nexport default function identity(domain) {\n var unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return identity(domain).unknown(unknown);\n };\n\n domain = arguments.length ? Array.from(domain, number) : [0, 1];\n\n return linearish(scale);\n}\n","export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n","import {ticks} from \"d3-array\";\nimport {format, formatSpecifier} from \"d3-format\";\nimport nice from \"./nice.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformLog(x) {\n return Math.log(x);\n}\n\nfunction transformExp(x) {\n return Math.exp(x);\n}\n\nfunction transformLogn(x) {\n return -Math.log(-x);\n}\n\nfunction transformExpn(x) {\n return -Math.exp(-x);\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : x => Math.pow(base, x);\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), x => Math.log(x) / base);\n}\n\nfunction reflect(f) {\n return (x, k) => -f(-x, k);\n}\n\nexport function loggish(transform) {\n const scale = transform(transformLog, transformExp);\n const domain = scale.domain;\n let base = 10;\n let logs;\n let pows;\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) {\n logs = reflect(logs), pows = reflect(pows);\n transform(transformLogn, transformExpn);\n } else {\n transform(transformLog, transformExp);\n }\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = count => {\n const d = domain();\n let u = d[0];\n let v = d[d.length - 1];\n const r = v < u;\n\n if (r) ([u, v] = [v, u]);\n\n let i = logs(u);\n let j = logs(v);\n let k;\n let t;\n const n = count == null ? 10 : +count;\n let z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.floor(i), j = Math.ceil(j);\n if (u > 0) for (; i <= j; ++i) {\n for (k = 1; k < base; ++k) {\n t = i < 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i <= j; ++i) {\n for (k = base - 1; k >= 1; --k) {\n t = i > 0 ? k / pows(-i) : k * pows(i);\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n if (z.length * 2 < n) z = ticks(u, v, n);\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = (count, specifier) => {\n if (count == null) count = 10;\n if (specifier == null) specifier = base === 10 ? \"s\" : \",\";\n if (typeof specifier !== \"function\") {\n if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;\n specifier = format(specifier);\n }\n if (count === Infinity) return specifier;\n const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return d => {\n let i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = () => {\n return domain(nice(domain(), {\n floor: x => pows(Math.floor(logs(x))),\n ceil: x => pows(Math.ceil(logs(x)))\n }));\n };\n\n return scale;\n}\n\nexport default function log() {\n const scale = loggish(transformer()).domain([1, 10]);\n scale.copy = () => copy(scale, log()).base(scale.base());\n initRange.apply(scale, arguments);\n return scale;\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformSymlog(c) {\n return function(x) {\n return Math.sign(x) * Math.log1p(Math.abs(x / c));\n };\n}\n\nfunction transformSymexp(c) {\n return function(x) {\n return Math.sign(x) * Math.expm1(Math.abs(x)) * c;\n };\n}\n\nexport function symlogish(transform) {\n var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));\n\n scale.constant = function(_) {\n return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;\n };\n\n return linearish(scale);\n}\n\nexport default function symlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, symlog()).constant(scale.constant());\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {linearish} from \"./linear.js\";\nimport {copy, identity, transformer} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\n\nfunction transformPow(exponent) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n };\n}\n\nfunction transformSqrt(x) {\n return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);\n}\n\nfunction transformSquare(x) {\n return x < 0 ? -x * x : x * x;\n}\n\nexport function powish(transform) {\n var scale = transform(identity, identity),\n exponent = 1;\n\n function rescale() {\n return exponent === 1 ? transform(identity, identity)\n : exponent === 0.5 ? transform(transformSqrt, transformSquare)\n : transform(transformPow(exponent), transformPow(1 / exponent));\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, rescale()) : exponent;\n };\n\n return linearish(scale);\n}\n\nexport default function pow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, pow()).exponent(scale.exponent());\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n\nexport function sqrt() {\n return pow.apply(null, arguments).exponent(0.5);\n}\n","import continuous from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport number from \"./number.js\";\n\nfunction square(x) {\n return Math.sign(x) * x * x;\n}\n\nfunction unsquare(x) {\n return Math.sign(x) * Math.sqrt(Math.abs(x));\n}\n\nexport default function radial() {\n var squared = continuous(),\n range = [0, 1],\n round = false,\n unknown;\n\n function scale(x) {\n var y = unsquare(squared(x));\n return isNaN(y) ? unknown : round ? Math.round(y) : y;\n }\n\n scale.invert = function(y) {\n return squared.invert(square(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (squared.domain(_), scale) : squared.domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? (squared.range((range = Array.from(_, number)).map(square)), scale) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return scale.range(_).round(true);\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, scale) : round;\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (squared.clamp(_), scale) : squared.clamp();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return radial(squared.domain(), range)\n .round(round)\n .clamp(squared.clamp())\n .unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","import {ascending, bisect, quantileSorted as threshold} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [],\n unknown;\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {linearish} from \"./linear.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function quantize() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1],\n unknown;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : scale;\n };\n\n scale.thresholds = function() {\n return domain.slice();\n };\n\n scale.copy = function() {\n return quantize()\n .domain([x0, x1])\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(linearish(scale), arguments);\n}\n","import {bisect} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n unknown,\n n = 1;\n\n function scale(x) {\n return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return initRange.apply(scale, arguments);\n}\n","const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n","import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n","export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n","import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n","import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n","import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n","import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n","import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n","import {interpolate, interpolateRound} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 1,\n t0,\n t1,\n k10,\n transform,\n interpolator = identity,\n clamp = false,\n unknown;\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1;\n return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);\n return scale;\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .interpolator(source.interpolator())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport default function sequential() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, sequential());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialLog() {\n var scale = loggish(transformer()).domain([1, 10]);\n\n scale.copy = function() {\n return copy(scale, sequentialLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, sequentialPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function sequentialSqrt() {\n return sequentialPow.apply(null, arguments).exponent(0.5);\n}\n","import {ascending, bisect, quantile} from \"d3-array\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\n\nexport default function sequentialQuantile() {\n var domain = [],\n interpolator = identity;\n\n function scale(x) {\n if (x != null && !isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1));\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return scale;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n scale.range = function() {\n return domain.map((d, i) => interpolator(i / (domain.length - 1)));\n };\n\n scale.quantiles = function(n) {\n return Array.from({length: n + 1}, (_, i) => quantile(domain, i / n));\n };\n\n scale.copy = function() {\n return sequentialQuantile(interpolator).domain(domain);\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n","import {interpolate, interpolateRound, piecewise} from \"d3-interpolate\";\nimport {identity} from \"./continuous.js\";\nimport {initInterpolator} from \"./init.js\";\nimport {linearish} from \"./linear.js\";\nimport {loggish} from \"./log.js\";\nimport {copy} from \"./sequential.js\";\nimport {symlogish} from \"./symlog.js\";\nimport {powish} from \"./pow.js\";\n\nfunction transformer() {\n var x0 = 0,\n x1 = 0.5,\n x2 = 1,\n s = 1,\n t0,\n t1,\n t2,\n k10,\n k21,\n interpolator = identity,\n transform,\n clamp = false,\n unknown;\n\n function scale(x) {\n return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));\n }\n\n scale.domain = function(_) {\n return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n function range(interpolate) {\n return function(_) {\n var r0, r1, r2;\n return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];\n };\n }\n\n scale.range = range(interpolate);\n\n scale.rangeRound = range(interpolateRound);\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t) {\n transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;\n return scale;\n };\n}\n\nexport default function diverging() {\n var scale = linearish(transformer()(identity));\n\n scale.copy = function() {\n return copy(scale, diverging());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingLog() {\n var scale = loggish(transformer()).domain([0.1, 1, 10]);\n\n scale.copy = function() {\n return copy(scale, divergingLog()).base(scale.base());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSymlog() {\n var scale = symlogish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingSymlog()).constant(scale.constant());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingPow() {\n var scale = powish(transformer());\n\n scale.copy = function() {\n return copy(scale, divergingPow()).exponent(scale.exponent());\n };\n\n return initInterpolator.apply(scale, arguments);\n}\n\nexport function divergingSqrt() {\n return divergingPow.apply(null, arguments).exponent(0.5);\n}\n","var isSymbol = require('./isSymbol');\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseExtremum;\n","/**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\nfunction baseGt(value, other) {\n return value > other;\n}\n\nmodule.exports = baseGt;\n","var baseExtremum = require('./_baseExtremum'),\n baseGt = require('./_baseGt'),\n identity = require('./identity');\n\n/**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\nfunction max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n}\n\nmodule.exports = max;\n","/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nmodule.exports = baseLt;\n","var baseExtremum = require('./_baseExtremum'),\n baseLt = require('./_baseLt'),\n identity = require('./identity');\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nmodule.exports = min;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n isArray = require('./isArray');\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nmodule.exports = map;\n","var baseFlatten = require('./_baseFlatten'),\n map = require('./map');\n\n/**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\nfunction flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n}\n\nmodule.exports = flatMap;\n","var baseIsEqual = require('./_baseIsEqual');\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nmodule.exports = isEqual;\n","/*\r\n * decimal.js-light v2.5.1\r\n * An arbitrary-precision Decimal type for JavaScript.\r\n * https://github.com/MikeMcl/decimal.js-light\r\n * Copyright (c) 2020 Michael Mclaughlin \r\n * MIT Expat Licence\r\n */\r\n\r\n\r\n// ------------------------------------ EDITABLE DEFAULTS ------------------------------------- //\r\n\r\n\r\n// The limit on the value of `precision`, and on the value of the first argument to\r\n// `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.\r\nvar MAX_DIGITS = 1e9, // 0 to 1e9\r\n\r\n\r\n // The initial configuration properties of the Decimal constructor.\r\n defaults = {\r\n\r\n // These values must be integers within the stated ranges (inclusive).\r\n // Most of these values can be changed during run-time using `Decimal.config`.\r\n\r\n // The maximum number of significant digits of the result of a calculation or base conversion.\r\n // E.g. `Decimal.config({ precision: 20 });`\r\n precision: 20, // 1 to MAX_DIGITS\r\n\r\n // The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`,\r\n // `toFixed`, `toPrecision` and `toSignificantDigits`.\r\n //\r\n // ROUND_UP 0 Away from zero.\r\n // ROUND_DOWN 1 Towards zero.\r\n // ROUND_CEIL 2 Towards +Infinity.\r\n // ROUND_FLOOR 3 Towards -Infinity.\r\n // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n //\r\n // E.g.\r\n // `Decimal.rounding = 4;`\r\n // `Decimal.rounding = Decimal.ROUND_HALF_UP;`\r\n rounding: 4, // 0 to 8\r\n\r\n // The exponent value at and beneath which `toString` returns exponential notation.\r\n // JavaScript numbers: -7\r\n toExpNeg: -7, // 0 to -MAX_E\r\n\r\n // The exponent value at and above which `toString` returns exponential notation.\r\n // JavaScript numbers: 21\r\n toExpPos: 21, // 0 to MAX_E\r\n\r\n // The natural logarithm of 10.\r\n // 115 digits\r\n LN10: '2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286'\r\n },\r\n\r\n\r\n// ------------------------------------ END OF EDITABLE DEFAULTS -------------------------------- //\r\n\r\n\r\n Decimal,\r\n external = true,\r\n\r\n decimalError = '[DecimalError] ',\r\n invalidArgument = decimalError + 'Invalid argument: ',\r\n exponentOutOfRange = decimalError + 'Exponent out of range: ',\r\n\r\n mathfloor = Math.floor,\r\n mathpow = Math.pow,\r\n\r\n isDecimal = /^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n\r\n ONE,\r\n BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n MAX_E = mathfloor(MAX_SAFE_INTEGER / LOG_BASE), // 1286742750677284\r\n\r\n // Decimal.prototype object\r\n P = {};\r\n\r\n\r\n// Decimal prototype methods\r\n\r\n\r\n/*\r\n * absoluteValue abs\r\n * comparedTo cmp\r\n * decimalPlaces dp\r\n * dividedBy div\r\n * dividedToIntegerBy idiv\r\n * equals eq\r\n * exponent\r\n * greaterThan gt\r\n * greaterThanOrEqualTo gte\r\n * isInteger isint\r\n * isNegative isneg\r\n * isPositive ispos\r\n * isZero\r\n * lessThan lt\r\n * lessThanOrEqualTo lte\r\n * logarithm log\r\n * minus sub\r\n * modulo mod\r\n * naturalExponential exp\r\n * naturalLogarithm ln\r\n * negated neg\r\n * plus add\r\n * precision sd\r\n * squareRoot sqrt\r\n * times mul\r\n * toDecimalPlaces todp\r\n * toExponential\r\n * toFixed\r\n * toInteger toint\r\n * toNumber\r\n * toPower pow\r\n * toPrecision\r\n * toSignificantDigits tosd\r\n * toString\r\n * valueOf val\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of this Decimal.\r\n *\r\n */\r\nP.absoluteValue = P.abs = function () {\r\n var x = new this.constructor(this);\r\n if (x.s) x.s = 1;\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if the value of this Decimal is greater than the value of `y`,\r\n * -1 if the value of this Decimal is less than the value of `y`,\r\n * 0 if they have the same value\r\n *\r\n */\r\nP.comparedTo = P.cmp = function (y) {\r\n var i, j, xdL, ydL,\r\n x = this;\r\n\r\n y = new x.constructor(y);\r\n\r\n // Signs differ?\r\n if (x.s !== y.s) return x.s || -y.s;\r\n\r\n // Compare exponents.\r\n if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1;\r\n\r\n xdL = x.d.length;\r\n ydL = y.d.length;\r\n\r\n // Compare digit by digit.\r\n for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {\r\n if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1;\r\n }\r\n\r\n // Compare lengths.\r\n return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1;\r\n};\r\n\r\n\r\n/*\r\n * Return the number of decimal places of the value of this Decimal.\r\n *\r\n */\r\nP.decimalPlaces = P.dp = function () {\r\n var x = this,\r\n w = x.d.length - 1,\r\n dp = (w - x.e) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n w = x.d[w];\r\n if (w) for (; w % 10 == 0; w /= 10) dp--;\r\n\r\n return dp < 0 ? 0 : dp;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal divided by `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.dividedBy = P.div = function (y) {\r\n return divide(this, new this.constructor(y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the integer part of dividing the value of this Decimal\r\n * by the value of `y`, truncated to `precision` significant digits.\r\n *\r\n */\r\nP.dividedToIntegerBy = P.idiv = function (y) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return round(divide(x, new Ctor(y), 0, 1), Ctor.precision);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.\r\n *\r\n */\r\nP.equals = P.eq = function (y) {\r\n return !this.cmp(y);\r\n};\r\n\r\n\r\n/*\r\n * Return the (base 10) exponent value of this Decimal (this.e is the base 10000000 exponent).\r\n *\r\n */\r\nP.exponent = function () {\r\n return getBase10Exponent(this);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than the value of `y`, otherwise return\r\n * false.\r\n *\r\n */\r\nP.greaterThan = P.gt = function (y) {\r\n return this.cmp(y) > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than or equal to the value of `y`,\r\n * otherwise return false.\r\n *\r\n */\r\nP.greaterThanOrEqualTo = P.gte = function (y) {\r\n return this.cmp(y) >= 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is an integer, otherwise return false.\r\n *\r\n */\r\nP.isInteger = P.isint = function () {\r\n return this.e > this.d.length - 2;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is negative, otherwise return false.\r\n *\r\n */\r\nP.isNegative = P.isneg = function () {\r\n return this.s < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is positive, otherwise return false.\r\n *\r\n */\r\nP.isPositive = P.ispos = function () {\r\n return this.s > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is 0, otherwise return false.\r\n *\r\n */\r\nP.isZero = function () {\r\n return this.s === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThan = P.lt = function (y) {\r\n return this.cmp(y) < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThanOrEqualTo = P.lte = function (y) {\r\n return this.cmp(y) < 1;\r\n};\r\n\r\n\r\n/*\r\n * Return the logarithm of the value of this Decimal to the specified base, truncated to\r\n * `precision` significant digits.\r\n *\r\n * If no base is specified, return log[10](x).\r\n *\r\n * log[base](x) = ln(x) / ln(base)\r\n *\r\n * The maximum error of the result is 1 ulp (unit in the last place).\r\n *\r\n * [base] {number|string|Decimal} The base of the logarithm.\r\n *\r\n */\r\nP.logarithm = P.log = function (base) {\r\n var r,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision,\r\n wpr = pr + 5;\r\n\r\n // Default base is 10.\r\n if (base === void 0) {\r\n base = new Ctor(10);\r\n } else {\r\n base = new Ctor(base);\r\n\r\n // log[-b](x) = NaN\r\n // log[0](x) = NaN\r\n // log[1](x) = NaN\r\n if (base.s < 1 || base.eq(ONE)) throw Error(decimalError + 'NaN');\r\n }\r\n\r\n // log[b](-x) = NaN\r\n // log[b](0) = -Infinity\r\n if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity'));\r\n\r\n // log[b](1) = 0\r\n if (x.eq(ONE)) return new Ctor(0);\r\n\r\n external = false;\r\n r = divide(ln(x, wpr), ln(base, wpr), wpr);\r\n external = true;\r\n\r\n return round(r, pr);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal minus `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.minus = P.sub = function (y) {\r\n var x = this;\r\n y = new x.constructor(y);\r\n return x.s == y.s ? subtract(x, y) : add(x, (y.s = -y.s, y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal modulo `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.modulo = P.mod = function (y) {\r\n var q,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision;\r\n\r\n y = new Ctor(y);\r\n\r\n // x % 0 = NaN\r\n if (!y.s) throw Error(decimalError + 'NaN');\r\n\r\n // Return x if x is 0.\r\n if (!x.s) return round(new Ctor(x), pr);\r\n\r\n // Prevent rounding of intermediate calculations.\r\n external = false;\r\n q = divide(x, y, 0, 1).times(y);\r\n external = true;\r\n\r\n return x.minus(q);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of the value of this Decimal,\r\n * i.e. the base e raised to the power the value of this Decimal, truncated to `precision`\r\n * significant digits.\r\n *\r\n */\r\nP.naturalExponential = P.exp = function () {\r\n return exp(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,\r\n * truncated to `precision` significant digits.\r\n *\r\n */\r\nP.naturalLogarithm = P.ln = function () {\r\n return ln(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by\r\n * -1.\r\n *\r\n */\r\nP.negated = P.neg = function () {\r\n var x = new this.constructor(this);\r\n x.s = -x.s || 0;\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal plus `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.plus = P.add = function (y) {\r\n var x = this;\r\n y = new x.constructor(y);\r\n return x.s == y.s ? add(x, y) : subtract(x, (y.s = -y.s, y));\r\n};\r\n\r\n\r\n/*\r\n * Return the number of significant digits of the value of this Decimal.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n *\r\n */\r\nP.precision = P.sd = function (z) {\r\n var e, sd, w,\r\n x = this;\r\n\r\n if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);\r\n\r\n e = getBase10Exponent(x) + 1;\r\n w = x.d.length - 1;\r\n sd = w * LOG_BASE + 1;\r\n w = x.d[w];\r\n\r\n // If non-zero...\r\n if (w) {\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n for (; w % 10 == 0; w /= 10) sd--;\r\n\r\n // Add the number of digits of the first word.\r\n for (w = x.d[0]; w >= 10; w /= 10) sd++;\r\n }\r\n\r\n return z && e > sd ? e : sd;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of this Decimal, truncated to `precision`\r\n * significant digits.\r\n *\r\n */\r\nP.squareRoot = P.sqrt = function () {\r\n var e, n, pr, r, s, t, wpr,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n // Negative or zero?\r\n if (x.s < 1) {\r\n if (!x.s) return new Ctor(0);\r\n\r\n // sqrt(-x) = NaN\r\n throw Error(decimalError + 'NaN');\r\n }\r\n\r\n e = getBase10Exponent(x);\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = digitsToString(x.d);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n pr = Ctor.precision;\r\n s = wpr = pr + 3;\r\n\r\n // Newton-Raphson iteration.\r\n for (;;) {\r\n t = r;\r\n r = t.plus(divide(x, t, wpr + 2)).times(0.5);\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === (n = digitsToString(r.d)).slice(0, wpr)) {\r\n n = n.slice(wpr - 3, wpr + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or\r\n // 4999, i.e. approaching a rounding boundary, continue the iteration.\r\n if (s == wpr && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n round(t, pr + 1, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n } else if (n != '9999') {\r\n break;\r\n }\r\n\r\n wpr += 4;\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return round(r, pr);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal times `y`, truncated to\r\n * `precision` significant digits.\r\n *\r\n */\r\nP.times = P.mul = function (y) {\r\n var carry, e, i, k, r, rL, t, xdL, ydL,\r\n x = this,\r\n Ctor = x.constructor,\r\n xd = x.d,\r\n yd = (y = new Ctor(y)).d;\r\n\r\n // Return 0 if either is 0.\r\n if (!x.s || !y.s) return new Ctor(0);\r\n\r\n y.s *= x.s;\r\n e = x.e + y.e;\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Ensure xd points to the longer array.\r\n if (xdL < ydL) {\r\n r = xd;\r\n xd = yd;\r\n yd = r;\r\n rL = xdL;\r\n xdL = ydL;\r\n ydL = rL;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n r = [];\r\n rL = xdL + ydL;\r\n for (i = rL; i--;) r.push(0);\r\n\r\n // Multiply!\r\n for (i = ydL; --i >= 0;) {\r\n carry = 0;\r\n for (k = xdL + i; k > i;) {\r\n t = r[k] + yd[i] * xd[k - i - 1] + carry;\r\n r[k--] = t % BASE | 0;\r\n carry = t / BASE | 0;\r\n }\r\n\r\n r[k] = (r[k] + carry) % BASE | 0;\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; !r[--rL];) r.pop();\r\n\r\n if (carry) ++e;\r\n else r.shift();\r\n\r\n y.d = r;\r\n y.e = e;\r\n\r\n return external ? round(y, Ctor.precision) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`\r\n * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.\r\n *\r\n * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toDecimalPlaces = P.todp = function (dp, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n if (dp === void 0) return x;\r\n\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n return round(x, dp + getBase10Exponent(x) + 1, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in exponential notation rounded to\r\n * `dp` fixed decimal places using rounding mode `rounding`.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toExponential = function (dp, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = toString(x, true);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = round(new Ctor(x), dp + 1, rm);\r\n str = toString(x, true, dp + 1);\r\n }\r\n\r\n return str;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in normal (fixed-point) notation to\r\n * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is\r\n * omitted.\r\n *\r\n * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.\r\n * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.\r\n * (-0).toFixed(3) is '0.000'.\r\n * (-0.5).toFixed(0) is '-0'.\r\n *\r\n */\r\nP.toFixed = function (dp, rm) {\r\n var str, y,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) return toString(x);\r\n\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n y = round(new Ctor(x), dp + getBase10Exponent(x) + 1, rm);\r\n str = toString(y.abs(), false, dp + getBase10Exponent(y) + 1);\r\n\r\n // To determine whether to add the minus sign look at the value before it was rounded,\r\n // i.e. look at `x` rather than `y`.\r\n return x.isneg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using\r\n * rounding mode `rounding`.\r\n *\r\n */\r\nP.toInteger = P.toint = function () {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return round(new Ctor(x), getBase10Exponent(x) + 1, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return the value of this Decimal converted to a number primitive.\r\n *\r\n */\r\nP.toNumber = function () {\r\n return +this;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal raised to the power `y`,\r\n * truncated to `precision` significant digits.\r\n *\r\n * For non-integer or very large exponents pow(x, y) is calculated using\r\n *\r\n * x^y = exp(y*ln(x))\r\n *\r\n * The maximum error is 1 ulp (unit in last place).\r\n *\r\n * y {number|string|Decimal} The power to which to raise this Decimal.\r\n *\r\n */\r\nP.toPower = P.pow = function (y) {\r\n var e, k, pr, r, sign, yIsInt,\r\n x = this,\r\n Ctor = x.constructor,\r\n guard = 12,\r\n yn = +(y = new Ctor(y));\r\n\r\n // pow(x, 0) = 1\r\n if (!y.s) return new Ctor(ONE);\r\n\r\n x = new Ctor(x);\r\n\r\n // pow(0, y > 0) = 0\r\n // pow(0, y < 0) = Infinity\r\n if (!x.s) {\r\n if (y.s < 1) throw Error(decimalError + 'Infinity');\r\n return x;\r\n }\r\n\r\n // pow(1, y) = 1\r\n if (x.eq(ONE)) return x;\r\n\r\n pr = Ctor.precision;\r\n\r\n // pow(x, 1) = x\r\n if (y.eq(ONE)) return round(x, pr);\r\n\r\n e = y.e;\r\n k = y.d.length - 1;\r\n yIsInt = e >= k;\r\n sign = x.s;\r\n\r\n if (!yIsInt) {\r\n\r\n // pow(x < 0, y non-integer) = NaN\r\n if (sign < 0) throw Error(decimalError + 'NaN');\r\n\r\n // If y is a small integer use the 'exponentiation by squaring' algorithm.\r\n } else if ((k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {\r\n r = new Ctor(ONE);\r\n\r\n // Max k of 9007199254740991 takes 53 loop iterations.\r\n // Maximum digits array length; leaves [28, 34] guard digits.\r\n e = Math.ceil(pr / LOG_BASE + 4);\r\n\r\n external = false;\r\n\r\n for (;;) {\r\n if (k % 2) {\r\n r = r.times(x);\r\n truncate(r.d, e);\r\n }\r\n\r\n k = mathfloor(k / 2);\r\n if (k === 0) break;\r\n\r\n x = x.times(x);\r\n truncate(x.d, e);\r\n }\r\n\r\n external = true;\r\n\r\n return y.s < 0 ? new Ctor(ONE).div(r) : round(r, pr);\r\n }\r\n\r\n // Result is negative if x is negative and the last digit of integer y is odd.\r\n sign = sign < 0 && y.d[Math.max(e, k)] & 1 ? -1 : 1;\r\n\r\n x.s = 1;\r\n external = false;\r\n r = y.times(ln(x, pr + guard));\r\n external = true;\r\n r = exp(r);\r\n r.s = sign;\r\n\r\n return r;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal rounded to `sd` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * Return exponential notation if `sd` is less than the number of digits necessary to represent\r\n * the integer part of the value in normal notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toPrecision = function (sd, rm) {\r\n var e, str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n e = getBase10Exponent(x);\r\n str = toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos);\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = round(new Ctor(x), sd, rm);\r\n e = getBase10Exponent(x);\r\n str = toString(x, sd <= e || e <= Ctor.toExpNeg, sd);\r\n }\r\n\r\n return str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`\r\n * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if\r\n * omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toSignificantDigits = P.tosd = function (sd, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n }\r\n\r\n return round(new Ctor(x), sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n *\r\n * Return exponential notation if this Decimal has a positive exponent equal to or greater than\r\n * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.\r\n *\r\n */\r\nP.toString = P.valueOf = P.val = P.toJSON = P[Symbol.for('nodejs.util.inspect.custom')] = function () {\r\n var x = this,\r\n e = getBase10Exponent(x),\r\n Ctor = x.constructor;\r\n\r\n return toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos);\r\n};\r\n\r\n\r\n// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.\r\n\r\n\r\n/*\r\n * add P.minus, P.plus\r\n * checkInt32 P.todp, P.toExponential, P.toFixed, P.toPrecision, P.tosd\r\n * digitsToString P.log, P.sqrt, P.pow, toString, exp, ln\r\n * divide P.div, P.idiv, P.log, P.mod, P.sqrt, exp, ln\r\n * exp P.exp, P.pow\r\n * getBase10Exponent P.exponent, P.sd, P.toint, P.sqrt, P.todp, P.toFixed, P.toPrecision,\r\n * P.toString, divide, round, toString, exp, ln\r\n * getLn10 P.log, ln\r\n * getZeroString digitsToString, toString\r\n * ln P.log, P.ln, P.pow, exp\r\n * parseDecimal Decimal\r\n * round P.abs, P.idiv, P.log, P.minus, P.mod, P.neg, P.plus, P.toint, P.sqrt,\r\n * P.times, P.todp, P.toExponential, P.toFixed, P.pow, P.toPrecision, P.tosd,\r\n * divide, getLn10, exp, ln\r\n * subtract P.minus, P.plus\r\n * toString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf\r\n * truncate P.pow\r\n *\r\n * Throws: P.log, P.mod, P.sd, P.sqrt, P.pow, checkInt32, divide, round,\r\n * getLn10, exp, ln, parseDecimal, Decimal, config\r\n */\r\n\r\n\r\nfunction add(x, y) {\r\n var carry, d, e, i, k, len, xd, yd,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision;\r\n\r\n // If either is zero...\r\n if (!x.s || !y.s) {\r\n\r\n // Return x if y is zero.\r\n // Return y if y is non-zero.\r\n if (!y.s) y = new Ctor(x);\r\n return external ? round(y, pr) : y;\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n k = x.e;\r\n e = y.e;\r\n xd = xd.slice();\r\n i = k - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (i) {\r\n if (i < 0) {\r\n d = xd;\r\n i = -i;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = k;\r\n len = xd.length;\r\n }\r\n\r\n // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.\r\n k = Math.ceil(pr / LOG_BASE);\r\n len = k > len ? k + 1 : len + 1;\r\n\r\n if (i > len) {\r\n i = len;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.\r\n d.reverse();\r\n for (; i--;) d.push(0);\r\n d.reverse();\r\n }\r\n\r\n len = xd.length;\r\n i = yd.length;\r\n\r\n // If yd is longer than xd, swap xd and yd so xd points to the longer array.\r\n if (len - i < 0) {\r\n i = len;\r\n d = yd;\r\n yd = xd;\r\n xd = d;\r\n }\r\n\r\n // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.\r\n for (carry = 0; i;) {\r\n carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;\r\n xd[i] %= BASE;\r\n }\r\n\r\n if (carry) {\r\n xd.unshift(carry);\r\n ++e;\r\n }\r\n\r\n // Remove trailing zeros.\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n for (len = xd.length; xd[--len] == 0;) xd.pop();\r\n\r\n y.d = xd;\r\n y.e = e;\r\n\r\n return external ? round(y, pr) : y;\r\n}\r\n\r\n\r\nfunction checkInt32(i, min, max) {\r\n if (i !== ~~i || i < min || i > max) {\r\n throw Error(invalidArgument + i);\r\n }\r\n}\r\n\r\n\r\nfunction digitsToString(d) {\r\n var i, k, ws,\r\n indexOfLastWord = d.length - 1,\r\n str = '',\r\n w = d[0];\r\n\r\n if (indexOfLastWord > 0) {\r\n str += w;\r\n for (i = 1; i < indexOfLastWord; i++) {\r\n ws = d[i] + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n str += ws;\r\n }\r\n\r\n w = d[i];\r\n ws = w + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n } else if (w === 0) {\r\n return '0';\r\n }\r\n\r\n // Remove trailing zeros of last w.\r\n for (; w % 10 === 0;) w /= 10;\r\n\r\n return str + w;\r\n}\r\n\r\n\r\nvar divide = (function () {\r\n\r\n // Assumes non-zero x and k, and hence non-zero result.\r\n function multiplyInteger(x, k) {\r\n var temp,\r\n carry = 0,\r\n i = x.length;\r\n\r\n for (x = x.slice(); i--;) {\r\n temp = x[i] * k + carry;\r\n x[i] = temp % BASE | 0;\r\n carry = temp / BASE | 0;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, r;\r\n\r\n if (aL != bL) {\r\n r = aL > bL ? 1 : -1;\r\n } else {\r\n for (i = r = 0; i < aL; i++) {\r\n if (a[i] != b[i]) {\r\n r = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return r;\r\n }\r\n\r\n function subtract(a, b, aL) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * BASE + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1;) a.shift();\r\n }\r\n\r\n return function (x, y, pr, dp) {\r\n var cmp, e, i, k, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz,\r\n Ctor = x.constructor,\r\n sign = x.s == y.s ? 1 : -1,\r\n xd = x.d,\r\n yd = y.d;\r\n\r\n // Either 0?\r\n if (!x.s) return new Ctor(x);\r\n if (!y.s) throw Error(decimalError + 'Division by zero');\r\n\r\n e = x.e - y.e;\r\n yL = yd.length;\r\n xL = xd.length;\r\n q = new Ctor(sign);\r\n qd = q.d = [];\r\n\r\n // Result exponent may be one less than e.\r\n for (i = 0; yd[i] == (xd[i] || 0); ) ++i;\r\n if (yd[i] > (xd[i] || 0)) --e;\r\n\r\n if (pr == null) {\r\n sd = pr = Ctor.precision;\r\n } else if (dp) {\r\n sd = pr + (getBase10Exponent(x) - getBase10Exponent(y)) + 1;\r\n } else {\r\n sd = pr;\r\n }\r\n\r\n if (sd < 0) return new Ctor(0);\r\n\r\n // Convert precision in number of base 10 digits to base 1e7 digits.\r\n sd = sd / LOG_BASE + 2 | 0;\r\n i = 0;\r\n\r\n // divisor < 1e7\r\n if (yL == 1) {\r\n k = 0;\r\n yd = yd[0];\r\n sd++;\r\n\r\n // k is the carry.\r\n for (; (i < xL || k) && sd--; i++) {\r\n t = k * BASE + (xd[i] || 0);\r\n qd[i] = t / yd | 0;\r\n k = t % yd | 0;\r\n }\r\n\r\n // divisor >= 1e7\r\n } else {\r\n\r\n // Normalise xd and yd so highest order digit of yd is >= BASE/2\r\n k = BASE / (yd[0] + 1) | 0;\r\n\r\n if (k > 1) {\r\n yd = multiplyInteger(yd, k);\r\n xd = multiplyInteger(xd, k);\r\n yL = yd.length;\r\n xL = xd.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xd.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL;) rem[remL++] = 0;\r\n\r\n yz = yd.slice();\r\n yz.unshift(0);\r\n yd0 = yd[0];\r\n\r\n if (yd[1] >= BASE / 2) ++yd0;\r\n\r\n do {\r\n k = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, k.\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * BASE + (rem[1] || 0);\r\n\r\n // k will be how many times the divisor goes into the current remainder.\r\n k = rem0 / yd0 | 0;\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (k)\r\n // 2. if product > remainder: product -= divisor, k--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, k++\r\n\r\n if (k > 1) {\r\n if (k >= BASE) k = BASE - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiplyInteger(yd, k);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n cmp = compare(prod, rem, prodL, remL);\r\n\r\n // product > remainder.\r\n if (cmp == 1) {\r\n k--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yd, prodL);\r\n }\r\n } else {\r\n\r\n // cmp is -1.\r\n // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1\r\n // to avoid it. If k is 1 there is a need to compare yd and rem again below.\r\n if (k == 0) cmp = k = 1;\r\n prod = yd.slice();\r\n }\r\n\r\n prodL = prod.length;\r\n if (prodL < remL) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL);\r\n\r\n // If product was < previous remainder.\r\n if (cmp == -1) {\r\n remL = rem.length;\r\n\r\n // Compare divisor and new remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n if (cmp < 1) {\r\n k++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yd, remL);\r\n }\r\n }\r\n\r\n remL = rem.length;\r\n } else if (cmp === 0) {\r\n k++;\r\n rem = [0];\r\n } // if cmp === 1, k will be 0\r\n\r\n // Add the next digit, k, to the result array.\r\n qd[i++] = k;\r\n\r\n // Update the remainder.\r\n if (cmp && rem[0]) {\r\n rem[remL++] = xd[xi] || 0;\r\n } else {\r\n rem = [xd[xi]];\r\n remL = 1;\r\n }\r\n\r\n } while ((xi++ < xL || rem[0] !== void 0) && sd--);\r\n }\r\n\r\n // Leading zero?\r\n if (!qd[0]) qd.shift();\r\n\r\n q.e = e;\r\n\r\n return round(q, dp ? pr + getBase10Exponent(q) + 1 : pr);\r\n };\r\n})();\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x` truncated to `sd`\r\n * significant digits.\r\n *\r\n * Taylor/Maclaurin series.\r\n *\r\n * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...\r\n *\r\n * Argument reduction:\r\n * Repeat x = x / 32, k += 5, until |x| < 0.1\r\n * exp(x) = exp(x / 2^k)^(2^k)\r\n *\r\n * Previously, the argument was initially reduced by\r\n * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)\r\n * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was\r\n * found to be slower than just dividing repeatedly by 32 as above.\r\n *\r\n * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)\r\n *\r\n * exp(x) is non-terminating for any finite, non-zero x.\r\n *\r\n */\r\nfunction exp(x, sd) {\r\n var denominator, guard, pow, sum, t, wpr,\r\n i = 0,\r\n k = 0,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision;\r\n\r\n if (getBase10Exponent(x) > 16) throw Error(exponentOutOfRange + getBase10Exponent(x));\r\n\r\n // exp(0) = 1\r\n if (!x.s) return new Ctor(ONE);\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n t = new Ctor(0.03125);\r\n\r\n while (x.abs().gte(0.1)) {\r\n x = x.times(t); // x = x / 2^5\r\n k += 5;\r\n }\r\n\r\n // Estimate the precision increase necessary to ensure the first 4 rounding digits are correct.\r\n guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;\r\n wpr += guard;\r\n denominator = pow = sum = new Ctor(ONE);\r\n Ctor.precision = wpr;\r\n\r\n for (;;) {\r\n pow = round(pow.times(x), wpr);\r\n denominator = denominator.times(++i);\r\n t = sum.plus(divide(pow, denominator, wpr));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n while (k--) sum = round(sum.times(sum), wpr);\r\n Ctor.precision = pr;\r\n return sd == null ? (external = true, round(sum, pr)) : sum;\r\n }\r\n\r\n sum = t;\r\n }\r\n}\r\n\r\n\r\n// Calculate the base 10 exponent from the base 1e7 exponent.\r\nfunction getBase10Exponent(x) {\r\n var e = x.e * LOG_BASE,\r\n w = x.d[0];\r\n\r\n // Add the number of digits of the first word of the digits array.\r\n for (; w >= 10; w /= 10) e++;\r\n return e;\r\n}\r\n\r\n\r\nfunction getLn10(Ctor, sd, pr) {\r\n\r\n if (sd > Ctor.LN10.sd()) {\r\n\r\n\r\n // Reset global state in case the exception is caught.\r\n external = true;\r\n if (pr) Ctor.precision = pr;\r\n throw Error(decimalError + 'LN10 precision limit exceeded');\r\n }\r\n\r\n return round(new Ctor(Ctor.LN10), sd);\r\n}\r\n\r\n\r\nfunction getZeroString(k) {\r\n var zs = '';\r\n for (; k--;) zs += '0';\r\n return zs;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x` truncated to `sd` significant\r\n * digits.\r\n *\r\n * ln(n) is non-terminating (n != 1)\r\n *\r\n */\r\nfunction ln(y, sd) {\r\n var c, c0, denominator, e, numerator, sum, t, wpr, x2,\r\n n = 1,\r\n guard = 10,\r\n x = y,\r\n xd = x.d,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision;\r\n\r\n // ln(-x) = NaN\r\n // ln(0) = -Infinity\r\n if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity'));\r\n\r\n // ln(1) = 0\r\n if (x.eq(ONE)) return new Ctor(0);\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n if (x.eq(10)) {\r\n if (sd == null) external = true;\r\n return getLn10(Ctor, wpr);\r\n }\r\n\r\n wpr += guard;\r\n Ctor.precision = wpr;\r\n c = digitsToString(xd);\r\n c0 = c.charAt(0);\r\n e = getBase10Exponent(x);\r\n\r\n if (Math.abs(e) < 1.5e15) {\r\n\r\n // Argument reduction.\r\n // The series converges faster the closer the argument is to 1, so using\r\n // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b\r\n // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,\r\n // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can\r\n // later be divided by this number, then separate out the power of 10 using\r\n // ln(a*10^b) = ln(a) + b*ln(10).\r\n\r\n // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).\r\n //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {\r\n // max n is 6 (gives 0.7 - 1.3)\r\n while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {\r\n x = x.times(y);\r\n c = digitsToString(x.d);\r\n c0 = c.charAt(0);\r\n n++;\r\n }\r\n\r\n e = getBase10Exponent(x);\r\n\r\n if (c0 > 1) {\r\n x = new Ctor('0.' + c);\r\n e++;\r\n } else {\r\n x = new Ctor(c0 + '.' + c.slice(1));\r\n }\r\n } else {\r\n\r\n // The argument reduction method above may result in overflow if the argument y is a massive\r\n // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this\r\n // function using ln(x*10^e) = ln(x) + e*ln(10).\r\n t = getLn10(Ctor, wpr + 2, pr).times(e + '');\r\n x = ln(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);\r\n\r\n Ctor.precision = pr;\r\n return sd == null ? (external = true, round(x, pr)) : x;\r\n }\r\n\r\n // x is reduced to a value near 1.\r\n\r\n // Taylor series.\r\n // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)\r\n // where x = (y - 1)/(y + 1) (|x| < 1)\r\n sum = numerator = x = divide(x.minus(ONE), x.plus(ONE), wpr);\r\n x2 = round(x.times(x), wpr);\r\n denominator = 3;\r\n\r\n for (;;) {\r\n numerator = round(numerator.times(x2), wpr);\r\n t = sum.plus(divide(numerator, new Ctor(denominator), wpr));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n sum = sum.times(2);\r\n\r\n // Reverse the argument reduction.\r\n if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));\r\n sum = divide(sum, new Ctor(n), wpr);\r\n\r\n Ctor.precision = pr;\r\n return sd == null ? (external = true, round(sum, pr)) : sum;\r\n }\r\n\r\n sum = t;\r\n denominator += 2;\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from string `str`.\r\n */\r\nfunction parseDecimal(x, str) {\r\n var e, i, len;\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48;) ++i;\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(len - 1) === 48;) --len;\r\n str = str.slice(i, len);\r\n\r\n if (str) {\r\n len -= i;\r\n e = e - i - 1;\r\n x.e = mathfloor(e / LOG_BASE);\r\n x.d = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first word of the digits array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.d.push(+str.slice(0, i));\r\n for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--;) str += '0';\r\n x.d.push(+str);\r\n\r\n if (external && (x.e > MAX_E || x.e < -MAX_E)) throw Error(exponentOutOfRange + e);\r\n } else {\r\n\r\n // Zero.\r\n x.s = 0;\r\n x.e = 0;\r\n x.d = [0];\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Round `x` to `sd` significant digits, using rounding mode `rm` if present (truncate otherwise).\r\n */\r\n function round(x, sd, rm) {\r\n var i, j, k, n, rd, doRound, w, xdi,\r\n xd = x.d;\r\n\r\n // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // w: the word of xd which contains the rounding digit, a base 1e7 number.\r\n // xdi: the index of w within xd.\r\n // n: the number of digits of w.\r\n // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if\r\n // they had leading zeros)\r\n // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).\r\n\r\n // Get the length of the first word of the digits array xd.\r\n for (n = 1, k = xd[0]; k >= 10; k /= 10) n++;\r\n i = sd - n;\r\n\r\n // Is the rounding digit in the first word of xd?\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n w = xd[xdi = 0];\r\n } else {\r\n xdi = Math.ceil((i + 1) / LOG_BASE);\r\n k = xd.length;\r\n if (xdi >= k) return x;\r\n w = k = xd[xdi];\r\n\r\n // Get the number of digits of w.\r\n for (n = 1; k >= 10; k /= 10) n++;\r\n\r\n // Get the index of rd within w.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within w, adjusted for leading zeros.\r\n // The number of leading zeros of w is given by LOG_BASE - n.\r\n j = i - LOG_BASE + n;\r\n }\r\n\r\n if (rm !== void 0) {\r\n k = mathpow(10, n - j - 1);\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = w / k % 10 | 0;\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n doRound = sd < 0 || xd[xdi + 1] !== void 0 || w % k;\r\n\r\n // The expression `w % mathpow(10, n - j - 1)` returns all the digits of w to the right of the\r\n // digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression will give\r\n // 714.\r\n\r\n doRound = rm < 4\r\n ? (rd || doRound) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || doRound || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? w / mathpow(10, n - j) : 0 : xd[xdi - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n }\r\n\r\n if (sd < 1 || !xd[0]) {\r\n if (doRound) {\r\n k = getBase10Exponent(x);\r\n xd.length = 1;\r\n\r\n // Convert sd to decimal places.\r\n sd = sd - k - 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);\r\n x.e = mathfloor(-sd / LOG_BASE) || 0;\r\n } else {\r\n xd.length = 1;\r\n\r\n // Zero.\r\n xd[0] = x.e = x.s = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xd.length = xdi;\r\n k = 1;\r\n xdi--;\r\n } else {\r\n xd.length = xdi + 1;\r\n k = mathpow(10, LOG_BASE - i);\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of w.\r\n xd[xdi] = j > 0 ? (w / mathpow(10, n - j) % mathpow(10, j) | 0) * k : 0;\r\n }\r\n\r\n if (doRound) {\r\n for (;;) {\r\n\r\n // Is the digit to be rounded up in the first word of xd?\r\n if (xdi == 0) {\r\n if ((xd[0] += k) == BASE) {\r\n xd[0] = 1;\r\n ++x.e;\r\n }\r\n\r\n break;\r\n } else {\r\n xd[xdi] += k;\r\n if (xd[xdi] != BASE) break;\r\n xd[xdi--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xd.length; xd[--i] === 0;) xd.pop();\r\n\r\n if (external && (x.e > MAX_E || x.e < -MAX_E)) {\r\n throw Error(exponentOutOfRange + getBase10Exponent(x));\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\nfunction subtract(x, y) {\r\n var d, e, i, j, k, len, xd, xe, xLTy, yd,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision;\r\n\r\n // Return y negated if x is zero.\r\n // Return x if y is zero and x is non-zero.\r\n if (!x.s || !y.s) {\r\n if (y.s) y.s = -y.s;\r\n else y = new Ctor(x);\r\n return external ? round(y, pr) : y;\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n\r\n // x and y are non-zero numbers with the same sign.\r\n\r\n e = y.e;\r\n xe = x.e;\r\n xd = xd.slice();\r\n k = xe - e;\r\n\r\n // If exponents differ...\r\n if (k) {\r\n xLTy = k < 0;\r\n\r\n if (xLTy) {\r\n d = xd;\r\n k = -k;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = xe;\r\n len = xd.length;\r\n }\r\n\r\n // Numbers with massively different exponents would result in a very high number of zeros\r\n // needing to be prepended, but this can be avoided while still ensuring correct rounding by\r\n // limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.\r\n i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;\r\n\r\n if (k > i) {\r\n k = i;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents.\r\n d.reverse();\r\n for (i = k; i--;) d.push(0);\r\n d.reverse();\r\n\r\n // Base 1e7 exponents equal.\r\n } else {\r\n\r\n // Check digits to determine which is the bigger number.\r\n\r\n i = xd.length;\r\n len = yd.length;\r\n xLTy = i < len;\r\n if (xLTy) len = i;\r\n\r\n for (i = 0; i < len; i++) {\r\n if (xd[i] != yd[i]) {\r\n xLTy = xd[i] < yd[i];\r\n break;\r\n }\r\n }\r\n\r\n k = 0;\r\n }\r\n\r\n if (xLTy) {\r\n d = xd;\r\n xd = yd;\r\n yd = d;\r\n y.s = -y.s;\r\n }\r\n\r\n len = xd.length;\r\n\r\n // Append zeros to xd if shorter.\r\n // Don't add zeros to yd if shorter as subtraction only needs to start at yd length.\r\n for (i = yd.length - len; i > 0; --i) xd[len++] = 0;\r\n\r\n // Subtract yd from xd.\r\n for (i = yd.length; i > k;) {\r\n if (xd[--i] < yd[i]) {\r\n for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;\r\n --xd[j];\r\n xd[i] += BASE;\r\n }\r\n\r\n xd[i] -= yd[i];\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] === 0;) xd.pop();\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xd[0] === 0; xd.shift()) --e;\r\n\r\n // Zero?\r\n if (!xd[0]) return new Ctor(0);\r\n\r\n y.d = xd;\r\n y.e = e;\r\n\r\n //return external && xd.length >= pr / LOG_BASE ? round(y, pr) : y;\r\n return external ? round(y, pr) : y;\r\n}\r\n\r\n\r\nfunction toString(x, isExp, sd) {\r\n var k,\r\n e = getBase10Exponent(x),\r\n str = digitsToString(x.d),\r\n len = str.length;\r\n\r\n if (isExp) {\r\n if (sd && (k = sd - len) > 0) {\r\n str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);\r\n } else if (len > 1) {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n\r\n str = str + (e < 0 ? 'e' : 'e+') + e;\r\n } else if (e < 0) {\r\n str = '0.' + getZeroString(-e - 1) + str;\r\n if (sd && (k = sd - len) > 0) str += getZeroString(k);\r\n } else if (e >= len) {\r\n str += getZeroString(e + 1 - len);\r\n if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);\r\n } else {\r\n if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);\r\n if (sd && (k = sd - len) > 0) {\r\n if (e + 1 === len) str += '.';\r\n str += getZeroString(k);\r\n }\r\n }\r\n\r\n return x.s < 0 ? '-' + str : str;\r\n}\r\n\r\n\r\n// Does not strip trailing zeros.\r\nfunction truncate(arr, len) {\r\n if (arr.length > len) {\r\n arr.length = len;\r\n return true;\r\n }\r\n}\r\n\r\n\r\n// Decimal methods\r\n\r\n\r\n/*\r\n * clone\r\n * config/set\r\n */\r\n\r\n\r\n/*\r\n * Create and return a Decimal constructor with the same configuration properties as this Decimal\r\n * constructor.\r\n *\r\n */\r\nfunction clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * value {number|string|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(value) {\r\n var x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(value);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n // Duplicate.\r\n if (value instanceof Decimal) {\r\n x.s = value.s;\r\n x.e = value.e;\r\n x.d = (value = value.d) ? value.slice() : value;\r\n return;\r\n }\r\n\r\n if (typeof value === 'number') {\r\n\r\n // Reject Infinity/NaN.\r\n if (value * 0 !== 0) {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n if (value > 0) {\r\n x.s = 1;\r\n } else if (value < 0) {\r\n value = -value;\r\n x.s = -1;\r\n } else {\r\n x.s = 0;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (value === ~~value && value < 1e7) {\r\n x.e = 0;\r\n x.d = [value];\r\n return;\r\n }\r\n\r\n return parseDecimal(x, value.toString());\r\n } else if (typeof value !== 'string') {\r\n throw Error(invalidArgument + value);\r\n }\r\n\r\n // Minus sign?\r\n if (value.charCodeAt(0) === 45) {\r\n value = value.slice(1);\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n if (isDecimal.test(value)) parseDecimal(x, value);\r\n else throw Error(invalidArgument + value);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n\r\n Decimal.clone = clone;\r\n Decimal.config = Decimal.set = config;\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n}\r\n\r\n\r\n/*\r\n * Configure global settings for a Decimal constructor.\r\n *\r\n * `obj` is an object with one or more of the following properties,\r\n *\r\n * precision {number}\r\n * rounding {number}\r\n * toExpNeg {number}\r\n * toExpPos {number}\r\n *\r\n * E.g. Decimal.config({ precision: 20, rounding: 4 })\r\n *\r\n */\r\nfunction config(obj) {\r\n if (!obj || typeof obj !== 'object') {\r\n throw Error(decimalError + 'Object expected');\r\n }\r\n var i, p, v,\r\n ps = [\r\n 'precision', 1, MAX_DIGITS,\r\n 'rounding', 0, 8,\r\n 'toExpNeg', -1 / 0, 0,\r\n 'toExpPos', 0, 1 / 0\r\n ];\r\n\r\n for (i = 0; i < ps.length; i += 3) {\r\n if ((v = obj[p = ps[i]]) !== void 0) {\r\n if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;\r\n else throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n if ((v = obj[p = 'LN10']) !== void 0) {\r\n if (v == Math.LN10) this[p] = new this(v);\r\n else throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n\r\n return this;\r\n}\r\n\r\n\r\n// Create and configure initial Decimal constructor.\r\nexport var Decimal = clone(defaults);\r\n\r\n// Internal constant.\r\nONE = new Decimal(1);\r\n\r\nexport default Decimal;\r\n","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nvar identity = function identity(i) {\n return i;\n};\n\nexport var PLACE_HOLDER = {\n '@@functional/placeholder': true\n};\n\nvar isPlaceHolder = function isPlaceHolder(val) {\n return val === PLACE_HOLDER;\n};\n\nvar curry0 = function curry0(fn) {\n return function _curried() {\n if (arguments.length === 0 || arguments.length === 1 && isPlaceHolder(arguments.length <= 0 ? undefined : arguments[0])) {\n return _curried;\n }\n\n return fn.apply(void 0, arguments);\n };\n};\n\nvar curryN = function curryN(n, fn) {\n if (n === 1) {\n return fn;\n }\n\n return curry0(function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var argsLength = args.filter(function (arg) {\n return arg !== PLACE_HOLDER;\n }).length;\n\n if (argsLength >= n) {\n return fn.apply(void 0, args);\n }\n\n return curryN(n - argsLength, curry0(function () {\n for (var _len2 = arguments.length, restArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n restArgs[_key2] = arguments[_key2];\n }\n\n var newArgs = args.map(function (arg) {\n return isPlaceHolder(arg) ? restArgs.shift() : arg;\n });\n return fn.apply(void 0, _toConsumableArray(newArgs).concat(restArgs));\n }));\n });\n};\n\nexport var curry = function curry(fn) {\n return curryN(fn.length, fn);\n};\nexport var range = function range(begin, end) {\n var arr = [];\n\n for (var i = begin; i < end; ++i) {\n arr[i - begin] = i;\n }\n\n return arr;\n};\nexport var map = curry(function (fn, arr) {\n if (Array.isArray(arr)) {\n return arr.map(fn);\n }\n\n return Object.keys(arr).map(function (key) {\n return arr[key];\n }).map(fn);\n});\nexport var compose = function compose() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n if (!args.length) {\n return identity;\n }\n\n var fns = args.reverse(); // first function can receive multiply arguments\n\n var firstFn = fns[0];\n var tailsFn = fns.slice(1);\n return function () {\n return tailsFn.reduce(function (res, fn) {\n return fn(res);\n }, firstFn.apply(void 0, arguments));\n };\n};\nexport var reverse = function reverse(arr) {\n if (Array.isArray(arr)) {\n return arr.reverse();\n } // can be string\n\n\n return arr.split('').reverse.join('');\n};\nexport var memoize = function memoize(fn) {\n var lastArgs = null;\n var lastResult = null;\n return function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n if (lastArgs && args.every(function (val, i) {\n return val === lastArgs[i];\n })) {\n return lastResult;\n }\n\n lastArgs = args;\n lastResult = fn.apply(void 0, args);\n return lastResult;\n };\n};","/**\n * @fileOverview 一些公用的运算方法\n * @author xile611\n * @date 2015-09-17\n */\nimport Decimal from 'decimal.js-light';\nimport { curry } from './utils';\n/**\n * 获取数值的位数\n * 其中绝对值属于区间[0.1, 1), 得到的值为0\n * 绝对值属于区间[0.01, 0.1),得到的位数为 -1\n * 绝对值属于区间[0.001, 0.01),得到的位数为 -2\n *\n * @param {Number} value 数值\n * @return {Integer} 位数\n */\n\nfunction getDigitCount(value) {\n var result;\n\n if (value === 0) {\n result = 1;\n } else {\n result = Math.floor(new Decimal(value).abs().log(10).toNumber()) + 1;\n }\n\n return result;\n}\n/**\n * 按照固定的步长获取[start, end)这个区间的数据\n * 并且需要处理js计算精度的问题\n *\n * @param {Decimal} start 起点\n * @param {Decimal} end 终点,不包含该值\n * @param {Decimal} step 步长\n * @return {Array} 若干数值\n */\n\n\nfunction rangeStep(start, end, step) {\n var num = new Decimal(start);\n var i = 0;\n var result = []; // magic number to prevent infinite loop\n\n while (num.lt(end) && i < 100000) {\n result.push(num.toNumber());\n num = num.add(step);\n i++;\n }\n\n return result;\n}\n/**\n * 对数值进行线性插值\n *\n * @param {Number} a 定义域的极点\n * @param {Number} b 定义域的极点\n * @param {Number} t [0, 1]内的某个值\n * @return {Number} 定义域内的某个值\n */\n\n\nvar interpolateNumber = curry(function (a, b, t) {\n var newA = +a;\n var newB = +b;\n return newA + t * (newB - newA);\n});\n/**\n * 线性插值的逆运算\n *\n * @param {Number} a 定义域的极点\n * @param {Number} b 定义域的极点\n * @param {Number} x 可以认为是插值后的一个输出值\n * @return {Number} 当x在 a ~ b这个范围内时,返回值属于[0, 1]\n */\n\nvar uninterpolateNumber = curry(function (a, b, x) {\n var diff = b - +a;\n diff = diff || Infinity;\n return (x - a) / diff;\n});\n/**\n * 线性插值的逆运算,并且有截断的操作\n *\n * @param {Number} a 定义域的极点\n * @param {Number} b 定义域的极点\n * @param {Number} x 可以认为是插值后的一个输出值\n * @return {Number} 当x在 a ~ b这个区间内时,返回值属于[0, 1],\n * 当x不在 a ~ b这个区间时,会截断到 a ~ b 这个区间\n */\n\nvar uninterpolateTruncation = curry(function (a, b, x) {\n var diff = b - +a;\n diff = diff || Infinity;\n return Math.max(0, Math.min(1, (x - a) / diff));\n});\nexport default {\n rangeStep: rangeStep,\n getDigitCount: getDigitCount,\n interpolateNumber: interpolateNumber,\n uninterpolateNumber: uninterpolateNumber,\n uninterpolateTruncation: uninterpolateTruncation\n};","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n/**\n * @fileOverview calculate tick values of scale\n * @author xile611, arcthur\n * @date 2015-09-17\n */\nimport Decimal from 'decimal.js-light';\nimport { compose, range, memoize, map, reverse } from './util/utils';\nimport Arithmetic from './util/arithmetic';\n/**\n * Calculate a interval of a minimum value and a maximum value\n *\n * @param {Number} min The minimum value\n * @param {Number} max The maximum value\n * @return {Array} An interval\n */\n\nfunction getValidInterval(_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n min = _ref2[0],\n max = _ref2[1];\n\n var validMin = min,\n validMax = max; // exchange\n\n if (min > max) {\n validMin = max;\n validMax = min;\n }\n\n return [validMin, validMax];\n}\n/**\n * Calculate the step which is easy to understand between ticks, like 10, 20, 25\n *\n * @param {Decimal} roughStep The rough step calculated by deviding the\n * difference by the tickCount\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @param {Integer} correctionFactor A correction factor\n * @return {Decimal} The step which is easy to understand between two ticks\n */\n\n\nfunction getFormatStep(roughStep, allowDecimals, correctionFactor) {\n if (roughStep.lte(0)) {\n return new Decimal(0);\n }\n\n var digitCount = Arithmetic.getDigitCount(roughStep.toNumber()); // The ratio between the rough step and the smallest number which has a bigger\n // order of magnitudes than the rough step\n\n var digitCountValue = new Decimal(10).pow(digitCount);\n var stepRatio = roughStep.div(digitCountValue); // When an integer and a float multiplied, the accuracy of result may be wrong\n\n var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;\n var amendStepRatio = new Decimal(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);\n var formatStep = amendStepRatio.mul(digitCountValue);\n return allowDecimals ? formatStep : new Decimal(Math.ceil(formatStep));\n}\n/**\n * calculate the ticks when the minimum value equals to the maximum value\n *\n * @param {Number} value The minimum valuue which is also the maximum value\n * @param {Integer} tickCount The count of ticks\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @return {Array} ticks\n */\n\n\nfunction getTickOfSingleValue(value, tickCount, allowDecimals) {\n var step = 1; // calculate the middle value of ticks\n\n var middle = new Decimal(value);\n\n if (!middle.isint() && allowDecimals) {\n var absVal = Math.abs(value);\n\n if (absVal < 1) {\n // The step should be a float number when the difference is smaller than 1\n step = new Decimal(10).pow(Arithmetic.getDigitCount(value) - 1);\n middle = new Decimal(Math.floor(middle.div(step).toNumber())).mul(step);\n } else if (absVal > 1) {\n // Return the maximum integer which is smaller than 'value' when 'value' is greater than 1\n middle = new Decimal(Math.floor(value));\n }\n } else if (value === 0) {\n middle = new Decimal(Math.floor((tickCount - 1) / 2));\n } else if (!allowDecimals) {\n middle = new Decimal(Math.floor(value));\n }\n\n var middleIndex = Math.floor((tickCount - 1) / 2);\n var fn = compose(map(function (n) {\n return middle.add(new Decimal(n - middleIndex).mul(step)).toNumber();\n }), range);\n return fn(0, tickCount);\n}\n/**\n * Calculate the step\n *\n * @param {Number} min The minimum value of an interval\n * @param {Number} max The maximum value of an interval\n * @param {Integer} tickCount The count of ticks\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @param {Number} correctionFactor A correction factor\n * @return {Object} The step, minimum value of ticks, maximum value of ticks\n */\n\n\nfunction calculateStep(min, max, tickCount, allowDecimals) {\n var correctionFactor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n\n // dirty hack (for recharts' test)\n if (!Number.isFinite((max - min) / (tickCount - 1))) {\n return {\n step: new Decimal(0),\n tickMin: new Decimal(0),\n tickMax: new Decimal(0)\n };\n } // The step which is easy to understand between two ticks\n\n\n var step = getFormatStep(new Decimal(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor); // A medial value of ticks\n\n var middle; // When 0 is inside the interval, 0 should be a tick\n\n if (min <= 0 && max >= 0) {\n middle = new Decimal(0);\n } else {\n // calculate the middle value\n middle = new Decimal(min).add(max).div(2); // minus modulo value\n\n middle = middle.sub(new Decimal(middle).mod(step));\n }\n\n var belowCount = Math.ceil(middle.sub(min).div(step).toNumber());\n var upCount = Math.ceil(new Decimal(max).sub(middle).div(step).toNumber());\n var scaleCount = belowCount + upCount + 1;\n\n if (scaleCount > tickCount) {\n // When more ticks need to cover the interval, step should be bigger.\n return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1);\n }\n\n if (scaleCount < tickCount) {\n // When less ticks can cover the interval, we should add some additional ticks\n upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;\n belowCount = max > 0 ? belowCount : belowCount + (tickCount - scaleCount);\n }\n\n return {\n step: step,\n tickMin: middle.sub(new Decimal(belowCount).mul(step)),\n tickMax: middle.add(new Decimal(upCount).mul(step))\n };\n}\n/**\n * Calculate the ticks of an interval, the count of ticks will be guraranteed\n *\n * @param {Number} min, max min: The minimum value, max: The maximum value\n * @param {Integer} tickCount The count of ticks\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @return {Array} ticks\n */\n\n\nfunction getNiceTickValuesFn(_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n min = _ref4[0],\n max = _ref4[1];\n\n var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;\n var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n // More than two ticks should be return\n var count = Math.max(tickCount, 2);\n\n var _getValidInterval = getValidInterval([min, max]),\n _getValidInterval2 = _slicedToArray(_getValidInterval, 2),\n cormin = _getValidInterval2[0],\n cormax = _getValidInterval2[1];\n\n if (cormin === -Infinity || cormax === Infinity) {\n var _values = cormax === Infinity ? [cormin].concat(_toConsumableArray(range(0, tickCount - 1).map(function () {\n return Infinity;\n }))) : [].concat(_toConsumableArray(range(0, tickCount - 1).map(function () {\n return -Infinity;\n })), [cormax]);\n\n return min > max ? reverse(_values) : _values;\n }\n\n if (cormin === cormax) {\n return getTickOfSingleValue(cormin, tickCount, allowDecimals);\n } // Get the step between two ticks\n\n\n var _calculateStep = calculateStep(cormin, cormax, count, allowDecimals),\n step = _calculateStep.step,\n tickMin = _calculateStep.tickMin,\n tickMax = _calculateStep.tickMax;\n\n var values = Arithmetic.rangeStep(tickMin, tickMax.add(new Decimal(0.1).mul(step)), step);\n return min > max ? reverse(values) : values;\n}\n/**\n * Calculate the ticks of an interval, the count of ticks won't be guraranteed\n *\n * @param {Number} min, max min: The minimum value, max: The maximum value\n * @param {Integer} tickCount The count of ticks\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @return {Array} ticks\n */\n\n\nfunction getTickValuesFn(_ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n min = _ref6[0],\n max = _ref6[1];\n\n var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;\n var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n // More than two ticks should be return\n var count = Math.max(tickCount, 2);\n\n var _getValidInterval3 = getValidInterval([min, max]),\n _getValidInterval4 = _slicedToArray(_getValidInterval3, 2),\n cormin = _getValidInterval4[0],\n cormax = _getValidInterval4[1];\n\n if (cormin === -Infinity || cormax === Infinity) {\n return [min, max];\n }\n\n if (cormin === cormax) {\n return getTickOfSingleValue(cormin, tickCount, allowDecimals);\n }\n\n var step = getFormatStep(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);\n var fn = compose(map(function (n) {\n return new Decimal(cormin).add(new Decimal(n).mul(step)).toNumber();\n }), range);\n var values = fn(0, count).filter(function (entry) {\n return entry >= cormin && entry <= cormax;\n });\n return min > max ? reverse(values) : values;\n}\n/**\n * Calculate the ticks of an interval, the count of ticks won't be guraranteed,\n * but the domain will be guaranteed\n *\n * @param {Number} min, max min: The minimum value, max: The maximum value\n * @param {Integer} tickCount The count of ticks\n * @param {Boolean} allowDecimals Allow the ticks to be decimals or not\n * @return {Array} ticks\n */\n\n\nfunction getTickValuesFixedDomainFn(_ref7, tickCount) {\n var _ref8 = _slicedToArray(_ref7, 2),\n min = _ref8[0],\n max = _ref8[1];\n\n var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n // More than two ticks should be return\n var _getValidInterval5 = getValidInterval([min, max]),\n _getValidInterval6 = _slicedToArray(_getValidInterval5, 2),\n cormin = _getValidInterval6[0],\n cormax = _getValidInterval6[1];\n\n if (cormin === -Infinity || cormax === Infinity) {\n return [min, max];\n }\n\n if (cormin === cormax) {\n return [cormin];\n }\n\n var count = Math.max(tickCount, 2);\n var step = getFormatStep(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);\n var values = [].concat(_toConsumableArray(Arithmetic.rangeStep(new Decimal(cormin), new Decimal(cormax).sub(new Decimal(0.99).mul(step)), step)), [cormax]);\n return min > max ? reverse(values) : values;\n}\n\nexport var getNiceTickValues = memoize(getNiceTickValuesFn);\nexport var getTickValues = memoize(getTickValuesFn);\nexport var getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn);","var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\n\nexport { invariant as default };\n","var _excluded = [\"offset\", \"layout\", \"width\", \"dataKey\", \"data\", \"dataPointFormatter\", \"xAxis\", \"yAxis\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Render a group of error bar\n */\nimport React from 'react';\nimport invariant from 'tiny-invariant';\nimport { Layer } from '../container/Layer';\nimport { filterProps } from '../util/ReactUtils';\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var ErrorBar = /*#__PURE__*/function (_React$Component) {\n function ErrorBar() {\n _classCallCheck(this, ErrorBar);\n return _callSuper(this, ErrorBar, arguments);\n }\n _inherits(ErrorBar, _React$Component);\n return _createClass(ErrorBar, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n offset = _this$props.offset,\n layout = _this$props.layout,\n width = _this$props.width,\n dataKey = _this$props.dataKey,\n data = _this$props.data,\n dataPointFormatter = _this$props.dataPointFormatter,\n xAxis = _this$props.xAxis,\n yAxis = _this$props.yAxis,\n others = _objectWithoutProperties(_this$props, _excluded);\n var svgProps = filterProps(others, false);\n !!(this.props.direction === 'x' && xAxis.type !== 'number') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'ErrorBar requires Axis type property to be \"number\".') : invariant(false) : void 0;\n var errorBars = data.map(function (entry) {\n var _dataPointFormatter = dataPointFormatter(entry, dataKey),\n x = _dataPointFormatter.x,\n y = _dataPointFormatter.y,\n value = _dataPointFormatter.value,\n errorVal = _dataPointFormatter.errorVal;\n if (!errorVal) {\n return null;\n }\n var lineCoordinates = [];\n var lowBound, highBound;\n if (Array.isArray(errorVal)) {\n var _errorVal = _slicedToArray(errorVal, 2);\n lowBound = _errorVal[0];\n highBound = _errorVal[1];\n } else {\n lowBound = highBound = errorVal;\n }\n if (layout === 'vertical') {\n // error bar for horizontal charts, the y is fixed, x is a range value\n var scale = xAxis.scale;\n var yMid = y + offset;\n var yMin = yMid + width;\n var yMax = yMid - width;\n var xMin = scale(value - lowBound);\n var xMax = scale(value + highBound);\n\n // the right line of |--|\n lineCoordinates.push({\n x1: xMax,\n y1: yMin,\n x2: xMax,\n y2: yMax\n });\n // the middle line of |--|\n lineCoordinates.push({\n x1: xMin,\n y1: yMid,\n x2: xMax,\n y2: yMid\n });\n // the left line of |--|\n lineCoordinates.push({\n x1: xMin,\n y1: yMin,\n x2: xMin,\n y2: yMax\n });\n } else if (layout === 'horizontal') {\n // error bar for horizontal charts, the x is fixed, y is a range value\n var _scale = yAxis.scale;\n var xMid = x + offset;\n var _xMin = xMid - width;\n var _xMax = xMid + width;\n var _yMin = _scale(value - lowBound);\n var _yMax = _scale(value + highBound);\n\n // the top line\n lineCoordinates.push({\n x1: _xMin,\n y1: _yMax,\n x2: _xMax,\n y2: _yMax\n });\n // the middle line\n lineCoordinates.push({\n x1: xMid,\n y1: _yMin,\n x2: xMid,\n y2: _yMax\n });\n // the bottom line\n lineCoordinates.push({\n x1: _xMin,\n y1: _yMin,\n x2: _xMax,\n y2: _yMin\n });\n }\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-errorBar\",\n key: \"bar-\".concat(lineCoordinates.map(function (c) {\n return \"\".concat(c.x1, \"-\").concat(c.x2, \"-\").concat(c.y1, \"-\").concat(c.y2);\n }))\n }, svgProps), lineCoordinates.map(function (coordinates) {\n return /*#__PURE__*/React.createElement(\"line\", _extends({}, coordinates, {\n key: \"line-\".concat(coordinates.x1, \"-\").concat(coordinates.x2, \"-\").concat(coordinates.y1, \"-\").concat(coordinates.y2)\n }));\n }));\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-errorBars\"\n }, errorBars);\n }\n }]);\n}(React.Component);\n_defineProperty(ErrorBar, \"defaultProps\", {\n stroke: 'black',\n strokeWidth: 1.5,\n width: 5,\n offset: 0,\n layout: 'horizontal'\n});\n_defineProperty(ErrorBar, \"displayName\", 'ErrorBar');","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { Legend } from '../component/Legend';\nimport { getMainColorOfGraphicItem } from './ChartUtils';\nimport { findChildByType } from './ReactUtils';\nexport var getLegendProps = function getLegendProps(_ref) {\n var children = _ref.children,\n formattedGraphicalItems = _ref.formattedGraphicalItems,\n legendWidth = _ref.legendWidth,\n legendContent = _ref.legendContent;\n var legendItem = findChildByType(children, Legend);\n if (!legendItem) {\n return null;\n }\n var legendDefaultProps = Legend.defaultProps;\n var legendProps = legendDefaultProps !== undefined ? _objectSpread(_objectSpread({}, legendDefaultProps), legendItem.props) : {};\n var legendData;\n if (legendItem.props && legendItem.props.payload) {\n legendData = legendItem.props && legendItem.props.payload;\n } else if (legendContent === 'children') {\n legendData = (formattedGraphicalItems || []).reduce(function (result, _ref2) {\n var item = _ref2.item,\n props = _ref2.props;\n var data = props.sectors || props.data || [];\n return result.concat(data.map(function (entry) {\n return {\n type: legendItem.props.iconType || item.props.legendType,\n value: entry.name,\n color: entry.fill,\n payload: entry\n };\n }));\n }, []);\n } else {\n legendData = (formattedGraphicalItems || []).map(function (_ref3) {\n var item = _ref3.item;\n var itemDefaultProps = item.type.defaultProps;\n var itemProps = itemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, itemDefaultProps), item.props) : {};\n var dataKey = itemProps.dataKey,\n name = itemProps.name,\n legendType = itemProps.legendType,\n hide = itemProps.hide;\n return {\n inactive: hide,\n dataKey: dataKey,\n type: legendProps.iconType || legendType || 'square',\n color: getMainColorOfGraphicItem(item),\n value: name || dataKey,\n // @ts-expect-error property strokeDasharray is required in Payload but optional in props\n payload: itemProps\n };\n });\n }\n return _objectSpread(_objectSpread(_objectSpread({}, legendProps), Legend.getWithHeight(legendItem, legendWidth)), {}, {\n payload: legendData,\n item: legendItem\n });\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport * as d3Scales from 'victory-vendor/d3-scale';\nimport { stack as shapeStack, stackOffsetExpand, stackOffsetNone, stackOffsetSilhouette, stackOffsetWiggle, stackOrderNone } from 'victory-vendor/d3-shape';\nimport max from 'lodash/max';\nimport min from 'lodash/min';\nimport isNil from 'lodash/isNil';\nimport isFunction from 'lodash/isFunction';\nimport isString from 'lodash/isString';\nimport get from 'lodash/get';\nimport flatMap from 'lodash/flatMap';\nimport isNan from 'lodash/isNaN';\nimport upperFirst from 'lodash/upperFirst';\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport { getNiceTickValues, getTickValuesFixedDomain } from 'recharts-scale';\nimport { ErrorBar } from '../cartesian/ErrorBar';\nimport { findEntryInArray, getPercentValue, isNumber, isNumOrStr, mathSign, uniqueId } from './DataUtils';\nimport { filterProps, findAllByType, getDisplayName } from './ReactUtils';\n// TODO: Cause of circular dependency. Needs refactor.\n// import { RadiusAxisProps, AngleAxisProps } from '../polar/types';\n\nimport { getLegendProps } from './getLegendProps';\n\n// Exported for backwards compatibility\nexport { getLegendProps };\nexport function getValueByDataKey(obj, dataKey, defaultValue) {\n if (isNil(obj) || isNil(dataKey)) {\n return defaultValue;\n }\n if (isNumOrStr(dataKey)) {\n return get(obj, dataKey, defaultValue);\n }\n if (isFunction(dataKey)) {\n return dataKey(obj);\n }\n return defaultValue;\n}\n/**\n * Get domain of data by key.\n * @param {Array} data The data displayed in the chart\n * @param {String} key The unique key of a group of data\n * @param {String} type The type of axis\n * @param {Boolean} filterNil Whether or not filter nil values\n * @return {Array} Domain of data\n */\nexport function getDomainOfDataByKey(data, key, type, filterNil) {\n var flattenData = flatMap(data, function (entry) {\n return getValueByDataKey(entry, key);\n });\n if (type === 'number') {\n // @ts-expect-error parseFloat type only accepts strings\n var domain = flattenData.filter(function (entry) {\n return isNumber(entry) || parseFloat(entry);\n });\n return domain.length ? [min(domain), max(domain)] : [Infinity, -Infinity];\n }\n var validateData = filterNil ? flattenData.filter(function (entry) {\n return !isNil(entry);\n }) : flattenData;\n\n // Supports x-axis of Date type\n return validateData.map(function (entry) {\n return isNumOrStr(entry) || entry instanceof Date ? entry : '';\n });\n}\nexport var calculateActiveTickIndex = function calculateActiveTickIndex(coordinate) {\n var _ticks$length;\n var ticks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var unsortedTicks = arguments.length > 2 ? arguments[2] : undefined;\n var axis = arguments.length > 3 ? arguments[3] : undefined;\n var index = -1;\n var len = (_ticks$length = ticks === null || ticks === void 0 ? void 0 : ticks.length) !== null && _ticks$length !== void 0 ? _ticks$length : 0;\n\n // if there are 1 or less ticks ticks then the active tick is at index 0\n if (len <= 1) {\n return 0;\n }\n if (axis && axis.axisType === 'angleAxis' && Math.abs(Math.abs(axis.range[1] - axis.range[0]) - 360) <= 1e-6) {\n var range = axis.range;\n // ticks are distributed in a circle\n for (var i = 0; i < len; i++) {\n var before = i > 0 ? unsortedTicks[i - 1].coordinate : unsortedTicks[len - 1].coordinate;\n var cur = unsortedTicks[i].coordinate;\n var after = i >= len - 1 ? unsortedTicks[0].coordinate : unsortedTicks[i + 1].coordinate;\n var sameDirectionCoord = void 0;\n if (mathSign(cur - before) !== mathSign(after - cur)) {\n var diffInterval = [];\n if (mathSign(after - cur) === mathSign(range[1] - range[0])) {\n sameDirectionCoord = after;\n var curInRange = cur + range[1] - range[0];\n diffInterval[0] = Math.min(curInRange, (curInRange + before) / 2);\n diffInterval[1] = Math.max(curInRange, (curInRange + before) / 2);\n } else {\n sameDirectionCoord = before;\n var afterInRange = after + range[1] - range[0];\n diffInterval[0] = Math.min(cur, (afterInRange + cur) / 2);\n diffInterval[1] = Math.max(cur, (afterInRange + cur) / 2);\n }\n var sameInterval = [Math.min(cur, (sameDirectionCoord + cur) / 2), Math.max(cur, (sameDirectionCoord + cur) / 2)];\n if (coordinate > sameInterval[0] && coordinate <= sameInterval[1] || coordinate >= diffInterval[0] && coordinate <= diffInterval[1]) {\n index = unsortedTicks[i].index;\n break;\n }\n } else {\n var minValue = Math.min(before, after);\n var maxValue = Math.max(before, after);\n if (coordinate > (minValue + cur) / 2 && coordinate <= (maxValue + cur) / 2) {\n index = unsortedTicks[i].index;\n break;\n }\n }\n }\n } else {\n // ticks are distributed in a single direction\n for (var _i = 0; _i < len; _i++) {\n if (_i === 0 && coordinate <= (ticks[_i].coordinate + ticks[_i + 1].coordinate) / 2 || _i > 0 && _i < len - 1 && coordinate > (ticks[_i].coordinate + ticks[_i - 1].coordinate) / 2 && coordinate <= (ticks[_i].coordinate + ticks[_i + 1].coordinate) / 2 || _i === len - 1 && coordinate > (ticks[_i].coordinate + ticks[_i - 1].coordinate) / 2) {\n index = ticks[_i].index;\n break;\n }\n }\n }\n return index;\n};\n\n/**\n * Get the main color of each graphic item\n * @param {ReactElement} item A graphic item\n * @return {String} Color\n */\nexport var getMainColorOfGraphicItem = function getMainColorOfGraphicItem(item) {\n var _item$type;\n var _ref = item,\n displayName = _ref.type.displayName; // TODO: check if displayName is valid.\n var defaultedProps = (_item$type = item.type) !== null && _item$type !== void 0 && _item$type.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var stroke = defaultedProps.stroke,\n fill = defaultedProps.fill;\n var result;\n switch (displayName) {\n case 'Line':\n result = stroke;\n break;\n case 'Area':\n case 'Radar':\n result = stroke && stroke !== 'none' ? stroke : fill;\n break;\n default:\n result = fill;\n break;\n }\n return result;\n};\n/**\n * Calculate the size of all groups for stacked bar graph\n * @param {Object} stackGroups The items grouped by axisId and stackId\n * @return {Object} The size of all groups\n */\nexport var getBarSizeList = function getBarSizeList(_ref2) {\n var globalSize = _ref2.barSize,\n totalSize = _ref2.totalSize,\n _ref2$stackGroups = _ref2.stackGroups,\n stackGroups = _ref2$stackGroups === void 0 ? {} : _ref2$stackGroups;\n if (!stackGroups) {\n return {};\n }\n var result = {};\n var numericAxisIds = Object.keys(stackGroups);\n for (var i = 0, len = numericAxisIds.length; i < len; i++) {\n var sgs = stackGroups[numericAxisIds[i]].stackGroups;\n var stackIds = Object.keys(sgs);\n for (var j = 0, sLen = stackIds.length; j < sLen; j++) {\n var _sgs$stackIds$j = sgs[stackIds[j]],\n items = _sgs$stackIds$j.items,\n cateAxisId = _sgs$stackIds$j.cateAxisId;\n var barItems = items.filter(function (item) {\n return getDisplayName(item.type).indexOf('Bar') >= 0;\n });\n if (barItems && barItems.length) {\n var barItemDefaultProps = barItems[0].type.defaultProps;\n var barItemProps = barItemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, barItemDefaultProps), barItems[0].props) : barItems[0].props;\n var selfSize = barItemProps.barSize;\n var cateId = barItemProps[cateAxisId];\n if (!result[cateId]) {\n result[cateId] = [];\n }\n var barSize = isNil(selfSize) ? globalSize : selfSize;\n result[cateId].push({\n item: barItems[0],\n stackList: barItems.slice(1),\n barSize: isNil(barSize) ? undefined : getPercentValue(barSize, totalSize, 0)\n });\n }\n }\n }\n return result;\n};\n/**\n * Calculate the size of each bar and offset between start of band and the bar\n *\n * @param {number} bandSize is the size of area where bars can render\n * @param {number | string} barGap is the gap size, as a percentage of `bandSize`.\n * Can be defined as number or percent string\n * @param {number | string} barCategoryGap is the gap size, as a percentage of `bandSize`.\n * Can be defined as number or percent string\n * @param {Array} sizeList Sizes of all groups\n * @param {number} maxBarSize The maximum size of each bar\n * @return {Array} The size and offset of each bar\n */\nexport var getBarPosition = function getBarPosition(_ref3) {\n var barGap = _ref3.barGap,\n barCategoryGap = _ref3.barCategoryGap,\n bandSize = _ref3.bandSize,\n _ref3$sizeList = _ref3.sizeList,\n sizeList = _ref3$sizeList === void 0 ? [] : _ref3$sizeList,\n maxBarSize = _ref3.maxBarSize;\n var len = sizeList.length;\n if (len < 1) return null;\n var realBarGap = getPercentValue(barGap, bandSize, 0, true);\n var result;\n var initialValue = [];\n\n // whether or not is barSize setted by user\n if (sizeList[0].barSize === +sizeList[0].barSize) {\n var useFull = false;\n var fullBarSize = bandSize / len;\n // @ts-expect-error the type check above does not check for type number explicitly\n var sum = sizeList.reduce(function (res, entry) {\n return res + entry.barSize || 0;\n }, 0);\n sum += (len - 1) * realBarGap;\n if (sum >= bandSize) {\n sum -= (len - 1) * realBarGap;\n realBarGap = 0;\n }\n if (sum >= bandSize && fullBarSize > 0) {\n useFull = true;\n fullBarSize *= 0.9;\n sum = len * fullBarSize;\n }\n var offset = (bandSize - sum) / 2 >> 0;\n var prev = {\n offset: offset - realBarGap,\n size: 0\n };\n result = sizeList.reduce(function (res, entry) {\n var newPosition = {\n item: entry.item,\n position: {\n offset: prev.offset + prev.size + realBarGap,\n // @ts-expect-error the type check above does not check for type number explicitly\n size: useFull ? fullBarSize : entry.barSize\n }\n };\n var newRes = [].concat(_toConsumableArray(res), [newPosition]);\n prev = newRes[newRes.length - 1].position;\n if (entry.stackList && entry.stackList.length) {\n entry.stackList.forEach(function (item) {\n newRes.push({\n item: item,\n position: prev\n });\n });\n }\n return newRes;\n }, initialValue);\n } else {\n var _offset = getPercentValue(barCategoryGap, bandSize, 0, true);\n if (bandSize - 2 * _offset - (len - 1) * realBarGap <= 0) {\n realBarGap = 0;\n }\n var originalSize = (bandSize - 2 * _offset - (len - 1) * realBarGap) / len;\n if (originalSize > 1) {\n originalSize >>= 0;\n }\n var size = maxBarSize === +maxBarSize ? Math.min(originalSize, maxBarSize) : originalSize;\n result = sizeList.reduce(function (res, entry, i) {\n var newRes = [].concat(_toConsumableArray(res), [{\n item: entry.item,\n position: {\n offset: _offset + (originalSize + realBarGap) * i + (originalSize - size) / 2,\n size: size\n }\n }]);\n if (entry.stackList && entry.stackList.length) {\n entry.stackList.forEach(function (item) {\n newRes.push({\n item: item,\n position: newRes[newRes.length - 1].position\n });\n });\n }\n return newRes;\n }, initialValue);\n }\n return result;\n};\nexport var appendOffsetOfLegend = function appendOffsetOfLegend(offset, _unused, props, legendBox) {\n var children = props.children,\n width = props.width,\n margin = props.margin;\n var legendWidth = width - (margin.left || 0) - (margin.right || 0);\n var legendProps = getLegendProps({\n children: children,\n legendWidth: legendWidth\n });\n if (legendProps) {\n var _ref4 = legendBox || {},\n boxWidth = _ref4.width,\n boxHeight = _ref4.height;\n var align = legendProps.align,\n verticalAlign = legendProps.verticalAlign,\n layout = legendProps.layout;\n if ((layout === 'vertical' || layout === 'horizontal' && verticalAlign === 'middle') && align !== 'center' && isNumber(offset[align])) {\n return _objectSpread(_objectSpread({}, offset), {}, _defineProperty({}, align, offset[align] + (boxWidth || 0)));\n }\n if ((layout === 'horizontal' || layout === 'vertical' && align === 'center') && verticalAlign !== 'middle' && isNumber(offset[verticalAlign])) {\n return _objectSpread(_objectSpread({}, offset), {}, _defineProperty({}, verticalAlign, offset[verticalAlign] + (boxHeight || 0)));\n }\n }\n return offset;\n};\nvar isErrorBarRelevantForAxis = function isErrorBarRelevantForAxis(layout, axisType, direction) {\n if (isNil(axisType)) {\n return true;\n }\n if (layout === 'horizontal') {\n return axisType === 'yAxis';\n }\n if (layout === 'vertical') {\n return axisType === 'xAxis';\n }\n if (direction === 'x') {\n return axisType === 'xAxis';\n }\n if (direction === 'y') {\n return axisType === 'yAxis';\n }\n return true;\n};\nexport var getDomainOfErrorBars = function getDomainOfErrorBars(data, item, dataKey, layout, axisType) {\n var children = item.props.children;\n var errorBars = findAllByType(children, ErrorBar).filter(function (errorBarChild) {\n return isErrorBarRelevantForAxis(layout, axisType, errorBarChild.props.direction);\n });\n if (errorBars && errorBars.length) {\n var keys = errorBars.map(function (errorBarChild) {\n return errorBarChild.props.dataKey;\n });\n return data.reduce(function (result, entry) {\n var entryValue = getValueByDataKey(entry, dataKey);\n if (isNil(entryValue)) return result;\n var mainValue = Array.isArray(entryValue) ? [min(entryValue), max(entryValue)] : [entryValue, entryValue];\n var errorDomain = keys.reduce(function (prevErrorArr, k) {\n var errorValue = getValueByDataKey(entry, k, 0);\n var lowerValue = mainValue[0] - Math.abs(Array.isArray(errorValue) ? errorValue[0] : errorValue);\n var upperValue = mainValue[1] + Math.abs(Array.isArray(errorValue) ? errorValue[1] : errorValue);\n return [Math.min(lowerValue, prevErrorArr[0]), Math.max(upperValue, prevErrorArr[1])];\n }, [Infinity, -Infinity]);\n return [Math.min(errorDomain[0], result[0]), Math.max(errorDomain[1], result[1])];\n }, [Infinity, -Infinity]);\n }\n return null;\n};\nexport var parseErrorBarsOfAxis = function parseErrorBarsOfAxis(data, items, dataKey, axisType, layout) {\n var domains = items.map(function (item) {\n return getDomainOfErrorBars(data, item, dataKey, layout, axisType);\n }).filter(function (entry) {\n return !isNil(entry);\n });\n if (domains && domains.length) {\n return domains.reduce(function (result, entry) {\n return [Math.min(result[0], entry[0]), Math.max(result[1], entry[1])];\n }, [Infinity, -Infinity]);\n }\n return null;\n};\n\n/**\n * Get domain of data by the configuration of item element\n * @param {Array} data The data displayed in the chart\n * @param {Array} items The instances of item\n * @param {String} type The type of axis, number - Number Axis, category - Category Axis\n * @param {LayoutType} layout The type of layout\n * @param {Boolean} filterNil Whether or not filter nil values\n * @return {Array} Domain\n */\nexport var getDomainOfItemsWithSameAxis = function getDomainOfItemsWithSameAxis(data, items, type, layout, filterNil) {\n var domains = items.map(function (item) {\n var dataKey = item.props.dataKey;\n if (type === 'number' && dataKey) {\n return getDomainOfErrorBars(data, item, dataKey, layout) || getDomainOfDataByKey(data, dataKey, type, filterNil);\n }\n return getDomainOfDataByKey(data, dataKey, type, filterNil);\n });\n if (type === 'number') {\n // Calculate the domain of number axis\n return domains.reduce(\n // @ts-expect-error if (type === number) means that the domain is numerical type\n // - but this link is missing in the type definition\n function (result, entry) {\n return [Math.min(result[0], entry[0]), Math.max(result[1], entry[1])];\n }, [Infinity, -Infinity]);\n }\n var tag = {};\n // Get the union set of category axis\n return domains.reduce(function (result, entry) {\n for (var i = 0, len = entry.length; i < len; i++) {\n // @ts-expect-error Date cannot index an object\n if (!tag[entry[i]]) {\n // @ts-expect-error Date cannot index an object\n tag[entry[i]] = true;\n\n // @ts-expect-error Date cannot index an object\n result.push(entry[i]);\n }\n }\n return result;\n }, []);\n};\nexport var isCategoricalAxis = function isCategoricalAxis(layout, axisType) {\n return layout === 'horizontal' && axisType === 'xAxis' || layout === 'vertical' && axisType === 'yAxis' || layout === 'centric' && axisType === 'angleAxis' || layout === 'radial' && axisType === 'radiusAxis';\n};\n\n/**\n * Calculate the Coordinates of grid\n * @param {Array} ticks The ticks in axis\n * @param {Number} minValue The minimun value of axis\n * @param {Number} maxValue The maximun value of axis\n * @param {boolean} syncWithTicks Synchronize grid lines with ticks or not\n * @return {Array} Coordinates\n */\nexport var getCoordinatesOfGrid = function getCoordinatesOfGrid(ticks, minValue, maxValue, syncWithTicks) {\n if (syncWithTicks) {\n return ticks.map(function (entry) {\n return entry.coordinate;\n });\n }\n var hasMin, hasMax;\n var values = ticks.map(function (entry) {\n if (entry.coordinate === minValue) {\n hasMin = true;\n }\n if (entry.coordinate === maxValue) {\n hasMax = true;\n }\n return entry.coordinate;\n });\n if (!hasMin) {\n values.push(minValue);\n }\n if (!hasMax) {\n values.push(maxValue);\n }\n return values;\n};\n\n/**\n * Get the ticks of an axis\n * @param {Object} axis The configuration of an axis\n * @param {Boolean} isGrid Whether or not are the ticks in grid\n * @param {Boolean} isAll Return the ticks of all the points or not\n * @return {Array} Ticks\n */\nexport var getTicksOfAxis = function getTicksOfAxis(axis, isGrid, isAll) {\n if (!axis) return null;\n var scale = axis.scale;\n var duplicateDomain = axis.duplicateDomain,\n type = axis.type,\n range = axis.range;\n var offsetForBand = axis.realScaleType === 'scaleBand' ? scale.bandwidth() / 2 : 2;\n var offset = (isGrid || isAll) && type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;\n offset = axis.axisType === 'angleAxis' && (range === null || range === void 0 ? void 0 : range.length) >= 2 ? mathSign(range[0] - range[1]) * 2 * offset : offset;\n\n // The ticks set by user should only affect the ticks adjacent to axis line\n if (isGrid && (axis.ticks || axis.niceTicks)) {\n var result = (axis.ticks || axis.niceTicks).map(function (entry) {\n var scaleContent = duplicateDomain ? duplicateDomain.indexOf(entry) : entry;\n return {\n // If the scaleContent is not a number, the coordinate will be NaN.\n // That could be the case for example with a PointScale and a string as domain.\n coordinate: scale(scaleContent) + offset,\n value: entry,\n offset: offset\n };\n });\n return result.filter(function (row) {\n return !isNan(row.coordinate);\n });\n }\n\n // When axis is a categorial axis, but the type of axis is number or the scale of axis is not \"auto\"\n if (axis.isCategorical && axis.categoricalDomain) {\n return axis.categoricalDomain.map(function (entry, index) {\n return {\n coordinate: scale(entry) + offset,\n value: entry,\n index: index,\n offset: offset\n };\n });\n }\n if (scale.ticks && !isAll) {\n return scale.ticks(axis.tickCount).map(function (entry) {\n return {\n coordinate: scale(entry) + offset,\n value: entry,\n offset: offset\n };\n });\n }\n\n // When axis has duplicated text, serial numbers are used to generate scale\n return scale.domain().map(function (entry, index) {\n return {\n coordinate: scale(entry) + offset,\n value: duplicateDomain ? duplicateDomain[entry] : entry,\n index: index,\n offset: offset\n };\n });\n};\n\n/**\n * combine the handlers\n * @param {Function} defaultHandler Internal private handler\n * @param {Function} childHandler Handler function specified in child component\n * @return {Function} The combined handler\n */\n\nvar handlerWeakMap = new WeakMap();\nexport var combineEventHandlers = function combineEventHandlers(defaultHandler, childHandler) {\n if (typeof childHandler !== 'function') {\n return defaultHandler;\n }\n if (!handlerWeakMap.has(defaultHandler)) {\n handlerWeakMap.set(defaultHandler, new WeakMap());\n }\n var childWeakMap = handlerWeakMap.get(defaultHandler);\n if (childWeakMap.has(childHandler)) {\n return childWeakMap.get(childHandler);\n }\n var combineHandler = function combineHandler() {\n defaultHandler.apply(void 0, arguments);\n childHandler.apply(void 0, arguments);\n };\n childWeakMap.set(childHandler, combineHandler);\n return combineHandler;\n};\n\n/**\n * Parse the scale function of axis\n * @param {Object} axis The option of axis\n * @param {String} chartType The displayName of chart\n * @param {Boolean} hasBar if it has a bar\n * @return {object} The scale function and resolved name\n */\nexport var parseScale = function parseScale(axis, chartType, hasBar) {\n var scale = axis.scale,\n type = axis.type,\n layout = axis.layout,\n axisType = axis.axisType;\n if (scale === 'auto') {\n if (layout === 'radial' && axisType === 'radiusAxis') {\n return {\n scale: d3Scales.scaleBand(),\n realScaleType: 'band'\n };\n }\n if (layout === 'radial' && axisType === 'angleAxis') {\n return {\n scale: d3Scales.scaleLinear(),\n realScaleType: 'linear'\n };\n }\n if (type === 'category' && chartType && (chartType.indexOf('LineChart') >= 0 || chartType.indexOf('AreaChart') >= 0 || chartType.indexOf('ComposedChart') >= 0 && !hasBar)) {\n return {\n scale: d3Scales.scalePoint(),\n realScaleType: 'point'\n };\n }\n if (type === 'category') {\n return {\n scale: d3Scales.scaleBand(),\n realScaleType: 'band'\n };\n }\n return {\n scale: d3Scales.scaleLinear(),\n realScaleType: 'linear'\n };\n }\n if (isString(scale)) {\n var name = \"scale\".concat(upperFirst(scale));\n return {\n scale: (d3Scales[name] || d3Scales.scalePoint)(),\n realScaleType: d3Scales[name] ? name : 'point'\n };\n }\n return isFunction(scale) ? {\n scale: scale\n } : {\n scale: d3Scales.scalePoint(),\n realScaleType: 'point'\n };\n};\nvar EPS = 1e-4;\nexport var checkDomainOfScale = function checkDomainOfScale(scale) {\n var domain = scale.domain();\n if (!domain || domain.length <= 2) {\n return;\n }\n var len = domain.length;\n var range = scale.range();\n var minValue = Math.min(range[0], range[1]) - EPS;\n var maxValue = Math.max(range[0], range[1]) + EPS;\n var first = scale(domain[0]);\n var last = scale(domain[len - 1]);\n if (first < minValue || first > maxValue || last < minValue || last > maxValue) {\n scale.domain([domain[0], domain[len - 1]]);\n }\n};\nexport var findPositionOfBar = function findPositionOfBar(barPosition, child) {\n if (!barPosition) {\n return null;\n }\n for (var i = 0, len = barPosition.length; i < len; i++) {\n if (barPosition[i].item === child) {\n return barPosition[i].position;\n }\n }\n return null;\n};\n\n/**\n * Both value and domain are tuples of two numbers\n * - but the type stays as array of numbers until we have better support in rest of the app\n * @param {Array} value input that will be truncated\n * @param {Array} domain boundaries\n * @returns {Array} tuple of two numbers\n */\nexport var truncateByDomain = function truncateByDomain(value, domain) {\n if (!domain || domain.length !== 2 || !isNumber(domain[0]) || !isNumber(domain[1])) {\n return value;\n }\n var minValue = Math.min(domain[0], domain[1]);\n var maxValue = Math.max(domain[0], domain[1]);\n var result = [value[0], value[1]];\n if (!isNumber(value[0]) || value[0] < minValue) {\n result[0] = minValue;\n }\n if (!isNumber(value[1]) || value[1] > maxValue) {\n result[1] = maxValue;\n }\n if (result[0] > maxValue) {\n result[0] = maxValue;\n }\n if (result[1] < minValue) {\n result[1] = minValue;\n }\n return result;\n};\n\n/**\n * Stacks all positive numbers above zero and all negative numbers below zero.\n *\n * If all values in the series are positive then this behaves the same as 'none' stacker.\n *\n * @param {Array} series from d3-shape Stack\n * @return {Array} series with applied offset\n */\nexport var offsetSign = function offsetSign(series) {\n var n = series.length;\n if (n <= 0) {\n return;\n }\n for (var j = 0, m = series[0].length; j < m; ++j) {\n var positive = 0;\n var negative = 0;\n for (var i = 0; i < n; ++i) {\n var value = isNan(series[i][j][1]) ? series[i][j][0] : series[i][j][1];\n\n /* eslint-disable prefer-destructuring, no-param-reassign */\n if (value >= 0) {\n series[i][j][0] = positive;\n series[i][j][1] = positive + value;\n positive = series[i][j][1];\n } else {\n series[i][j][0] = negative;\n series[i][j][1] = negative + value;\n negative = series[i][j][1];\n }\n /* eslint-enable prefer-destructuring, no-param-reassign */\n }\n }\n};\n\n/**\n * Replaces all negative values with zero when stacking data.\n *\n * If all values in the series are positive then this behaves the same as 'none' stacker.\n *\n * @param {Array} series from d3-shape Stack\n * @return {Array} series with applied offset\n */\nexport var offsetPositive = function offsetPositive(series) {\n var n = series.length;\n if (n <= 0) {\n return;\n }\n for (var j = 0, m = series[0].length; j < m; ++j) {\n var positive = 0;\n for (var i = 0; i < n; ++i) {\n var value = isNan(series[i][j][1]) ? series[i][j][0] : series[i][j][1];\n\n /* eslint-disable prefer-destructuring, no-param-reassign */\n if (value >= 0) {\n series[i][j][0] = positive;\n series[i][j][1] = positive + value;\n positive = series[i][j][1];\n } else {\n series[i][j][0] = 0;\n series[i][j][1] = 0;\n }\n /* eslint-enable prefer-destructuring, no-param-reassign */\n }\n }\n};\n\n/**\n * Function type to compute offset for stacked data.\n *\n * d3-shape has something fishy going on with its types.\n * In @definitelytyped/d3-shape, this function (the offset accessor) is typed as Series<> => void.\n * However! When I actually open the storybook I can see that the offset accessor actually receives Array>.\n * The same I can see in the source code itself:\n * https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042\n * That one unfortunately has no types but we can tell it passes three-dimensional array.\n *\n * Which leads me to believe that definitelytyped is wrong on this one.\n * There's open discussion on this topic without much attention:\n * https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042\n */\n\nvar STACK_OFFSET_MAP = {\n sign: offsetSign,\n // @ts-expect-error definitelytyped types are incorrect\n expand: stackOffsetExpand,\n // @ts-expect-error definitelytyped types are incorrect\n none: stackOffsetNone,\n // @ts-expect-error definitelytyped types are incorrect\n silhouette: stackOffsetSilhouette,\n // @ts-expect-error definitelytyped types are incorrect\n wiggle: stackOffsetWiggle,\n positive: offsetPositive\n};\nexport var getStackedData = function getStackedData(data, stackItems, offsetType) {\n var dataKeys = stackItems.map(function (item) {\n return item.props.dataKey;\n });\n var offsetAccessor = STACK_OFFSET_MAP[offsetType];\n var stack = shapeStack()\n // @ts-expect-error stack.keys type wants an array of strings, but we provide array of DataKeys\n .keys(dataKeys).value(function (d, key) {\n return +getValueByDataKey(d, key, 0);\n }).order(stackOrderNone)\n // @ts-expect-error definitelytyped types are incorrect\n .offset(offsetAccessor);\n return stack(data);\n};\nexport var getStackGroupsByAxisId = function getStackGroupsByAxisId(data, _items, numericAxisId, cateAxisId, offsetType, reverseStackOrder) {\n if (!data) {\n return null;\n }\n\n // reversing items to affect render order (for layering)\n var items = reverseStackOrder ? _items.reverse() : _items;\n var parentStackGroupsInitialValue = {};\n var stackGroups = items.reduce(function (result, item) {\n var _item$type2;\n var defaultedProps = (_item$type2 = item.type) !== null && _item$type2 !== void 0 && _item$type2.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var stackId = defaultedProps.stackId,\n hide = defaultedProps.hide;\n if (hide) {\n return result;\n }\n var axisId = defaultedProps[numericAxisId];\n var parentGroup = result[axisId] || {\n hasStack: false,\n stackGroups: {}\n };\n if (isNumOrStr(stackId)) {\n var childGroup = parentGroup.stackGroups[stackId] || {\n numericAxisId: numericAxisId,\n cateAxisId: cateAxisId,\n items: []\n };\n childGroup.items.push(item);\n parentGroup.hasStack = true;\n parentGroup.stackGroups[stackId] = childGroup;\n } else {\n parentGroup.stackGroups[uniqueId('_stackId_')] = {\n numericAxisId: numericAxisId,\n cateAxisId: cateAxisId,\n items: [item]\n };\n }\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, axisId, parentGroup));\n }, parentStackGroupsInitialValue);\n var axisStackGroupsInitialValue = {};\n return Object.keys(stackGroups).reduce(function (result, axisId) {\n var group = stackGroups[axisId];\n if (group.hasStack) {\n var stackGroupsInitialValue = {};\n group.stackGroups = Object.keys(group.stackGroups).reduce(function (res, stackId) {\n var g = group.stackGroups[stackId];\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, stackId, {\n numericAxisId: numericAxisId,\n cateAxisId: cateAxisId,\n items: g.items,\n stackedData: getStackedData(data, g.items, offsetType)\n }));\n }, stackGroupsInitialValue);\n }\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, axisId, group));\n }, axisStackGroupsInitialValue);\n};\n\n/**\n * Configure the scale function of axis\n * @param {Object} scale The scale function\n * @param {Object} opts The configuration of axis\n * @return {Object} null\n */\nexport var getTicksOfScale = function getTicksOfScale(scale, opts) {\n var realScaleType = opts.realScaleType,\n type = opts.type,\n tickCount = opts.tickCount,\n originalDomain = opts.originalDomain,\n allowDecimals = opts.allowDecimals;\n var scaleType = realScaleType || opts.scale;\n if (scaleType !== 'auto' && scaleType !== 'linear') {\n return null;\n }\n if (tickCount && type === 'number' && originalDomain && (originalDomain[0] === 'auto' || originalDomain[1] === 'auto')) {\n // Calculate the ticks by the number of grid when the axis is a number axis\n var domain = scale.domain();\n if (!domain.length) {\n return null;\n }\n var tickValues = getNiceTickValues(domain, tickCount, allowDecimals);\n scale.domain([min(tickValues), max(tickValues)]);\n return {\n niceTicks: tickValues\n };\n }\n if (tickCount && type === 'number') {\n var _domain = scale.domain();\n var _tickValues = getTickValuesFixedDomain(_domain, tickCount, allowDecimals);\n return {\n niceTicks: _tickValues\n };\n }\n return null;\n};\nexport function getCateCoordinateOfLine(_ref5) {\n var axis = _ref5.axis,\n ticks = _ref5.ticks,\n bandSize = _ref5.bandSize,\n entry = _ref5.entry,\n index = _ref5.index,\n dataKey = _ref5.dataKey;\n if (axis.type === 'category') {\n // find coordinate of category axis by the value of category\n // @ts-expect-error why does this use direct object access instead of getValueByDataKey?\n if (!axis.allowDuplicatedCategory && axis.dataKey && !isNil(entry[axis.dataKey])) {\n // @ts-expect-error why does this use direct object access instead of getValueByDataKey?\n var matchedTick = findEntryInArray(ticks, 'value', entry[axis.dataKey]);\n if (matchedTick) {\n return matchedTick.coordinate + bandSize / 2;\n }\n }\n return ticks[index] ? ticks[index].coordinate + bandSize / 2 : null;\n }\n var value = getValueByDataKey(entry, !isNil(dataKey) ? dataKey : axis.dataKey);\n return !isNil(value) ? axis.scale(value) : null;\n}\nexport var getCateCoordinateOfBar = function getCateCoordinateOfBar(_ref6) {\n var axis = _ref6.axis,\n ticks = _ref6.ticks,\n offset = _ref6.offset,\n bandSize = _ref6.bandSize,\n entry = _ref6.entry,\n index = _ref6.index;\n if (axis.type === 'category') {\n return ticks[index] ? ticks[index].coordinate + offset : null;\n }\n var value = getValueByDataKey(entry, axis.dataKey, axis.domain[index]);\n return !isNil(value) ? axis.scale(value) - bandSize / 2 + offset : null;\n};\nexport var getBaseValueOfBar = function getBaseValueOfBar(_ref7) {\n var numericAxis = _ref7.numericAxis;\n var domain = numericAxis.scale.domain();\n if (numericAxis.type === 'number') {\n var minValue = Math.min(domain[0], domain[1]);\n var maxValue = Math.max(domain[0], domain[1]);\n if (minValue <= 0 && maxValue >= 0) {\n return 0;\n }\n if (maxValue < 0) {\n return maxValue;\n }\n return minValue;\n }\n return domain[0];\n};\nexport var getStackedDataOfItem = function getStackedDataOfItem(item, stackGroups) {\n var _item$type3;\n var defaultedProps = (_item$type3 = item.type) !== null && _item$type3 !== void 0 && _item$type3.defaultProps ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var stackId = defaultedProps.stackId;\n if (isNumOrStr(stackId)) {\n var group = stackGroups[stackId];\n if (group) {\n var itemIndex = group.items.indexOf(item);\n return itemIndex >= 0 ? group.stackedData[itemIndex] : null;\n }\n }\n return null;\n};\nvar getDomainOfSingle = function getDomainOfSingle(data) {\n return data.reduce(function (result, entry) {\n return [min(entry.concat([result[0]]).filter(isNumber)), max(entry.concat([result[1]]).filter(isNumber))];\n }, [Infinity, -Infinity]);\n};\nexport var getDomainOfStackGroups = function getDomainOfStackGroups(stackGroups, startIndex, endIndex) {\n return Object.keys(stackGroups).reduce(function (result, stackId) {\n var group = stackGroups[stackId];\n var stackedData = group.stackedData;\n var domain = stackedData.reduce(function (res, entry) {\n var s = getDomainOfSingle(entry.slice(startIndex, endIndex + 1));\n return [Math.min(res[0], s[0]), Math.max(res[1], s[1])];\n }, [Infinity, -Infinity]);\n return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])];\n }, [Infinity, -Infinity]).map(function (result) {\n return result === Infinity || result === -Infinity ? 0 : result;\n });\n};\nexport var MIN_VALUE_REG = /^dataMin[\\s]*-[\\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;\nexport var MAX_VALUE_REG = /^dataMax[\\s]*\\+[\\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;\nexport var parseSpecifiedDomain = function parseSpecifiedDomain(specifiedDomain, dataDomain, allowDataOverflow) {\n if (isFunction(specifiedDomain)) {\n return specifiedDomain(dataDomain, allowDataOverflow);\n }\n if (!Array.isArray(specifiedDomain)) {\n return dataDomain;\n }\n var domain = [];\n\n /* eslint-disable prefer-destructuring */\n if (isNumber(specifiedDomain[0])) {\n domain[0] = allowDataOverflow ? specifiedDomain[0] : Math.min(specifiedDomain[0], dataDomain[0]);\n } else if (MIN_VALUE_REG.test(specifiedDomain[0])) {\n var value = +MIN_VALUE_REG.exec(specifiedDomain[0])[1];\n domain[0] = dataDomain[0] - value;\n } else if (isFunction(specifiedDomain[0])) {\n domain[0] = specifiedDomain[0](dataDomain[0]);\n } else {\n domain[0] = dataDomain[0];\n }\n if (isNumber(specifiedDomain[1])) {\n domain[1] = allowDataOverflow ? specifiedDomain[1] : Math.max(specifiedDomain[1], dataDomain[1]);\n } else if (MAX_VALUE_REG.test(specifiedDomain[1])) {\n var _value = +MAX_VALUE_REG.exec(specifiedDomain[1])[1];\n domain[1] = dataDomain[1] + _value;\n } else if (isFunction(specifiedDomain[1])) {\n domain[1] = specifiedDomain[1](dataDomain[1]);\n } else {\n domain[1] = dataDomain[1];\n }\n /* eslint-enable prefer-destructuring */\n\n return domain;\n};\n\n/**\n * Calculate the size between two category\n * @param {Object} axis The options of axis\n * @param {Array} ticks The ticks of axis\n * @param {Boolean} isBar if items in axis are bars\n * @return {Number} Size\n */\nexport var getBandSizeOfAxis = function getBandSizeOfAxis(axis, ticks, isBar) {\n // @ts-expect-error we need to rethink scale type\n if (axis && axis.scale && axis.scale.bandwidth) {\n // @ts-expect-error we need to rethink scale type\n var bandWidth = axis.scale.bandwidth();\n if (!isBar || bandWidth > 0) {\n return bandWidth;\n }\n }\n if (axis && ticks && ticks.length >= 2) {\n var orderedTicks = sortBy(ticks, function (o) {\n return o.coordinate;\n });\n var bandSize = Infinity;\n for (var i = 1, len = orderedTicks.length; i < len; i++) {\n var cur = orderedTicks[i];\n var prev = orderedTicks[i - 1];\n bandSize = Math.min((cur.coordinate || 0) - (prev.coordinate || 0), bandSize);\n }\n return bandSize === Infinity ? 0 : bandSize;\n }\n return isBar ? undefined : 0;\n};\n/**\n * parse the domain of a category axis when a domain is specified\n * @param {Array} specifiedDomain The domain specified by users\n * @param {Array} calculatedDomain The domain calculated by dateKey\n * @param {ReactElement} axisChild The axis ReactElement\n * @returns {Array} domains\n */\nexport var parseDomainOfCategoryAxis = function parseDomainOfCategoryAxis(specifiedDomain, calculatedDomain, axisChild) {\n if (!specifiedDomain || !specifiedDomain.length) {\n return calculatedDomain;\n }\n if (isEqual(specifiedDomain, get(axisChild, 'type.defaultProps.domain'))) {\n return calculatedDomain;\n }\n return specifiedDomain;\n};\nexport var getTooltipItem = function getTooltipItem(graphicalItem, payload) {\n var defaultedProps = graphicalItem.type.defaultProps ? _objectSpread(_objectSpread({}, graphicalItem.type.defaultProps), graphicalItem.props) : graphicalItem.props;\n var dataKey = defaultedProps.dataKey,\n name = defaultedProps.name,\n unit = defaultedProps.unit,\n formatter = defaultedProps.formatter,\n tooltipType = defaultedProps.tooltipType,\n chartType = defaultedProps.chartType,\n hide = defaultedProps.hide;\n return _objectSpread(_objectSpread({}, filterProps(graphicalItem, false)), {}, {\n dataKey: dataKey,\n unit: unit,\n formatter: formatter,\n name: name || dataKey,\n color: getMainColorOfGraphicItem(graphicalItem),\n value: getValueByDataKey(payload, dataKey),\n type: tooltipType,\n payload: payload,\n chartType: chartType,\n hide: hide\n });\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport isNil from 'lodash/isNil';\nimport { isValidElement } from 'react';\nimport isFunction from 'lodash/isFunction';\nimport { getPercentValue } from './DataUtils';\nimport { parseScale, checkDomainOfScale, getTicksOfScale } from './ChartUtils';\nexport var RADIAN = Math.PI / 180;\nexport var degreeToRadian = function degreeToRadian(angle) {\n return angle * Math.PI / 180;\n};\nexport var radianToDegree = function radianToDegree(angleInRadian) {\n return angleInRadian * 180 / Math.PI;\n};\nexport var polarToCartesian = function polarToCartesian(cx, cy, radius, angle) {\n return {\n x: cx + Math.cos(-RADIAN * angle) * radius,\n y: cy + Math.sin(-RADIAN * angle) * radius\n };\n};\nexport var getMaxRadius = function getMaxRadius(width, height) {\n var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;\n};\n\n/**\n * Calculate the scale function, position, width, height of axes\n * @param {Object} props Latest props\n * @param {Object} axisMap The configuration of axes\n * @param {Object} offset The offset of main part in the svg element\n * @param {Object} axisType The type of axes, radius-axis or angle-axis\n * @param {String} chartName The name of chart\n * @return {Object} Configuration\n */\nexport var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {\n var width = props.width,\n height = props.height;\n var startAngle = props.startAngle,\n endAngle = props.endAngle;\n var cx = getPercentValue(props.cx, width, width / 2);\n var cy = getPercentValue(props.cy, height, height / 2);\n var maxRadius = getMaxRadius(width, height, offset);\n var innerRadius = getPercentValue(props.innerRadius, maxRadius, 0);\n var outerRadius = getPercentValue(props.outerRadius, maxRadius, maxRadius * 0.8);\n var ids = Object.keys(axisMap);\n return ids.reduce(function (result, id) {\n var axis = axisMap[id];\n var domain = axis.domain,\n reversed = axis.reversed;\n var range;\n if (isNil(axis.range)) {\n if (axisType === 'angleAxis') {\n range = [startAngle, endAngle];\n } else if (axisType === 'radiusAxis') {\n range = [innerRadius, outerRadius];\n }\n if (reversed) {\n range = [range[1], range[0]];\n }\n } else {\n range = axis.range;\n var _range = range;\n var _range2 = _slicedToArray(_range, 2);\n startAngle = _range2[0];\n endAngle = _range2[1];\n }\n var _parseScale = parseScale(axis, chartName),\n realScaleType = _parseScale.realScaleType,\n scale = _parseScale.scale;\n scale.domain(domain).range(range);\n checkDomainOfScale(scale);\n var ticks = getTicksOfScale(scale, _objectSpread(_objectSpread({}, axis), {}, {\n realScaleType: realScaleType\n }));\n var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {\n range: range,\n radius: outerRadius,\n realScaleType: realScaleType,\n scale: scale,\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n startAngle: startAngle,\n endAngle: endAngle\n });\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));\n }, {});\n};\nexport var distanceBetweenPoints = function distanceBetweenPoints(point, anotherPoint) {\n var x1 = point.x,\n y1 = point.y;\n var x2 = anotherPoint.x,\n y2 = anotherPoint.y;\n return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));\n};\nexport var getAngleOfPoint = function getAngleOfPoint(_ref, _ref2) {\n var x = _ref.x,\n y = _ref.y;\n var cx = _ref2.cx,\n cy = _ref2.cy;\n var radius = distanceBetweenPoints({\n x: x,\n y: y\n }, {\n x: cx,\n y: cy\n });\n if (radius <= 0) {\n return {\n radius: radius\n };\n }\n var cos = (x - cx) / radius;\n var angleInRadian = Math.acos(cos);\n if (y > cy) {\n angleInRadian = 2 * Math.PI - angleInRadian;\n }\n return {\n radius: radius,\n angle: radianToDegree(angleInRadian),\n angleInRadian: angleInRadian\n };\n};\nexport var formatAngleOfSector = function formatAngleOfSector(_ref3) {\n var startAngle = _ref3.startAngle,\n endAngle = _ref3.endAngle;\n var startCnt = Math.floor(startAngle / 360);\n var endCnt = Math.floor(endAngle / 360);\n var min = Math.min(startCnt, endCnt);\n return {\n startAngle: startAngle - min * 360,\n endAngle: endAngle - min * 360\n };\n};\nvar reverseFormatAngleOfSetor = function reverseFormatAngleOfSetor(angle, _ref4) {\n var startAngle = _ref4.startAngle,\n endAngle = _ref4.endAngle;\n var startCnt = Math.floor(startAngle / 360);\n var endCnt = Math.floor(endAngle / 360);\n var min = Math.min(startCnt, endCnt);\n return angle + min * 360;\n};\nexport var inRangeOfSector = function inRangeOfSector(_ref5, sector) {\n var x = _ref5.x,\n y = _ref5.y;\n var _getAngleOfPoint = getAngleOfPoint({\n x: x,\n y: y\n }, sector),\n radius = _getAngleOfPoint.radius,\n angle = _getAngleOfPoint.angle;\n var innerRadius = sector.innerRadius,\n outerRadius = sector.outerRadius;\n if (radius < innerRadius || radius > outerRadius) {\n return false;\n }\n if (radius === 0) {\n return true;\n }\n var _formatAngleOfSector = formatAngleOfSector(sector),\n startAngle = _formatAngleOfSector.startAngle,\n endAngle = _formatAngleOfSector.endAngle;\n var formatAngle = angle;\n var inRange;\n if (startAngle <= endAngle) {\n while (formatAngle > endAngle) {\n formatAngle -= 360;\n }\n while (formatAngle < startAngle) {\n formatAngle += 360;\n }\n inRange = formatAngle >= startAngle && formatAngle <= endAngle;\n } else {\n while (formatAngle > startAngle) {\n formatAngle -= 360;\n }\n while (formatAngle < endAngle) {\n formatAngle += 360;\n }\n inRange = formatAngle >= endAngle && formatAngle <= startAngle;\n }\n if (inRange) {\n return _objectSpread(_objectSpread({}, sector), {}, {\n radius: radius,\n angle: reverseFormatAngleOfSetor(formatAngle, sector)\n });\n }\n return null;\n};\nexport var getTickClassName = function getTickClassName(tick) {\n return ! /*#__PURE__*/isValidElement(tick) && !isFunction(tick) && typeof tick !== 'boolean' ? tick.className : '';\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"offset\"];\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport React, { cloneElement, isValidElement, createElement } from 'react';\nimport isNil from 'lodash/isNil';\nimport isFunction from 'lodash/isFunction';\nimport isObject from 'lodash/isObject';\nimport clsx from 'clsx';\nimport { Text } from './Text';\nimport { findAllByType, filterProps } from '../util/ReactUtils';\nimport { isNumOrStr, isNumber, isPercent, getPercentValue, uniqueId, mathSign } from '../util/DataUtils';\nimport { polarToCartesian } from '../util/PolarUtils';\nvar getLabel = function getLabel(props) {\n var value = props.value,\n formatter = props.formatter;\n var label = isNil(props.children) ? value : props.children;\n if (isFunction(formatter)) {\n return formatter(label);\n }\n return label;\n};\nvar getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {\n var sign = mathSign(endAngle - startAngle);\n var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);\n return sign * deltaAngle;\n};\nvar renderRadialLabel = function renderRadialLabel(labelProps, label, attrs) {\n var position = labelProps.position,\n viewBox = labelProps.viewBox,\n offset = labelProps.offset,\n className = labelProps.className;\n var _ref = viewBox,\n cx = _ref.cx,\n cy = _ref.cy,\n innerRadius = _ref.innerRadius,\n outerRadius = _ref.outerRadius,\n startAngle = _ref.startAngle,\n endAngle = _ref.endAngle,\n clockWise = _ref.clockWise;\n var radius = (innerRadius + outerRadius) / 2;\n var deltaAngle = getDeltaAngle(startAngle, endAngle);\n var sign = deltaAngle >= 0 ? 1 : -1;\n var labelAngle, direction;\n if (position === 'insideStart') {\n labelAngle = startAngle + sign * offset;\n direction = clockWise;\n } else if (position === 'insideEnd') {\n labelAngle = endAngle - sign * offset;\n direction = !clockWise;\n } else if (position === 'end') {\n labelAngle = endAngle + sign * offset;\n direction = clockWise;\n }\n direction = deltaAngle <= 0 ? direction : !direction;\n var startPoint = polarToCartesian(cx, cy, radius, labelAngle);\n var endPoint = polarToCartesian(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359);\n var path = \"M\".concat(startPoint.x, \",\").concat(startPoint.y, \"\\n A\").concat(radius, \",\").concat(radius, \",0,1,\").concat(direction ? 0 : 1, \",\\n \").concat(endPoint.x, \",\").concat(endPoint.y);\n var id = isNil(labelProps.id) ? uniqueId('recharts-radial-line-') : labelProps.id;\n return /*#__PURE__*/React.createElement(\"text\", _extends({}, attrs, {\n dominantBaseline: \"central\",\n className: clsx('recharts-radial-bar-label', className)\n }), /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"path\", {\n id: id,\n d: path\n })), /*#__PURE__*/React.createElement(\"textPath\", {\n xlinkHref: \"#\".concat(id)\n }, label));\n};\nvar getAttrsOfPolarLabel = function getAttrsOfPolarLabel(props) {\n var viewBox = props.viewBox,\n offset = props.offset,\n position = props.position;\n var _ref2 = viewBox,\n cx = _ref2.cx,\n cy = _ref2.cy,\n innerRadius = _ref2.innerRadius,\n outerRadius = _ref2.outerRadius,\n startAngle = _ref2.startAngle,\n endAngle = _ref2.endAngle;\n var midAngle = (startAngle + endAngle) / 2;\n if (position === 'outside') {\n var _polarToCartesian = polarToCartesian(cx, cy, outerRadius + offset, midAngle),\n _x = _polarToCartesian.x,\n _y = _polarToCartesian.y;\n return {\n x: _x,\n y: _y,\n textAnchor: _x >= cx ? 'start' : 'end',\n verticalAnchor: 'middle'\n };\n }\n if (position === 'center') {\n return {\n x: cx,\n y: cy,\n textAnchor: 'middle',\n verticalAnchor: 'middle'\n };\n }\n if (position === 'centerTop') {\n return {\n x: cx,\n y: cy,\n textAnchor: 'middle',\n verticalAnchor: 'start'\n };\n }\n if (position === 'centerBottom') {\n return {\n x: cx,\n y: cy,\n textAnchor: 'middle',\n verticalAnchor: 'end'\n };\n }\n var r = (innerRadius + outerRadius) / 2;\n var _polarToCartesian2 = polarToCartesian(cx, cy, r, midAngle),\n x = _polarToCartesian2.x,\n y = _polarToCartesian2.y;\n return {\n x: x,\n y: y,\n textAnchor: 'middle',\n verticalAnchor: 'middle'\n };\n};\nvar getAttrsOfCartesianLabel = function getAttrsOfCartesianLabel(props) {\n var viewBox = props.viewBox,\n parentViewBox = props.parentViewBox,\n offset = props.offset,\n position = props.position;\n var _ref3 = viewBox,\n x = _ref3.x,\n y = _ref3.y,\n width = _ref3.width,\n height = _ref3.height;\n\n // Define vertical offsets and position inverts based on the value being positive or negative\n var verticalSign = height >= 0 ? 1 : -1;\n var verticalOffset = verticalSign * offset;\n var verticalEnd = verticalSign > 0 ? 'end' : 'start';\n var verticalStart = verticalSign > 0 ? 'start' : 'end';\n\n // Define horizontal offsets and position inverts based on the value being positive or negative\n var horizontalSign = width >= 0 ? 1 : -1;\n var horizontalOffset = horizontalSign * offset;\n var horizontalEnd = horizontalSign > 0 ? 'end' : 'start';\n var horizontalStart = horizontalSign > 0 ? 'start' : 'end';\n if (position === 'top') {\n var attrs = {\n x: x + width / 2,\n y: y - verticalSign * offset,\n textAnchor: 'middle',\n verticalAnchor: verticalEnd\n };\n return _objectSpread(_objectSpread({}, attrs), parentViewBox ? {\n height: Math.max(y - parentViewBox.y, 0),\n width: width\n } : {});\n }\n if (position === 'bottom') {\n var _attrs = {\n x: x + width / 2,\n y: y + height + verticalOffset,\n textAnchor: 'middle',\n verticalAnchor: verticalStart\n };\n return _objectSpread(_objectSpread({}, _attrs), parentViewBox ? {\n height: Math.max(parentViewBox.y + parentViewBox.height - (y + height), 0),\n width: width\n } : {});\n }\n if (position === 'left') {\n var _attrs2 = {\n x: x - horizontalOffset,\n y: y + height / 2,\n textAnchor: horizontalEnd,\n verticalAnchor: 'middle'\n };\n return _objectSpread(_objectSpread({}, _attrs2), parentViewBox ? {\n width: Math.max(_attrs2.x - parentViewBox.x, 0),\n height: height\n } : {});\n }\n if (position === 'right') {\n var _attrs3 = {\n x: x + width + horizontalOffset,\n y: y + height / 2,\n textAnchor: horizontalStart,\n verticalAnchor: 'middle'\n };\n return _objectSpread(_objectSpread({}, _attrs3), parentViewBox ? {\n width: Math.max(parentViewBox.x + parentViewBox.width - _attrs3.x, 0),\n height: height\n } : {});\n }\n var sizeAttrs = parentViewBox ? {\n width: width,\n height: height\n } : {};\n if (position === 'insideLeft') {\n return _objectSpread({\n x: x + horizontalOffset,\n y: y + height / 2,\n textAnchor: horizontalStart,\n verticalAnchor: 'middle'\n }, sizeAttrs);\n }\n if (position === 'insideRight') {\n return _objectSpread({\n x: x + width - horizontalOffset,\n y: y + height / 2,\n textAnchor: horizontalEnd,\n verticalAnchor: 'middle'\n }, sizeAttrs);\n }\n if (position === 'insideTop') {\n return _objectSpread({\n x: x + width / 2,\n y: y + verticalOffset,\n textAnchor: 'middle',\n verticalAnchor: verticalStart\n }, sizeAttrs);\n }\n if (position === 'insideBottom') {\n return _objectSpread({\n x: x + width / 2,\n y: y + height - verticalOffset,\n textAnchor: 'middle',\n verticalAnchor: verticalEnd\n }, sizeAttrs);\n }\n if (position === 'insideTopLeft') {\n return _objectSpread({\n x: x + horizontalOffset,\n y: y + verticalOffset,\n textAnchor: horizontalStart,\n verticalAnchor: verticalStart\n }, sizeAttrs);\n }\n if (position === 'insideTopRight') {\n return _objectSpread({\n x: x + width - horizontalOffset,\n y: y + verticalOffset,\n textAnchor: horizontalEnd,\n verticalAnchor: verticalStart\n }, sizeAttrs);\n }\n if (position === 'insideBottomLeft') {\n return _objectSpread({\n x: x + horizontalOffset,\n y: y + height - verticalOffset,\n textAnchor: horizontalStart,\n verticalAnchor: verticalEnd\n }, sizeAttrs);\n }\n if (position === 'insideBottomRight') {\n return _objectSpread({\n x: x + width - horizontalOffset,\n y: y + height - verticalOffset,\n textAnchor: horizontalEnd,\n verticalAnchor: verticalEnd\n }, sizeAttrs);\n }\n if (isObject(position) && (isNumber(position.x) || isPercent(position.x)) && (isNumber(position.y) || isPercent(position.y))) {\n return _objectSpread({\n x: x + getPercentValue(position.x, width),\n y: y + getPercentValue(position.y, height),\n textAnchor: 'end',\n verticalAnchor: 'end'\n }, sizeAttrs);\n }\n return _objectSpread({\n x: x + width / 2,\n y: y + height / 2,\n textAnchor: 'middle',\n verticalAnchor: 'middle'\n }, sizeAttrs);\n};\nvar isPolar = function isPolar(viewBox) {\n return 'cx' in viewBox && isNumber(viewBox.cx);\n};\nexport function Label(_ref4) {\n var _ref4$offset = _ref4.offset,\n offset = _ref4$offset === void 0 ? 5 : _ref4$offset,\n restProps = _objectWithoutProperties(_ref4, _excluded);\n var props = _objectSpread({\n offset: offset\n }, restProps);\n var viewBox = props.viewBox,\n position = props.position,\n value = props.value,\n children = props.children,\n content = props.content,\n _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n textBreakAll = props.textBreakAll;\n if (!viewBox || isNil(value) && isNil(children) && ! /*#__PURE__*/isValidElement(content) && !isFunction(content)) {\n return null;\n }\n if ( /*#__PURE__*/isValidElement(content)) {\n return /*#__PURE__*/cloneElement(content, props);\n }\n var label;\n if (isFunction(content)) {\n label = /*#__PURE__*/createElement(content, props);\n if ( /*#__PURE__*/isValidElement(label)) {\n return label;\n }\n } else {\n label = getLabel(props);\n }\n var isPolarLabel = isPolar(viewBox);\n var attrs = filterProps(props, true);\n if (isPolarLabel && (position === 'insideStart' || position === 'insideEnd' || position === 'end')) {\n return renderRadialLabel(props, label, attrs);\n }\n var positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props) : getAttrsOfCartesianLabel(props);\n return /*#__PURE__*/React.createElement(Text, _extends({\n className: clsx('recharts-label', className)\n }, attrs, positionAttrs, {\n breakAll: textBreakAll\n }), label);\n}\nLabel.displayName = 'Label';\nvar parseViewBox = function parseViewBox(props) {\n var cx = props.cx,\n cy = props.cy,\n angle = props.angle,\n startAngle = props.startAngle,\n endAngle = props.endAngle,\n r = props.r,\n radius = props.radius,\n innerRadius = props.innerRadius,\n outerRadius = props.outerRadius,\n x = props.x,\n y = props.y,\n top = props.top,\n left = props.left,\n width = props.width,\n height = props.height,\n clockWise = props.clockWise,\n labelViewBox = props.labelViewBox;\n if (labelViewBox) {\n return labelViewBox;\n }\n if (isNumber(width) && isNumber(height)) {\n if (isNumber(x) && isNumber(y)) {\n return {\n x: x,\n y: y,\n width: width,\n height: height\n };\n }\n if (isNumber(top) && isNumber(left)) {\n return {\n x: top,\n y: left,\n width: width,\n height: height\n };\n }\n }\n if (isNumber(x) && isNumber(y)) {\n return {\n x: x,\n y: y,\n width: 0,\n height: 0\n };\n }\n if (isNumber(cx) && isNumber(cy)) {\n return {\n cx: cx,\n cy: cy,\n startAngle: startAngle || angle || 0,\n endAngle: endAngle || angle || 0,\n innerRadius: innerRadius || 0,\n outerRadius: outerRadius || radius || r || 0,\n clockWise: clockWise\n };\n }\n if (props.viewBox) {\n return props.viewBox;\n }\n return {};\n};\nvar parseLabel = function parseLabel(label, viewBox) {\n if (!label) {\n return null;\n }\n if (label === true) {\n return /*#__PURE__*/React.createElement(Label, {\n key: \"label-implicit\",\n viewBox: viewBox\n });\n }\n if (isNumOrStr(label)) {\n return /*#__PURE__*/React.createElement(Label, {\n key: \"label-implicit\",\n viewBox: viewBox,\n value: label\n });\n }\n if ( /*#__PURE__*/isValidElement(label)) {\n if (label.type === Label) {\n return /*#__PURE__*/cloneElement(label, {\n key: 'label-implicit',\n viewBox: viewBox\n });\n }\n return /*#__PURE__*/React.createElement(Label, {\n key: \"label-implicit\",\n content: label,\n viewBox: viewBox\n });\n }\n if (isFunction(label)) {\n return /*#__PURE__*/React.createElement(Label, {\n key: \"label-implicit\",\n content: label,\n viewBox: viewBox\n });\n }\n if (isObject(label)) {\n return /*#__PURE__*/React.createElement(Label, _extends({\n viewBox: viewBox\n }, label, {\n key: \"label-implicit\"\n }));\n }\n return null;\n};\nvar renderCallByParent = function renderCallByParent(parentProps, viewBox) {\n var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {\n return null;\n }\n var children = parentProps.children;\n var parentViewBox = parseViewBox(parentProps);\n var explicitChildren = findAllByType(children, Label).map(function (child, index) {\n return /*#__PURE__*/cloneElement(child, {\n viewBox: viewBox || parentViewBox,\n // eslint-disable-next-line react/no-array-index-key\n key: \"label-\".concat(index)\n });\n });\n if (!checkPropsLabel) {\n return explicitChildren;\n }\n var implicitLabel = parseLabel(parentProps.label, viewBox || parentViewBox);\n return [implicitLabel].concat(_toConsumableArray(explicitChildren));\n};\nLabel.parseViewBox = parseViewBox;\nLabel.renderCallByParent = renderCallByParent;","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"valueAccessor\"],\n _excluded2 = [\"data\", \"dataKey\", \"clockWise\", \"id\", \"textBreakAll\"];\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nimport React, { cloneElement } from 'react';\nimport isNil from 'lodash/isNil';\nimport isObject from 'lodash/isObject';\nimport isFunction from 'lodash/isFunction';\nimport last from 'lodash/last';\nimport { Label } from './Label';\nimport { Layer } from '../container/Layer';\nimport { findAllByType, filterProps } from '../util/ReactUtils';\nimport { getValueByDataKey } from '../util/ChartUtils';\nvar defaultAccessor = function defaultAccessor(entry) {\n return Array.isArray(entry.value) ? last(entry.value) : entry.value;\n};\nexport function LabelList(_ref) {\n var _ref$valueAccessor = _ref.valueAccessor,\n valueAccessor = _ref$valueAccessor === void 0 ? defaultAccessor : _ref$valueAccessor,\n restProps = _objectWithoutProperties(_ref, _excluded);\n var data = restProps.data,\n dataKey = restProps.dataKey,\n clockWise = restProps.clockWise,\n id = restProps.id,\n textBreakAll = restProps.textBreakAll,\n others = _objectWithoutProperties(restProps, _excluded2);\n if (!data || !data.length) {\n return null;\n }\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-label-list\"\n }, data.map(function (entry, index) {\n var value = isNil(dataKey) ? valueAccessor(entry, index) : getValueByDataKey(entry && entry.payload, dataKey);\n var idProps = isNil(id) ? {} : {\n id: \"\".concat(id, \"-\").concat(index)\n };\n return /*#__PURE__*/React.createElement(Label, _extends({}, filterProps(entry, true), others, idProps, {\n parentViewBox: entry.parentViewBox,\n value: value,\n textBreakAll: textBreakAll,\n viewBox: Label.parseViewBox(isNil(clockWise) ? entry : _objectSpread(_objectSpread({}, entry), {}, {\n clockWise: clockWise\n })),\n key: \"label-\".concat(index) // eslint-disable-line react/no-array-index-key\n ,\n index: index\n }));\n }));\n}\nLabelList.displayName = 'LabelList';\nfunction parseLabelList(label, data) {\n if (!label) {\n return null;\n }\n if (label === true) {\n return /*#__PURE__*/React.createElement(LabelList, {\n key: \"labelList-implicit\",\n data: data\n });\n }\n if ( /*#__PURE__*/React.isValidElement(label) || isFunction(label)) {\n return /*#__PURE__*/React.createElement(LabelList, {\n key: \"labelList-implicit\",\n data: data,\n content: label\n });\n }\n if (isObject(label)) {\n return /*#__PURE__*/React.createElement(LabelList, _extends({\n data: data\n }, label, {\n key: \"labelList-implicit\"\n }));\n }\n return null;\n}\nfunction renderCallByParent(parentProps, data) {\n var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {\n return null;\n }\n var children = parentProps.children;\n var explicitChildren = findAllByType(children, LabelList).map(function (child, index) {\n return /*#__PURE__*/cloneElement(child, {\n data: data,\n // eslint-disable-next-line react/no-array-index-key\n key: \"labelList-\".concat(index)\n });\n });\n if (!checkPropsLabel) {\n return explicitChildren;\n }\n var implicitLabelList = parseLabelList(parentProps.label, data);\n return [implicitLabelList].concat(_toConsumableArray(explicitChildren));\n}\nLabelList.renderCallByParent = renderCallByParent;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Sector\n */\nimport React from 'react';\nimport clsx from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nimport { polarToCartesian, RADIAN } from '../util/PolarUtils';\nimport { getPercentValue, mathSign } from '../util/DataUtils';\nvar getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {\n var sign = mathSign(endAngle - startAngle);\n var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999);\n return sign * deltaAngle;\n};\nvar getTangentCircle = function getTangentCircle(_ref) {\n var cx = _ref.cx,\n cy = _ref.cy,\n radius = _ref.radius,\n angle = _ref.angle,\n sign = _ref.sign,\n isExternal = _ref.isExternal,\n cornerRadius = _ref.cornerRadius,\n cornerIsExternal = _ref.cornerIsExternal;\n var centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;\n var theta = Math.asin(cornerRadius / centerRadius) / RADIAN;\n var centerAngle = cornerIsExternal ? angle : angle + sign * theta;\n var center = polarToCartesian(cx, cy, centerRadius, centerAngle);\n // The coordinate of point which is tangent to the circle\n var circleTangency = polarToCartesian(cx, cy, radius, centerAngle);\n // The coordinate of point which is tangent to the radius line\n var lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;\n var lineTangency = polarToCartesian(cx, cy, centerRadius * Math.cos(theta * RADIAN), lineTangencyAngle);\n return {\n center: center,\n circleTangency: circleTangency,\n lineTangency: lineTangency,\n theta: theta\n };\n};\nvar getSectorPath = function getSectorPath(_ref2) {\n var cx = _ref2.cx,\n cy = _ref2.cy,\n innerRadius = _ref2.innerRadius,\n outerRadius = _ref2.outerRadius,\n startAngle = _ref2.startAngle,\n endAngle = _ref2.endAngle;\n var angle = getDeltaAngle(startAngle, endAngle);\n\n // When the angle of sector equals to 360, star point and end point coincide\n var tempEndAngle = startAngle + angle;\n var outerStartPoint = polarToCartesian(cx, cy, outerRadius, startAngle);\n var outerEndPoint = polarToCartesian(cx, cy, outerRadius, tempEndAngle);\n var path = \"M \".concat(outerStartPoint.x, \",\").concat(outerStartPoint.y, \"\\n A \").concat(outerRadius, \",\").concat(outerRadius, \",0,\\n \").concat(+(Math.abs(angle) > 180), \",\").concat(+(startAngle > tempEndAngle), \",\\n \").concat(outerEndPoint.x, \",\").concat(outerEndPoint.y, \"\\n \");\n if (innerRadius > 0) {\n var innerStartPoint = polarToCartesian(cx, cy, innerRadius, startAngle);\n var innerEndPoint = polarToCartesian(cx, cy, innerRadius, tempEndAngle);\n path += \"L \".concat(innerEndPoint.x, \",\").concat(innerEndPoint.y, \"\\n A \").concat(innerRadius, \",\").concat(innerRadius, \",0,\\n \").concat(+(Math.abs(angle) > 180), \",\").concat(+(startAngle <= tempEndAngle), \",\\n \").concat(innerStartPoint.x, \",\").concat(innerStartPoint.y, \" Z\");\n } else {\n path += \"L \".concat(cx, \",\").concat(cy, \" Z\");\n }\n return path;\n};\nvar getSectorWithCorner = function getSectorWithCorner(_ref3) {\n var cx = _ref3.cx,\n cy = _ref3.cy,\n innerRadius = _ref3.innerRadius,\n outerRadius = _ref3.outerRadius,\n cornerRadius = _ref3.cornerRadius,\n forceCornerRadius = _ref3.forceCornerRadius,\n cornerIsExternal = _ref3.cornerIsExternal,\n startAngle = _ref3.startAngle,\n endAngle = _ref3.endAngle;\n var sign = mathSign(endAngle - startAngle);\n var _getTangentCircle = getTangentCircle({\n cx: cx,\n cy: cy,\n radius: outerRadius,\n angle: startAngle,\n sign: sign,\n cornerRadius: cornerRadius,\n cornerIsExternal: cornerIsExternal\n }),\n soct = _getTangentCircle.circleTangency,\n solt = _getTangentCircle.lineTangency,\n sot = _getTangentCircle.theta;\n var _getTangentCircle2 = getTangentCircle({\n cx: cx,\n cy: cy,\n radius: outerRadius,\n angle: endAngle,\n sign: -sign,\n cornerRadius: cornerRadius,\n cornerIsExternal: cornerIsExternal\n }),\n eoct = _getTangentCircle2.circleTangency,\n eolt = _getTangentCircle2.lineTangency,\n eot = _getTangentCircle2.theta;\n var outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot;\n if (outerArcAngle < 0) {\n if (forceCornerRadius) {\n return \"M \".concat(solt.x, \",\").concat(solt.y, \"\\n a\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,1,\").concat(cornerRadius * 2, \",0\\n a\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,1,\").concat(-cornerRadius * 2, \",0\\n \");\n }\n return getSectorPath({\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n startAngle: startAngle,\n endAngle: endAngle\n });\n }\n var path = \"M \".concat(solt.x, \",\").concat(solt.y, \"\\n A\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,\").concat(+(sign < 0), \",\").concat(soct.x, \",\").concat(soct.y, \"\\n A\").concat(outerRadius, \",\").concat(outerRadius, \",0,\").concat(+(outerArcAngle > 180), \",\").concat(+(sign < 0), \",\").concat(eoct.x, \",\").concat(eoct.y, \"\\n A\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,\").concat(+(sign < 0), \",\").concat(eolt.x, \",\").concat(eolt.y, \"\\n \");\n if (innerRadius > 0) {\n var _getTangentCircle3 = getTangentCircle({\n cx: cx,\n cy: cy,\n radius: innerRadius,\n angle: startAngle,\n sign: sign,\n isExternal: true,\n cornerRadius: cornerRadius,\n cornerIsExternal: cornerIsExternal\n }),\n sict = _getTangentCircle3.circleTangency,\n silt = _getTangentCircle3.lineTangency,\n sit = _getTangentCircle3.theta;\n var _getTangentCircle4 = getTangentCircle({\n cx: cx,\n cy: cy,\n radius: innerRadius,\n angle: endAngle,\n sign: -sign,\n isExternal: true,\n cornerRadius: cornerRadius,\n cornerIsExternal: cornerIsExternal\n }),\n eict = _getTangentCircle4.circleTangency,\n eilt = _getTangentCircle4.lineTangency,\n eit = _getTangentCircle4.theta;\n var innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit;\n if (innerArcAngle < 0 && cornerRadius === 0) {\n return \"\".concat(path, \"L\").concat(cx, \",\").concat(cy, \"Z\");\n }\n path += \"L\".concat(eilt.x, \",\").concat(eilt.y, \"\\n A\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,\").concat(+(sign < 0), \",\").concat(eict.x, \",\").concat(eict.y, \"\\n A\").concat(innerRadius, \",\").concat(innerRadius, \",0,\").concat(+(innerArcAngle > 180), \",\").concat(+(sign > 0), \",\").concat(sict.x, \",\").concat(sict.y, \"\\n A\").concat(cornerRadius, \",\").concat(cornerRadius, \",0,0,\").concat(+(sign < 0), \",\").concat(silt.x, \",\").concat(silt.y, \"Z\");\n } else {\n path += \"L\".concat(cx, \",\").concat(cy, \"Z\");\n }\n return path;\n};\nvar defaultProps = {\n cx: 0,\n cy: 0,\n innerRadius: 0,\n outerRadius: 0,\n startAngle: 0,\n endAngle: 0,\n cornerRadius: 0,\n forceCornerRadius: false,\n cornerIsExternal: false\n};\nexport var Sector = function Sector(sectorProps) {\n var props = _objectSpread(_objectSpread({}, defaultProps), sectorProps);\n var cx = props.cx,\n cy = props.cy,\n innerRadius = props.innerRadius,\n outerRadius = props.outerRadius,\n cornerRadius = props.cornerRadius,\n forceCornerRadius = props.forceCornerRadius,\n cornerIsExternal = props.cornerIsExternal,\n startAngle = props.startAngle,\n endAngle = props.endAngle,\n className = props.className;\n if (outerRadius < innerRadius || startAngle === endAngle) {\n return null;\n }\n var layerClass = clsx('recharts-sector', className);\n var deltaRadius = outerRadius - innerRadius;\n var cr = getPercentValue(cornerRadius, deltaRadius, 0, true);\n var path;\n if (cr > 0 && Math.abs(startAngle - endAngle) < 360) {\n path = getSectorWithCorner({\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n cornerRadius: Math.min(cr, deltaRadius / 2),\n forceCornerRadius: forceCornerRadius,\n cornerIsExternal: cornerIsExternal,\n startAngle: startAngle,\n endAngle: endAngle\n });\n } else {\n path = getSectorPath({\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n startAngle: startAngle,\n endAngle: endAngle\n });\n }\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(props, true), {\n className: layerClass,\n d: path,\n role: \"img\"\n }));\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Curve\n */\nimport * as React from 'react';\nimport { line as shapeLine, area as shapeArea, curveBasisClosed, curveBasisOpen, curveBasis, curveBumpX, curveBumpY, curveLinearClosed, curveLinear, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from 'victory-vendor/d3-shape';\nimport upperFirst from 'lodash/upperFirst';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { adaptEventHandlers } from '../util/types';\nimport { filterProps } from '../util/ReactUtils';\nimport { isNumber } from '../util/DataUtils';\nvar CURVE_FACTORIES = {\n curveBasisClosed: curveBasisClosed,\n curveBasisOpen: curveBasisOpen,\n curveBasis: curveBasis,\n curveBumpX: curveBumpX,\n curveBumpY: curveBumpY,\n curveLinearClosed: curveLinearClosed,\n curveLinear: curveLinear,\n curveMonotoneX: curveMonotoneX,\n curveMonotoneY: curveMonotoneY,\n curveNatural: curveNatural,\n curveStep: curveStep,\n curveStepAfter: curveStepAfter,\n curveStepBefore: curveStepBefore\n};\nvar defined = function defined(p) {\n return p.x === +p.x && p.y === +p.y;\n};\nvar getX = function getX(p) {\n return p.x;\n};\nvar getY = function getY(p) {\n return p.y;\n};\nvar getCurveFactory = function getCurveFactory(type, layout) {\n if (isFunction(type)) {\n return type;\n }\n var name = \"curve\".concat(upperFirst(type));\n if ((name === 'curveMonotone' || name === 'curveBump') && layout) {\n return CURVE_FACTORIES[\"\".concat(name).concat(layout === 'vertical' ? 'Y' : 'X')];\n }\n return CURVE_FACTORIES[name] || curveLinear;\n};\n/**\n * Calculate the path of curve. Returns null if points is an empty array.\n * @return path or null\n */\nexport var getPath = function getPath(_ref) {\n var _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'linear' : _ref$type,\n _ref$points = _ref.points,\n points = _ref$points === void 0 ? [] : _ref$points,\n baseLine = _ref.baseLine,\n layout = _ref.layout,\n _ref$connectNulls = _ref.connectNulls,\n connectNulls = _ref$connectNulls === void 0 ? false : _ref$connectNulls;\n var curveFactory = getCurveFactory(type, layout);\n var formatPoints = connectNulls ? points.filter(function (entry) {\n return defined(entry);\n }) : points;\n var lineFunction;\n if (Array.isArray(baseLine)) {\n var formatBaseLine = connectNulls ? baseLine.filter(function (base) {\n return defined(base);\n }) : baseLine;\n var areaPoints = formatPoints.map(function (entry, index) {\n return _objectSpread(_objectSpread({}, entry), {}, {\n base: formatBaseLine[index]\n });\n });\n if (layout === 'vertical') {\n lineFunction = shapeArea().y(getY).x1(getX).x0(function (d) {\n return d.base.x;\n });\n } else {\n lineFunction = shapeArea().x(getX).y1(getY).y0(function (d) {\n return d.base.y;\n });\n }\n lineFunction.defined(defined).curve(curveFactory);\n return lineFunction(areaPoints);\n }\n if (layout === 'vertical' && isNumber(baseLine)) {\n lineFunction = shapeArea().y(getY).x1(getX).x0(baseLine);\n } else if (isNumber(baseLine)) {\n lineFunction = shapeArea().x(getX).y1(getY).y0(baseLine);\n } else {\n lineFunction = shapeLine().x(getX).y(getY);\n }\n lineFunction.defined(defined).curve(curveFactory);\n return lineFunction(formatPoints);\n};\nexport var Curve = function Curve(props) {\n var className = props.className,\n points = props.points,\n path = props.path,\n pathRef = props.pathRef;\n if ((!points || !points.length) && !path) {\n return null;\n }\n var realPath = points && points.length ? getPath(props) : path;\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(props, false), adaptEventHandlers(props), {\n className: clsx('recharts-curve', className),\n d: realPath,\n ref: pathRef\n }));\n};","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","const { getOwnPropertyNames, getOwnPropertySymbols } = Object;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { hasOwnProperty } = Object.prototype;\n/**\n * Combine two comparators into a single comparators.\n */\nfunction combineComparators(comparatorA, comparatorB) {\n return function isEqual(a, b, state) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nfunction createIsCircular(areItemsEqual) {\n return function isCircular(a, b, state) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n const { cache } = state;\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n cache.set(a, b);\n cache.set(b, a);\n const result = areItemsEqual(a, b, state);\n cache.delete(a);\n cache.delete(b);\n return result;\n };\n}\n/**\n * Get the `@@toStringTag` of the value, if it exists.\n */\nfunction getShortTag(value) {\n return value != null ? value[Symbol.toStringTag] : undefined;\n}\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nfunction getStrictProperties(object) {\n return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));\n}\n/**\n * Whether the object contains the property passed as an own property.\n */\nconst hasOwn = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nObject.hasOwn || ((object, property) => hasOwnProperty.call(object, property));\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nfunction sameValueZeroEqual(a, b) {\n return a === b || (!a && !b && a !== a && b !== b);\n}\n\nconst PREACT_VNODE = '__v';\nconst PREACT_OWNER = '__o';\nconst REACT_OWNER = '_owner';\nconst { getOwnPropertyDescriptor, keys } = Object;\n/**\n * Whether the array buffers are equal in value.\n */\nfunction areArrayBuffersEqual(a, b) {\n return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));\n}\n/**\n * Whether the arrays are equal in value.\n */\nfunction areArraysEqual(a, b, state) {\n let index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the dataviews are equal in value.\n */\nfunction areDataViewsEqual(a, b) {\n return (a.byteLength === b.byteLength\n && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)));\n}\n/**\n * Whether the dates passed are equal in value.\n */\nfunction areDatesEqual(a, b) {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n/**\n * Whether the errors passed are equal in value.\n */\nfunction areErrorsEqual(a, b) {\n return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;\n}\n/**\n * Whether the functions passed are equal in value.\n */\nfunction areFunctionsEqual(a, b) {\n return a === b;\n}\n/**\n * Whether the `Map`s are equal in value.\n */\nfunction areMapsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.entries();\n let aResult;\n let bResult;\n let index = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.entries();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (matchedIndices[matchIndex]) {\n matchIndex++;\n continue;\n }\n const aEntry = aResult.value;\n const bEntry = bResult.value;\n if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)\n && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n index++;\n }\n return true;\n}\n/**\n * Whether the numbers are equal in value.\n */\nconst areNumbersEqual = sameValueZeroEqual;\n/**\n * Whether the objects are equal in value.\n */\nfunction areObjectsEqual(a, b, state) {\n const properties = keys(a);\n let index = properties.length;\n if (keys(b).length !== index) {\n return false;\n }\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isPropertyEqual(a, b, state, properties[index])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nfunction areObjectsEqualStrict(a, b, state) {\n const properties = getStrictProperties(a);\n let index = properties.length;\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n let property;\n let descriptorA;\n let descriptorB;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (!isPropertyEqual(a, b, state, property)) {\n return false;\n }\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n if ((descriptorA || descriptorB)\n && (!descriptorA\n || !descriptorB\n || descriptorA.configurable !== descriptorB.configurable\n || descriptorA.enumerable !== descriptorB.enumerable\n || descriptorA.writable !== descriptorB.writable)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nfunction arePrimitiveWrappersEqual(a, b) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n/**\n * Whether the regexps passed are equal in value.\n */\nfunction areRegExpsEqual(a, b) {\n return a.source === b.source && a.flags === b.flags;\n}\n/**\n * Whether the `Set`s are equal in value.\n */\nfunction areSetsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.values();\n let aResult;\n let bResult;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.values();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (!matchedIndices[matchIndex]\n && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the TypedArray instances are equal in value.\n */\nfunction areTypedArraysEqual(a, b) {\n let index = a.byteLength;\n if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {\n return false;\n }\n while (index-- > 0) {\n if (a[index] !== b[index]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the URL instances are equal in value.\n */\nfunction areUrlsEqual(a, b) {\n return (a.hostname === b.hostname\n && a.pathname === b.pathname\n && a.protocol === b.protocol\n && a.port === b.port\n && a.hash === b.hash\n && a.username === b.username\n && a.password === b.password);\n}\nfunction isPropertyEqual(a, b, state, property) {\n if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)\n && (a.$$typeof || b.$$typeof)) {\n return true;\n }\n return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);\n}\n\nconst ARRAY_BUFFER_TAG = '[object ArrayBuffer]';\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATA_VIEW_TAG = '[object DataView]';\nconst DATE_TAG = '[object Date]';\nconst ERROR_TAG = '[object Error]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\nconst TYPED_ARRAY_TAGS = {\n '[object Int8Array]': true,\n '[object Uint8Array]': true,\n '[object Uint8ClampedArray]': true,\n '[object Int16Array]': true,\n '[object Uint16Array]': true,\n '[object Int32Array]': true,\n '[object Uint32Array]': true,\n '[object Float16Array]': true,\n '[object Float32Array]': true,\n '[object Float64Array]': true,\n '[object BigInt64Array]': true,\n '[object BigUint64Array]': true,\n};\nconst URL_TAG = '[object URL]';\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toString = Object.prototype.toString;\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nfunction createEqualityComparator({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, unknownTagComparators, }) {\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a, b, state) {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n // If either of the items are nullish and fail the strictly equal check\n // above, then they must be unequal.\n if (a == null || b == null) {\n return false;\n }\n const type = typeof a;\n if (type !== typeof b) {\n return false;\n }\n if (type !== 'object') {\n if (type === 'number') {\n return areNumbersEqual(a, b, state);\n }\n if (type === 'function') {\n return areFunctionsEqual(a, b, state);\n }\n // If a primitive value that is not strictly equal, it must be unequal.\n return false;\n }\n const constructor = a.constructor;\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n // Constructors should match, otherwise there is potential for false positives\n // between class and subclass or custom object and POJO.\n if (constructor !== b.constructor) {\n return false;\n }\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid capturing the string tag.\n if (constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n // the string tag or doing an `instanceof` check.\n if (Array.isArray(a)) {\n return areArraysEqual(a, b, state);\n }\n // Try to fast-path equality checks for other complex object types in the\n // same realm to avoid capturing the string tag. Strict equality is used\n // instead of `instanceof` because it is more performant for the common\n // use-case. If someone is subclassing a native class, it will be handled\n // with the string tag comparison.\n if (constructor === Date) {\n return areDatesEqual(a, b, state);\n }\n if (constructor === RegExp) {\n return areRegExpsEqual(a, b, state);\n }\n if (constructor === Map) {\n return areMapsEqual(a, b, state);\n }\n if (constructor === Set) {\n return areSetsEqual(a, b, state);\n }\n // Since this is a custom object, capture the string tag to determing its type.\n // This is reasonably performant in modern environments like v8 and SpiderMonkey.\n const tag = toString.call(a);\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n // For RegExp, the properties are not enumerable, and therefore will give false positives if\n // tested like a standard object.\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is custom `Promise`-like class instances. These should\n // be treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state);\n }\n // If a URL tag, it should be tested explicitly. Like RegExp, the properties are not\n // enumerable, and therefore will give false positives if tested like a standard object.\n if (tag === URL_TAG) {\n return areUrlsEqual(a, b, state);\n }\n // If an error tag, it should be tested explicitly. Like RegExp, the properties are not\n // enumerable, and therefore will give false positives if tested like a standard object.\n if (tag === ERROR_TAG) {\n return areErrorsEqual(a, b, state);\n }\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n if (TYPED_ARRAY_TAGS[tag]) {\n return areTypedArraysEqual(a, b, state);\n }\n if (tag === ARRAY_BUFFER_TAG) {\n return areArrayBuffersEqual(a, b, state);\n }\n if (tag === DATA_VIEW_TAG) {\n return areDataViewsEqual(a, b, state);\n }\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n if (unknownTagComparators) {\n let unknownTagComparator = unknownTagComparators[tag];\n if (!unknownTagComparator) {\n const shortTag = getShortTag(a);\n if (shortTag) {\n unknownTagComparator = unknownTagComparators[shortTag];\n }\n }\n // If the custom config has an unknown tag comparator that matches the captured tag or the\n // @@toStringTag, it is the source of truth for whether the values are equal.\n if (unknownTagComparator) {\n return unknownTagComparator(a, b, state);\n }\n }\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n/**\n * Create the configuration object used for building comparators.\n */\nfunction createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {\n let config = {\n areArrayBuffersEqual,\n areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,\n areDataViewsEqual,\n areDatesEqual: areDatesEqual,\n areErrorsEqual: areErrorsEqual,\n areFunctionsEqual: areFunctionsEqual,\n areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,\n areNumbersEqual: areNumbersEqual,\n areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,\n areRegExpsEqual: areRegExpsEqual,\n areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,\n areTypedArraysEqual: strict\n ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)\n : areTypedArraysEqual,\n areUrlsEqual: areUrlsEqual,\n unknownTagComparators: undefined,\n };\n if (createCustomConfig) {\n config = Object.assign({}, config, createCustomConfig(config));\n }\n if (circular) {\n const areArraysEqual = createIsCircular(config.areArraysEqual);\n const areMapsEqual = createIsCircular(config.areMapsEqual);\n const areObjectsEqual = createIsCircular(config.areObjectsEqual);\n const areSetsEqual = createIsCircular(config.areSetsEqual);\n config = Object.assign({}, config, {\n areArraysEqual,\n areMapsEqual,\n areObjectsEqual,\n areSetsEqual,\n });\n }\n return config;\n}\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nfunction createInternalEqualityComparator(compare) {\n return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {\n return compare(a, b, state);\n };\n}\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nfunction createIsEqual({ circular, comparator, createState, equals, strict }) {\n if (createState) {\n return function isEqual(a, b) {\n const { cache = circular ? new WeakMap() : undefined, meta } = createState();\n return comparator(a, b, {\n cache,\n equals,\n meta,\n strict,\n });\n };\n }\n if (circular) {\n return function isEqual(a, b) {\n return comparator(a, b, {\n cache: new WeakMap(),\n equals,\n meta: undefined,\n strict,\n });\n };\n }\n const state = {\n cache: undefined,\n equals,\n meta: undefined,\n strict,\n };\n return function isEqual(a, b) {\n return comparator(a, b, state);\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nconst deepEqual = createCustomEqual();\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nconst strictDeepEqual = createCustomEqual({ strict: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nconst circularDeepEqual = createCustomEqual({ circular: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nconst shallowEqual = createCustomEqual({\n createInternalComparator: () => sameValueZeroEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nconst strictShallowEqual = createCustomEqual({\n strict: true,\n createInternalComparator: () => sameValueZeroEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nconst circularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueZeroEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueZeroEqual,\n strict: true,\n});\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nfunction createCustomEqual(options = {}) {\n const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;\n const config = createEqualityComparatorConfig(options);\n const comparator = createEqualityComparator(config);\n const equals = createCustomInternalComparator\n ? createCustomInternalComparator(comparator)\n : createInternalEqualityComparator(comparator);\n return createIsEqual({ circular, comparator, createState, equals, strict });\n}\n\nexport { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictShallowEqual };\n//# sourceMappingURL=index.mjs.map\n","function safeRequestAnimationFrame(callback) {\n if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);\n}\nexport default function setRafTimeout(callback) {\n var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var currTime = -1;\n var shouldUpdate = function shouldUpdate(now) {\n if (currTime < 0) {\n currTime = now;\n }\n if (now - currTime > timeout) {\n callback(now);\n currTime = -1;\n } else {\n safeRequestAnimationFrame(shouldUpdate);\n }\n };\n requestAnimationFrame(shouldUpdate);\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport setRafTimeout from './setRafTimeout';\nexport default function createAnimateManager() {\n var currStyle = {};\n var handleChange = function handleChange() {\n return null;\n };\n var shouldStop = false;\n var setStyle = function setStyle(_style) {\n if (shouldStop) {\n return;\n }\n if (Array.isArray(_style)) {\n if (!_style.length) {\n return;\n }\n var styles = _style;\n var _styles = _toArray(styles),\n curr = _styles[0],\n restStyles = _styles.slice(1);\n if (typeof curr === 'number') {\n setRafTimeout(setStyle.bind(null, restStyles), curr);\n return;\n }\n setStyle(curr);\n setRafTimeout(setStyle.bind(null, restStyles));\n return;\n }\n if (_typeof(_style) === 'object') {\n currStyle = _style;\n handleChange(currStyle);\n }\n if (typeof _style === 'function') {\n _style();\n }\n };\n return {\n stop: function stop() {\n shouldStop = true;\n },\n start: function start(style) {\n shouldStop = false;\n setStyle(style);\n },\n subscribe: function subscribe(_handleChange) {\n handleChange = _handleChange;\n return function () {\n handleChange = function handleChange() {\n return null;\n };\n };\n }\n };\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/* eslint no-console: 0 */\n\nexport var getIntersectionKeys = function getIntersectionKeys(preObj, nextObj) {\n return [Object.keys(preObj), Object.keys(nextObj)].reduce(function (a, b) {\n return a.filter(function (c) {\n return b.includes(c);\n });\n });\n};\nexport var identity = function identity(param) {\n return param;\n};\n\n/*\n * @description: convert camel case to dash case\n * string => string\n */\nexport var getDashCase = function getDashCase(name) {\n return name.replace(/([A-Z])/g, function (v) {\n return \"-\".concat(v.toLowerCase());\n });\n};\nexport var log = function log() {\n var _console;\n (_console = console).log.apply(_console, arguments);\n};\n\n/*\n * @description: log the value of a varible\n * string => any => any\n */\nexport var debug = function debug(name) {\n return function (item) {\n log(name, item);\n return item;\n };\n};\n\n/*\n * @description: log name, args, return value of a function\n * function => function\n */\nexport var debugf = function debugf(tag, f) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var res = f.apply(void 0, args);\n var name = tag || f.name || 'anonymous function';\n var argNames = \"(\".concat(args.map(JSON.stringify).join(', '), \")\");\n log(\"\".concat(name, \": \").concat(argNames, \" => \").concat(JSON.stringify(res)));\n return res;\n };\n};\n\n/*\n * @description: map object on every element in this object.\n * (function, object) => object\n */\nexport var mapObject = function mapObject(fn, obj) {\n return Object.keys(obj).reduce(function (res, key) {\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, fn(key, obj[key])));\n }, {});\n};\nexport var getTransitionVal = function getTransitionVal(props, duration, easing) {\n return props.map(function (prop) {\n return \"\".concat(getDashCase(prop), \" \").concat(duration, \"ms \").concat(easing);\n }).join(',');\n};\nvar isDev = process.env.NODE_ENV !== 'production';\nexport var warn = function warn(condition, format, a, b, c, d, e, f) {\n if (isDev && typeof console !== 'undefined' && console.warn) {\n if (format === undefined) {\n console.warn('LogUtils requires an error message argument');\n }\n if (!condition) {\n if (format === undefined) {\n console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n console.warn(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n }\n }\n }\n};","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nimport { warn } from './util';\nvar ACCURACY = 1e-4;\nvar cubicBezierFactor = function cubicBezierFactor(c1, c2) {\n return [0, 3 * c1, 3 * c2 - 6 * c1, 3 * c1 - 3 * c2 + 1];\n};\nvar multyTime = function multyTime(params, t) {\n return params.map(function (param, i) {\n return param * Math.pow(t, i);\n }).reduce(function (pre, curr) {\n return pre + curr;\n });\n};\nvar cubicBezier = function cubicBezier(c1, c2) {\n return function (t) {\n var params = cubicBezierFactor(c1, c2);\n return multyTime(params, t);\n };\n};\nvar derivativeCubicBezier = function derivativeCubicBezier(c1, c2) {\n return function (t) {\n var params = cubicBezierFactor(c1, c2);\n var newParams = [].concat(_toConsumableArray(params.map(function (param, i) {\n return param * i;\n }).slice(1)), [0]);\n return multyTime(newParams, t);\n };\n};\n\n// calculate cubic-bezier using Newton's method\nexport var configBezier = function configBezier() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var x1 = args[0],\n y1 = args[1],\n x2 = args[2],\n y2 = args[3];\n if (args.length === 1) {\n switch (args[0]) {\n case 'linear':\n x1 = 0.0;\n y1 = 0.0;\n x2 = 1.0;\n y2 = 1.0;\n break;\n case 'ease':\n x1 = 0.25;\n y1 = 0.1;\n x2 = 0.25;\n y2 = 1.0;\n break;\n case 'ease-in':\n x1 = 0.42;\n y1 = 0.0;\n x2 = 1.0;\n y2 = 1.0;\n break;\n case 'ease-out':\n x1 = 0.42;\n y1 = 0.0;\n x2 = 0.58;\n y2 = 1.0;\n break;\n case 'ease-in-out':\n x1 = 0.0;\n y1 = 0.0;\n x2 = 0.58;\n y2 = 1.0;\n break;\n default:\n {\n var easing = args[0].split('(');\n if (easing[0] === 'cubic-bezier' && easing[1].split(')')[0].split(',').length === 4) {\n var _easing$1$split$0$spl = easing[1].split(')')[0].split(',').map(function (x) {\n return parseFloat(x);\n });\n var _easing$1$split$0$spl2 = _slicedToArray(_easing$1$split$0$spl, 4);\n x1 = _easing$1$split$0$spl2[0];\n y1 = _easing$1$split$0$spl2[1];\n x2 = _easing$1$split$0$spl2[2];\n y2 = _easing$1$split$0$spl2[3];\n } else {\n warn(false, '[configBezier]: arguments should be one of ' + \"oneOf 'linear', 'ease', 'ease-in', 'ease-out', \" + \"'ease-in-out','cubic-bezier(x1,y1,x2,y2)', instead received %s\", args);\n }\n }\n }\n }\n warn([x1, x2, y1, y2].every(function (num) {\n return typeof num === 'number' && num >= 0 && num <= 1;\n }), '[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s', args);\n var curveX = cubicBezier(x1, x2);\n var curveY = cubicBezier(y1, y2);\n var derCurveX = derivativeCubicBezier(x1, x2);\n var rangeValue = function rangeValue(value) {\n if (value > 1) {\n return 1;\n }\n if (value < 0) {\n return 0;\n }\n return value;\n };\n var bezier = function bezier(_t) {\n var t = _t > 1 ? 1 : _t;\n var x = t;\n for (var i = 0; i < 8; ++i) {\n var evalT = curveX(x) - t;\n var derVal = derCurveX(x);\n if (Math.abs(evalT - t) < ACCURACY || derVal < ACCURACY) {\n return curveY(x);\n }\n x = rangeValue(x - evalT / derVal);\n }\n return curveY(x);\n };\n bezier.isStepper = false;\n return bezier;\n};\nexport var configSpring = function configSpring() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _config$stiff = config.stiff,\n stiff = _config$stiff === void 0 ? 100 : _config$stiff,\n _config$damping = config.damping,\n damping = _config$damping === void 0 ? 8 : _config$damping,\n _config$dt = config.dt,\n dt = _config$dt === void 0 ? 17 : _config$dt;\n var stepper = function stepper(currX, destX, currV) {\n var FSpring = -(currX - destX) * stiff;\n var FDamping = currV * damping;\n var newV = currV + (FSpring - FDamping) * dt / 1000;\n var newX = currV * dt / 1000 + currX;\n if (Math.abs(newX - destX) < ACCURACY && Math.abs(newV) < ACCURACY) {\n return [destX, 0];\n }\n return [newX, newV];\n };\n stepper.isStepper = true;\n stepper.dt = dt;\n return stepper;\n};\nexport var configEasing = function configEasing() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n var easing = args[0];\n if (typeof easing === 'string') {\n switch (easing) {\n case 'ease':\n case 'ease-in-out':\n case 'ease-out':\n case 'ease-in':\n case 'linear':\n return configBezier(easing);\n case 'spring':\n return configSpring();\n default:\n if (easing.split('(')[0] === 'cubic-bezier') {\n return configBezier(easing);\n }\n warn(false, \"[configEasing]: first argument should be one of 'ease', 'ease-in', \" + \"'ease-out', 'ease-in-out','cubic-bezier(x1,y1,x2,y2)', 'linear' and 'spring', instead received %s\", args);\n }\n }\n if (typeof easing === 'function') {\n return easing;\n }\n warn(false, '[configEasing]: first argument type should be function or string, instead received %s', args);\n return null;\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport { getIntersectionKeys, mapObject } from './util';\nvar alpha = function alpha(begin, end, k) {\n return begin + (end - begin) * k;\n};\nvar needContinue = function needContinue(_ref) {\n var from = _ref.from,\n to = _ref.to;\n return from !== to;\n};\n\n/*\n * @description: cal new from value and velocity in each stepper\n * @return: { [styleProperty]: { from, to, velocity } }\n */\nvar calStepperVals = function calStepperVals(easing, preVals, steps) {\n var nextStepVals = mapObject(function (key, val) {\n if (needContinue(val)) {\n var _easing = easing(val.from, val.to, val.velocity),\n _easing2 = _slicedToArray(_easing, 2),\n newX = _easing2[0],\n newV = _easing2[1];\n return _objectSpread(_objectSpread({}, val), {}, {\n from: newX,\n velocity: newV\n });\n }\n return val;\n }, preVals);\n if (steps < 1) {\n return mapObject(function (key, val) {\n if (needContinue(val)) {\n return _objectSpread(_objectSpread({}, val), {}, {\n velocity: alpha(val.velocity, nextStepVals[key].velocity, steps),\n from: alpha(val.from, nextStepVals[key].from, steps)\n });\n }\n return val;\n }, preVals);\n }\n return calStepperVals(easing, nextStepVals, steps - 1);\n};\n\n// configure update function\nexport default (function (from, to, easing, duration, render) {\n var interKeys = getIntersectionKeys(from, to);\n var timingStyle = interKeys.reduce(function (res, key) {\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, [from[key], to[key]]));\n }, {});\n var stepperStyle = interKeys.reduce(function (res, key) {\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, {\n from: from[key],\n velocity: 0,\n to: to[key]\n }));\n }, {});\n var cafId = -1;\n var preTime;\n var beginTime;\n var update = function update() {\n return null;\n };\n var getCurrStyle = function getCurrStyle() {\n return mapObject(function (key, val) {\n return val.from;\n }, stepperStyle);\n };\n var shouldStopAnimation = function shouldStopAnimation() {\n return !Object.values(stepperStyle).filter(needContinue).length;\n };\n\n // stepper timing function like spring\n var stepperUpdate = function stepperUpdate(now) {\n if (!preTime) {\n preTime = now;\n }\n var deltaTime = now - preTime;\n var steps = deltaTime / easing.dt;\n stepperStyle = calStepperVals(easing, stepperStyle, steps);\n // get union set and add compatible prefix\n render(_objectSpread(_objectSpread(_objectSpread({}, from), to), getCurrStyle(stepperStyle)));\n preTime = now;\n if (!shouldStopAnimation()) {\n cafId = requestAnimationFrame(update);\n }\n };\n\n // t => val timing function like cubic-bezier\n var timingUpdate = function timingUpdate(now) {\n if (!beginTime) {\n beginTime = now;\n }\n var t = (now - beginTime) / duration;\n var currStyle = mapObject(function (key, val) {\n return alpha.apply(void 0, _toConsumableArray(val).concat([easing(t)]));\n }, timingStyle);\n\n // get union set and add compatible prefix\n render(_objectSpread(_objectSpread(_objectSpread({}, from), to), currStyle));\n if (t < 1) {\n cafId = requestAnimationFrame(update);\n } else {\n var finalStyle = mapObject(function (key, val) {\n return alpha.apply(void 0, _toConsumableArray(val).concat([easing(1)]));\n }, timingStyle);\n render(_objectSpread(_objectSpread(_objectSpread({}, from), to), finalStyle));\n }\n };\n update = easing.isStepper ? stepperUpdate : timingUpdate;\n\n // return start animation method\n return function () {\n requestAnimationFrame(update);\n\n // return stop animation method\n return function () {\n cancelAnimationFrame(cafId);\n };\n };\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"children\", \"begin\", \"duration\", \"attributeName\", \"easing\", \"isActive\", \"steps\", \"from\", \"to\", \"canBegin\", \"onAnimationEnd\", \"shouldReAnimate\", \"onAnimationReStart\"];\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nimport React, { PureComponent, cloneElement, Children } from 'react';\nimport PropTypes from 'prop-types';\nimport { deepEqual } from 'fast-equals';\nimport createAnimateManager from './AnimateManager';\nimport { configEasing } from './easing';\nimport configUpdate from './configUpdate';\nimport { getTransitionVal, identity } from './util';\nvar Animate = /*#__PURE__*/function (_PureComponent) {\n _inherits(Animate, _PureComponent);\n var _super = _createSuper(Animate);\n function Animate(props, context) {\n var _this;\n _classCallCheck(this, Animate);\n _this = _super.call(this, props, context);\n var _this$props = _this.props,\n isActive = _this$props.isActive,\n attributeName = _this$props.attributeName,\n from = _this$props.from,\n to = _this$props.to,\n steps = _this$props.steps,\n children = _this$props.children,\n duration = _this$props.duration;\n _this.handleStyleChange = _this.handleStyleChange.bind(_assertThisInitialized(_this));\n _this.changeStyle = _this.changeStyle.bind(_assertThisInitialized(_this));\n if (!isActive || duration <= 0) {\n _this.state = {\n style: {}\n };\n\n // if children is a function and animation is not active, set style to 'to'\n if (typeof children === 'function') {\n _this.state = {\n style: to\n };\n }\n return _possibleConstructorReturn(_this);\n }\n if (steps && steps.length) {\n _this.state = {\n style: steps[0].style\n };\n } else if (from) {\n if (typeof children === 'function') {\n _this.state = {\n style: from\n };\n return _possibleConstructorReturn(_this);\n }\n _this.state = {\n style: attributeName ? _defineProperty({}, attributeName, from) : from\n };\n } else {\n _this.state = {\n style: {}\n };\n }\n return _this;\n }\n _createClass(Animate, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this$props2 = this.props,\n isActive = _this$props2.isActive,\n canBegin = _this$props2.canBegin;\n this.mounted = true;\n if (!isActive || !canBegin) {\n return;\n }\n this.runAnimation(this.props);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var _this$props3 = this.props,\n isActive = _this$props3.isActive,\n canBegin = _this$props3.canBegin,\n attributeName = _this$props3.attributeName,\n shouldReAnimate = _this$props3.shouldReAnimate,\n to = _this$props3.to,\n currentFrom = _this$props3.from;\n var style = this.state.style;\n if (!canBegin) {\n return;\n }\n if (!isActive) {\n var newState = {\n style: attributeName ? _defineProperty({}, attributeName, to) : to\n };\n if (this.state && style) {\n if (attributeName && style[attributeName] !== to || !attributeName && style !== to) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState(newState);\n }\n }\n return;\n }\n if (deepEqual(prevProps.to, to) && prevProps.canBegin && prevProps.isActive) {\n return;\n }\n var isTriggered = !prevProps.canBegin || !prevProps.isActive;\n if (this.manager) {\n this.manager.stop();\n }\n if (this.stopJSAnimation) {\n this.stopJSAnimation();\n }\n var from = isTriggered || shouldReAnimate ? currentFrom : prevProps.to;\n if (this.state && style) {\n var _newState = {\n style: attributeName ? _defineProperty({}, attributeName, from) : from\n };\n if (attributeName && style[attributeName] !== from || !attributeName && style !== from) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState(_newState);\n }\n }\n this.runAnimation(_objectSpread(_objectSpread({}, this.props), {}, {\n from: from,\n begin: 0\n }));\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.mounted = false;\n var onAnimationEnd = this.props.onAnimationEnd;\n if (this.unSubscribe) {\n this.unSubscribe();\n }\n if (this.manager) {\n this.manager.stop();\n this.manager = null;\n }\n if (this.stopJSAnimation) {\n this.stopJSAnimation();\n }\n if (onAnimationEnd) {\n onAnimationEnd();\n }\n }\n }, {\n key: \"handleStyleChange\",\n value: function handleStyleChange(style) {\n this.changeStyle(style);\n }\n }, {\n key: \"changeStyle\",\n value: function changeStyle(style) {\n if (this.mounted) {\n this.setState({\n style: style\n });\n }\n }\n }, {\n key: \"runJSAnimation\",\n value: function runJSAnimation(props) {\n var _this2 = this;\n var from = props.from,\n to = props.to,\n duration = props.duration,\n easing = props.easing,\n begin = props.begin,\n onAnimationEnd = props.onAnimationEnd,\n onAnimationStart = props.onAnimationStart;\n var startAnimation = configUpdate(from, to, configEasing(easing), duration, this.changeStyle);\n var finalStartAnimation = function finalStartAnimation() {\n _this2.stopJSAnimation = startAnimation();\n };\n this.manager.start([onAnimationStart, begin, finalStartAnimation, duration, onAnimationEnd]);\n }\n }, {\n key: \"runStepAnimation\",\n value: function runStepAnimation(props) {\n var _this3 = this;\n var steps = props.steps,\n begin = props.begin,\n onAnimationStart = props.onAnimationStart;\n var _steps$ = steps[0],\n initialStyle = _steps$.style,\n _steps$$duration = _steps$.duration,\n initialTime = _steps$$duration === void 0 ? 0 : _steps$$duration;\n var addStyle = function addStyle(sequence, nextItem, index) {\n if (index === 0) {\n return sequence;\n }\n var duration = nextItem.duration,\n _nextItem$easing = nextItem.easing,\n easing = _nextItem$easing === void 0 ? 'ease' : _nextItem$easing,\n style = nextItem.style,\n nextProperties = nextItem.properties,\n onAnimationEnd = nextItem.onAnimationEnd;\n var preItem = index > 0 ? steps[index - 1] : nextItem;\n var properties = nextProperties || Object.keys(style);\n if (typeof easing === 'function' || easing === 'spring') {\n return [].concat(_toConsumableArray(sequence), [_this3.runJSAnimation.bind(_this3, {\n from: preItem.style,\n to: style,\n duration: duration,\n easing: easing\n }), duration]);\n }\n var transition = getTransitionVal(properties, duration, easing);\n var newStyle = _objectSpread(_objectSpread(_objectSpread({}, preItem.style), style), {}, {\n transition: transition\n });\n return [].concat(_toConsumableArray(sequence), [newStyle, duration, onAnimationEnd]).filter(identity);\n };\n return this.manager.start([onAnimationStart].concat(_toConsumableArray(steps.reduce(addStyle, [initialStyle, Math.max(initialTime, begin)])), [props.onAnimationEnd]));\n }\n }, {\n key: \"runAnimation\",\n value: function runAnimation(props) {\n if (!this.manager) {\n this.manager = createAnimateManager();\n }\n var begin = props.begin,\n duration = props.duration,\n attributeName = props.attributeName,\n propsTo = props.to,\n easing = props.easing,\n onAnimationStart = props.onAnimationStart,\n onAnimationEnd = props.onAnimationEnd,\n steps = props.steps,\n children = props.children;\n var manager = this.manager;\n this.unSubscribe = manager.subscribe(this.handleStyleChange);\n if (typeof easing === 'function' || typeof children === 'function' || easing === 'spring') {\n this.runJSAnimation(props);\n return;\n }\n if (steps.length > 1) {\n this.runStepAnimation(props);\n return;\n }\n var to = attributeName ? _defineProperty({}, attributeName, propsTo) : propsTo;\n var transition = getTransitionVal(Object.keys(to), duration, easing);\n manager.start([onAnimationStart, begin, _objectSpread(_objectSpread({}, to), {}, {\n transition: transition\n }), duration, onAnimationEnd]);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props4 = this.props,\n children = _this$props4.children,\n begin = _this$props4.begin,\n duration = _this$props4.duration,\n attributeName = _this$props4.attributeName,\n easing = _this$props4.easing,\n isActive = _this$props4.isActive,\n steps = _this$props4.steps,\n from = _this$props4.from,\n to = _this$props4.to,\n canBegin = _this$props4.canBegin,\n onAnimationEnd = _this$props4.onAnimationEnd,\n shouldReAnimate = _this$props4.shouldReAnimate,\n onAnimationReStart = _this$props4.onAnimationReStart,\n others = _objectWithoutProperties(_this$props4, _excluded);\n var count = Children.count(children);\n // eslint-disable-next-line react/destructuring-assignment\n var stateStyle = this.state.style;\n if (typeof children === 'function') {\n return children(stateStyle);\n }\n if (!isActive || count === 0 || duration <= 0) {\n return children;\n }\n var cloneContainer = function cloneContainer(container) {\n var _container$props = container.props,\n _container$props$styl = _container$props.style,\n style = _container$props$styl === void 0 ? {} : _container$props$styl,\n className = _container$props.className;\n var res = /*#__PURE__*/cloneElement(container, _objectSpread(_objectSpread({}, others), {}, {\n style: _objectSpread(_objectSpread({}, style), stateStyle),\n className: className\n }));\n return res;\n };\n if (count === 1) {\n return cloneContainer(Children.only(children));\n }\n return /*#__PURE__*/React.createElement(\"div\", null, Children.map(children, function (child) {\n return cloneContainer(child);\n }));\n }\n }]);\n return Animate;\n}(PureComponent);\nAnimate.displayName = 'Animate';\nAnimate.defaultProps = {\n begin: 0,\n duration: 1000,\n from: '',\n to: '',\n attributeName: '',\n easing: 'ease',\n isActive: true,\n canBegin: true,\n steps: [],\n onAnimationEnd: function onAnimationEnd() {},\n onAnimationStart: function onAnimationStart() {}\n};\nAnimate.propTypes = {\n from: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n to: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n attributeName: PropTypes.string,\n // animation duration\n duration: PropTypes.number,\n begin: PropTypes.number,\n easing: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n steps: PropTypes.arrayOf(PropTypes.shape({\n duration: PropTypes.number.isRequired,\n style: PropTypes.object.isRequired,\n easing: PropTypes.oneOfType([PropTypes.oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']), PropTypes.func]),\n // transition css properties(dash case), optional\n properties: PropTypes.arrayOf('string'),\n onAnimationEnd: PropTypes.func\n })),\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n isActive: PropTypes.bool,\n canBegin: PropTypes.bool,\n onAnimationEnd: PropTypes.func,\n // decide if it should reanimate with initial from style when props change\n shouldReAnimate: PropTypes.bool,\n onAnimationStart: PropTypes.func,\n onAnimationReStart: PropTypes.func\n};\nexport default Animate;","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Rectangle\n */\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport Animate from 'react-smooth';\nimport { filterProps } from '../util/ReactUtils';\nvar getRectanglePath = function getRectanglePath(x, y, width, height, radius) {\n var maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2);\n var ySign = height >= 0 ? 1 : -1;\n var xSign = width >= 0 ? 1 : -1;\n var clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0;\n var path;\n if (maxRadius > 0 && radius instanceof Array) {\n var newRadius = [0, 0, 0, 0];\n for (var i = 0, len = 4; i < len; i++) {\n newRadius[i] = radius[i] > maxRadius ? maxRadius : radius[i];\n }\n path = \"M\".concat(x, \",\").concat(y + ySign * newRadius[0]);\n if (newRadius[0] > 0) {\n path += \"A \".concat(newRadius[0], \",\").concat(newRadius[0], \",0,0,\").concat(clockWise, \",\").concat(x + xSign * newRadius[0], \",\").concat(y);\n }\n path += \"L \".concat(x + width - xSign * newRadius[1], \",\").concat(y);\n if (newRadius[1] > 0) {\n path += \"A \".concat(newRadius[1], \",\").concat(newRadius[1], \",0,0,\").concat(clockWise, \",\\n \").concat(x + width, \",\").concat(y + ySign * newRadius[1]);\n }\n path += \"L \".concat(x + width, \",\").concat(y + height - ySign * newRadius[2]);\n if (newRadius[2] > 0) {\n path += \"A \".concat(newRadius[2], \",\").concat(newRadius[2], \",0,0,\").concat(clockWise, \",\\n \").concat(x + width - xSign * newRadius[2], \",\").concat(y + height);\n }\n path += \"L \".concat(x + xSign * newRadius[3], \",\").concat(y + height);\n if (newRadius[3] > 0) {\n path += \"A \".concat(newRadius[3], \",\").concat(newRadius[3], \",0,0,\").concat(clockWise, \",\\n \").concat(x, \",\").concat(y + height - ySign * newRadius[3]);\n }\n path += 'Z';\n } else if (maxRadius > 0 && radius === +radius && radius > 0) {\n var _newRadius = Math.min(maxRadius, radius);\n path = \"M \".concat(x, \",\").concat(y + ySign * _newRadius, \"\\n A \").concat(_newRadius, \",\").concat(_newRadius, \",0,0,\").concat(clockWise, \",\").concat(x + xSign * _newRadius, \",\").concat(y, \"\\n L \").concat(x + width - xSign * _newRadius, \",\").concat(y, \"\\n A \").concat(_newRadius, \",\").concat(_newRadius, \",0,0,\").concat(clockWise, \",\").concat(x + width, \",\").concat(y + ySign * _newRadius, \"\\n L \").concat(x + width, \",\").concat(y + height - ySign * _newRadius, \"\\n A \").concat(_newRadius, \",\").concat(_newRadius, \",0,0,\").concat(clockWise, \",\").concat(x + width - xSign * _newRadius, \",\").concat(y + height, \"\\n L \").concat(x + xSign * _newRadius, \",\").concat(y + height, \"\\n A \").concat(_newRadius, \",\").concat(_newRadius, \",0,0,\").concat(clockWise, \",\").concat(x, \",\").concat(y + height - ySign * _newRadius, \" Z\");\n } else {\n path = \"M \".concat(x, \",\").concat(y, \" h \").concat(width, \" v \").concat(height, \" h \").concat(-width, \" Z\");\n }\n return path;\n};\nexport var isInRectangle = function isInRectangle(point, rect) {\n if (!point || !rect) {\n return false;\n }\n var px = point.x,\n py = point.y;\n var x = rect.x,\n y = rect.y,\n width = rect.width,\n height = rect.height;\n if (Math.abs(width) > 0 && Math.abs(height) > 0) {\n var minX = Math.min(x, x + width);\n var maxX = Math.max(x, x + width);\n var minY = Math.min(y, y + height);\n var maxY = Math.max(y, y + height);\n return px >= minX && px <= maxX && py >= minY && py <= maxY;\n }\n return false;\n};\nvar defaultProps = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n // The radius of border\n // The radius of four corners when radius is a number\n // The radius of left-top, right-top, right-bottom, left-bottom when radius is an array\n radius: 0,\n isAnimationActive: false,\n isUpdateAnimationActive: false,\n animationBegin: 0,\n animationDuration: 1500,\n animationEasing: 'ease'\n};\nexport var Rectangle = function Rectangle(rectangleProps) {\n var props = _objectSpread(_objectSpread({}, defaultProps), rectangleProps);\n var pathRef = useRef();\n var _useState = useState(-1),\n _useState2 = _slicedToArray(_useState, 2),\n totalLength = _useState2[0],\n setTotalLength = _useState2[1];\n useEffect(function () {\n if (pathRef.current && pathRef.current.getTotalLength) {\n try {\n var pathTotalLength = pathRef.current.getTotalLength();\n if (pathTotalLength) {\n setTotalLength(pathTotalLength);\n }\n } catch (err) {\n // calculate total length error\n }\n }\n }, []);\n var x = props.x,\n y = props.y,\n width = props.width,\n height = props.height,\n radius = props.radius,\n className = props.className;\n var animationEasing = props.animationEasing,\n animationDuration = props.animationDuration,\n animationBegin = props.animationBegin,\n isAnimationActive = props.isAnimationActive,\n isUpdateAnimationActive = props.isUpdateAnimationActive;\n if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) {\n return null;\n }\n var layerClass = clsx('recharts-rectangle', className);\n if (!isUpdateAnimationActive) {\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(props, true), {\n className: layerClass,\n d: getRectanglePath(x, y, width, height, radius)\n }));\n }\n return /*#__PURE__*/React.createElement(Animate, {\n canBegin: totalLength > 0,\n from: {\n width: width,\n height: height,\n x: x,\n y: y\n },\n to: {\n width: width,\n height: height,\n x: x,\n y: y\n },\n duration: animationDuration,\n animationEasing: animationEasing,\n isActive: isUpdateAnimationActive\n }, function (_ref) {\n var currWidth = _ref.width,\n currHeight = _ref.height,\n currX = _ref.x,\n currY = _ref.y;\n return /*#__PURE__*/React.createElement(Animate, {\n canBegin: totalLength > 0,\n from: \"0px \".concat(totalLength === -1 ? 1 : totalLength, \"px\"),\n to: \"\".concat(totalLength, \"px 0px\"),\n attributeName: \"strokeDasharray\",\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing\n }, /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(props, true), {\n className: layerClass,\n d: getRectanglePath(currX, currY, currWidth, currHeight, radius),\n ref: pathRef\n })));\n });\n};","var _excluded = [\"points\", \"className\", \"baseLinePoints\", \"connectNulls\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\n/**\n * @fileOverview Polygon\n */\nimport React from 'react';\nimport clsx from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nvar isValidatePoint = function isValidatePoint(point) {\n return point && point.x === +point.x && point.y === +point.y;\n};\nvar getParsedPoints = function getParsedPoints() {\n var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var segmentPoints = [[]];\n points.forEach(function (entry) {\n if (isValidatePoint(entry)) {\n segmentPoints[segmentPoints.length - 1].push(entry);\n } else if (segmentPoints[segmentPoints.length - 1].length > 0) {\n // add another path\n segmentPoints.push([]);\n }\n });\n if (isValidatePoint(points[0])) {\n segmentPoints[segmentPoints.length - 1].push(points[0]);\n }\n if (segmentPoints[segmentPoints.length - 1].length <= 0) {\n segmentPoints = segmentPoints.slice(0, -1);\n }\n return segmentPoints;\n};\nvar getSinglePolygonPath = function getSinglePolygonPath(points, connectNulls) {\n var segmentPoints = getParsedPoints(points);\n if (connectNulls) {\n segmentPoints = [segmentPoints.reduce(function (res, segPoints) {\n return [].concat(_toConsumableArray(res), _toConsumableArray(segPoints));\n }, [])];\n }\n var polygonPath = segmentPoints.map(function (segPoints) {\n return segPoints.reduce(function (path, point, index) {\n return \"\".concat(path).concat(index === 0 ? 'M' : 'L').concat(point.x, \",\").concat(point.y);\n }, '');\n }).join('');\n return segmentPoints.length === 1 ? \"\".concat(polygonPath, \"Z\") : polygonPath;\n};\nvar getRanglePath = function getRanglePath(points, baseLinePoints, connectNulls) {\n var outerPath = getSinglePolygonPath(points, connectNulls);\n return \"\".concat(outerPath.slice(-1) === 'Z' ? outerPath.slice(0, -1) : outerPath, \"L\").concat(getSinglePolygonPath(baseLinePoints.reverse(), connectNulls).slice(1));\n};\nexport var Polygon = function Polygon(props) {\n var points = props.points,\n className = props.className,\n baseLinePoints = props.baseLinePoints,\n connectNulls = props.connectNulls,\n others = _objectWithoutProperties(props, _excluded);\n if (!points || !points.length) {\n return null;\n }\n var layerClass = clsx('recharts-polygon', className);\n if (baseLinePoints && baseLinePoints.length) {\n var hasStroke = others.stroke && others.stroke !== 'none';\n var rangePath = getRanglePath(points, baseLinePoints, connectNulls);\n return /*#__PURE__*/React.createElement(\"g\", {\n className: layerClass\n }, /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(others, true), {\n fill: rangePath.slice(-1) === 'Z' ? others.fill : 'none',\n stroke: \"none\",\n d: rangePath\n })), hasStroke ? /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(others, true), {\n fill: \"none\",\n d: getSinglePolygonPath(points, connectNulls)\n })) : null, hasStroke ? /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(others, true), {\n fill: \"none\",\n d: getSinglePolygonPath(baseLinePoints, connectNulls)\n })) : null);\n }\n var singlePath = getSinglePolygonPath(points, connectNulls);\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(others, true), {\n fill: singlePath.slice(-1) === 'Z' ? others.fill : 'none',\n className: layerClass,\n d: singlePath\n }));\n};","function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n/**\n * @fileOverview Dot\n */\nimport * as React from 'react';\nimport clsx from 'clsx';\nimport { adaptEventHandlers } from '../util/types';\nimport { filterProps } from '../util/ReactUtils';\nexport var Dot = function Dot(props) {\n var cx = props.cx,\n cy = props.cy,\n r = props.r,\n className = props.className;\n var layerClass = clsx('recharts-dot', className);\n if (cx === +cx && cy === +cy && r === +r) {\n return /*#__PURE__*/React.createElement(\"circle\", _extends({}, filterProps(props, false), adaptEventHandlers(props), {\n className: layerClass,\n cx: cx,\n cy: cy,\n r: r\n }));\n }\n return null;\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"x\", \"y\", \"top\", \"left\", \"width\", \"height\", \"className\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\n/**\n * @fileOverview Cross\n */\nimport React from 'react';\nimport clsx from 'clsx';\nimport { isNumber } from '../util/DataUtils';\nimport { filterProps } from '../util/ReactUtils';\nvar getPath = function getPath(x, y, width, height, top, left) {\n return \"M\".concat(x, \",\").concat(top, \"v\").concat(height, \"M\").concat(left, \",\").concat(y, \"h\").concat(width);\n};\nexport var Cross = function Cross(_ref) {\n var _ref$x = _ref.x,\n x = _ref$x === void 0 ? 0 : _ref$x,\n _ref$y = _ref.y,\n y = _ref$y === void 0 ? 0 : _ref$y,\n _ref$top = _ref.top,\n top = _ref$top === void 0 ? 0 : _ref$top,\n _ref$left = _ref.left,\n left = _ref$left === void 0 ? 0 : _ref$left,\n _ref$width = _ref.width,\n width = _ref$width === void 0 ? 0 : _ref$width,\n _ref$height = _ref.height,\n height = _ref$height === void 0 ? 0 : _ref$height,\n className = _ref.className,\n rest = _objectWithoutProperties(_ref, _excluded);\n var props = _objectSpread({\n x: x,\n y: y,\n top: top,\n left: left,\n width: width,\n height: height\n }, rest);\n if (!isNumber(x) || !isNumber(y) || !isNumber(width) || !isNumber(height) || !isNumber(top) || !isNumber(left)) {\n return null;\n }\n return /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(props, true), {\n className: clsx('recharts-cross', className),\n d: getPath(x, y, width, height, top, left)\n }));\n};","var baseExtremum = require('./_baseExtremum'),\n baseGt = require('./_baseGt'),\n baseIteratee = require('./_baseIteratee');\n\n/**\n * This method is like `_.max` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.maxBy(objects, function(o) { return o.n; });\n * // => { 'n': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.maxBy(objects, 'n');\n * // => { 'n': 2 }\n */\nfunction maxBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, baseIteratee(iteratee, 2), baseGt)\n : undefined;\n}\n\nmodule.exports = maxBy;\n","var baseExtremum = require('./_baseExtremum'),\n baseIteratee = require('./_baseIteratee'),\n baseLt = require('./_baseLt');\n\n/**\n * This method is like `_.min` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.minBy(objects, function(o) { return o.n; });\n * // => { 'n': 1 }\n *\n * // The `_.property` iteratee shorthand.\n * _.minBy(objects, 'n');\n * // => { 'n': 1 }\n */\nfunction minBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt)\n : undefined;\n}\n\nmodule.exports = minBy;\n","var _excluded = [\"cx\", \"cy\", \"angle\", \"ticks\", \"axisLine\"],\n _excluded2 = [\"ticks\", \"tick\", \"angle\", \"tickFormatter\", \"stroke\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview The axis of polar coordinate system\n */\nimport React, { PureComponent } from 'react';\nimport maxBy from 'lodash/maxBy';\nimport minBy from 'lodash/minBy';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { Text } from '../component/Text';\nimport { Label } from '../component/Label';\nimport { Layer } from '../container/Layer';\nimport { getTickClassName, polarToCartesian } from '../util/PolarUtils';\nimport { adaptEventsOfChild } from '../util/types';\nimport { filterProps } from '../util/ReactUtils';\nexport var PolarRadiusAxis = /*#__PURE__*/function (_PureComponent) {\n function PolarRadiusAxis() {\n _classCallCheck(this, PolarRadiusAxis);\n return _callSuper(this, PolarRadiusAxis, arguments);\n }\n _inherits(PolarRadiusAxis, _PureComponent);\n return _createClass(PolarRadiusAxis, [{\n key: \"getTickValueCoord\",\n value:\n /**\n * Calculate the coordinate of tick\n * @param {Number} coordinate The radius of tick\n * @return {Object} (x, y)\n */\n function getTickValueCoord(_ref) {\n var coordinate = _ref.coordinate;\n var _this$props = this.props,\n angle = _this$props.angle,\n cx = _this$props.cx,\n cy = _this$props.cy;\n return polarToCartesian(cx, cy, coordinate, angle);\n }\n }, {\n key: \"getTickTextAnchor\",\n value: function getTickTextAnchor() {\n var orientation = this.props.orientation;\n var textAnchor;\n switch (orientation) {\n case 'left':\n textAnchor = 'end';\n break;\n case 'right':\n textAnchor = 'start';\n break;\n default:\n textAnchor = 'middle';\n break;\n }\n return textAnchor;\n }\n }, {\n key: \"getViewBox\",\n value: function getViewBox() {\n var _this$props2 = this.props,\n cx = _this$props2.cx,\n cy = _this$props2.cy,\n angle = _this$props2.angle,\n ticks = _this$props2.ticks;\n var maxRadiusTick = maxBy(ticks, function (entry) {\n return entry.coordinate || 0;\n });\n var minRadiusTick = minBy(ticks, function (entry) {\n return entry.coordinate || 0;\n });\n return {\n cx: cx,\n cy: cy,\n startAngle: angle,\n endAngle: angle,\n innerRadius: minRadiusTick.coordinate || 0,\n outerRadius: maxRadiusTick.coordinate || 0\n };\n }\n }, {\n key: \"renderAxisLine\",\n value: function renderAxisLine() {\n var _this$props3 = this.props,\n cx = _this$props3.cx,\n cy = _this$props3.cy,\n angle = _this$props3.angle,\n ticks = _this$props3.ticks,\n axisLine = _this$props3.axisLine,\n others = _objectWithoutProperties(_this$props3, _excluded);\n var extent = ticks.reduce(function (result, entry) {\n return [Math.min(result[0], entry.coordinate), Math.max(result[1], entry.coordinate)];\n }, [Infinity, -Infinity]);\n var point0 = polarToCartesian(cx, cy, extent[0], angle);\n var point1 = polarToCartesian(cx, cy, extent[1], angle);\n var props = _objectSpread(_objectSpread(_objectSpread({}, filterProps(others, false)), {}, {\n fill: 'none'\n }, filterProps(axisLine, false)), {}, {\n x1: point0.x,\n y1: point0.y,\n x2: point1.x,\n y2: point1.y\n });\n return /*#__PURE__*/React.createElement(\"line\", _extends({\n className: \"recharts-polar-radius-axis-line\"\n }, props));\n }\n }, {\n key: \"renderTicks\",\n value: function renderTicks() {\n var _this = this;\n var _this$props4 = this.props,\n ticks = _this$props4.ticks,\n tick = _this$props4.tick,\n angle = _this$props4.angle,\n tickFormatter = _this$props4.tickFormatter,\n stroke = _this$props4.stroke,\n others = _objectWithoutProperties(_this$props4, _excluded2);\n var textAnchor = this.getTickTextAnchor();\n var axisProps = filterProps(others, false);\n var customTickProps = filterProps(tick, false);\n var items = ticks.map(function (entry, i) {\n var coord = _this.getTickValueCoord(entry);\n var tickProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({\n textAnchor: textAnchor,\n transform: \"rotate(\".concat(90 - angle, \", \").concat(coord.x, \", \").concat(coord.y, \")\")\n }, axisProps), {}, {\n stroke: 'none',\n fill: stroke\n }, customTickProps), {}, {\n index: i\n }, coord), {}, {\n payload: entry\n });\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: clsx('recharts-polar-radius-axis-tick', getTickClassName(tick)),\n key: \"tick-\".concat(entry.coordinate)\n }, adaptEventsOfChild(_this.props, entry, i)), PolarRadiusAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-polar-radius-axis-ticks\"\n }, items);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props5 = this.props,\n ticks = _this$props5.ticks,\n axisLine = _this$props5.axisLine,\n tick = _this$props5.tick;\n if (!ticks || !ticks.length) {\n return null;\n }\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-polar-radius-axis', this.props.className)\n }, axisLine && this.renderAxisLine(), tick && this.renderTicks(), Label.renderCallByParent(this.props, this.getViewBox()));\n }\n }], [{\n key: \"renderTickItem\",\n value: function renderTickItem(option, props, value) {\n var tickItem;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n tickItem = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n tickItem = option(props);\n } else {\n tickItem = /*#__PURE__*/React.createElement(Text, _extends({}, props, {\n className: \"recharts-polar-radius-axis-tick-value\"\n }), value);\n }\n return tickItem;\n }\n }]);\n}(PureComponent);\n_defineProperty(PolarRadiusAxis, \"displayName\", 'PolarRadiusAxis');\n_defineProperty(PolarRadiusAxis, \"axisType\", 'radiusAxis');\n_defineProperty(PolarRadiusAxis, \"defaultProps\", {\n type: 'number',\n radiusAxisId: 0,\n cx: 0,\n cy: 0,\n angle: 0,\n orientation: 'right',\n stroke: '#ccc',\n axisLine: true,\n tick: true,\n tickCount: 5,\n allowDataOverflow: false,\n scale: 'auto',\n allowDuplicatedCategory: true\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Axis of radial direction\n */\nimport React, { PureComponent } from 'react';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { Layer } from '../container/Layer';\nimport { Dot } from '../shape/Dot';\nimport { Polygon } from '../shape/Polygon';\nimport { Text } from '../component/Text';\nimport { adaptEventsOfChild } from '../util/types';\nimport { filterProps } from '../util/ReactUtils';\nimport { getTickClassName, polarToCartesian } from '../util/PolarUtils';\nvar RADIAN = Math.PI / 180;\nvar eps = 1e-5;\nexport var PolarAngleAxis = /*#__PURE__*/function (_PureComponent) {\n function PolarAngleAxis() {\n _classCallCheck(this, PolarAngleAxis);\n return _callSuper(this, PolarAngleAxis, arguments);\n }\n _inherits(PolarAngleAxis, _PureComponent);\n return _createClass(PolarAngleAxis, [{\n key: \"getTickLineCoord\",\n value:\n /**\n * Calculate the coordinate of line endpoint\n * @param {Object} data The Data if ticks\n * @return {Object} (x0, y0): The start point of text,\n * (x1, y1): The end point close to text,\n * (x2, y2): The end point close to axis\n */\n function getTickLineCoord(data) {\n var _this$props = this.props,\n cx = _this$props.cx,\n cy = _this$props.cy,\n radius = _this$props.radius,\n orientation = _this$props.orientation,\n tickSize = _this$props.tickSize;\n var tickLineSize = tickSize || 8;\n var p1 = polarToCartesian(cx, cy, radius, data.coordinate);\n var p2 = polarToCartesian(cx, cy, radius + (orientation === 'inner' ? -1 : 1) * tickLineSize, data.coordinate);\n return {\n x1: p1.x,\n y1: p1.y,\n x2: p2.x,\n y2: p2.y\n };\n }\n\n /**\n * Get the text-anchor of each tick\n * @param {Object} data Data of ticks\n * @return {String} text-anchor\n */\n }, {\n key: \"getTickTextAnchor\",\n value: function getTickTextAnchor(data) {\n var orientation = this.props.orientation;\n var cos = Math.cos(-data.coordinate * RADIAN);\n var textAnchor;\n if (cos > eps) {\n textAnchor = orientation === 'outer' ? 'start' : 'end';\n } else if (cos < -eps) {\n textAnchor = orientation === 'outer' ? 'end' : 'start';\n } else {\n textAnchor = 'middle';\n }\n return textAnchor;\n }\n }, {\n key: \"renderAxisLine\",\n value: function renderAxisLine() {\n var _this$props2 = this.props,\n cx = _this$props2.cx,\n cy = _this$props2.cy,\n radius = _this$props2.radius,\n axisLine = _this$props2.axisLine,\n axisLineType = _this$props2.axisLineType;\n var props = _objectSpread(_objectSpread({}, filterProps(this.props, false)), {}, {\n fill: 'none'\n }, filterProps(axisLine, false));\n if (axisLineType === 'circle') {\n return /*#__PURE__*/React.createElement(Dot, _extends({\n className: \"recharts-polar-angle-axis-line\"\n }, props, {\n cx: cx,\n cy: cy,\n r: radius\n }));\n }\n var ticks = this.props.ticks;\n var points = ticks.map(function (entry) {\n return polarToCartesian(cx, cy, radius, entry.coordinate);\n });\n return /*#__PURE__*/React.createElement(Polygon, _extends({\n className: \"recharts-polar-angle-axis-line\"\n }, props, {\n points: points\n }));\n }\n }, {\n key: \"renderTicks\",\n value: function renderTicks() {\n var _this = this;\n var _this$props3 = this.props,\n ticks = _this$props3.ticks,\n tick = _this$props3.tick,\n tickLine = _this$props3.tickLine,\n tickFormatter = _this$props3.tickFormatter,\n stroke = _this$props3.stroke;\n var axisProps = filterProps(this.props, false);\n var customTickProps = filterProps(tick, false);\n var tickLineProps = _objectSpread(_objectSpread({}, axisProps), {}, {\n fill: 'none'\n }, filterProps(tickLine, false));\n var items = ticks.map(function (entry, i) {\n var lineCoord = _this.getTickLineCoord(entry);\n var textAnchor = _this.getTickTextAnchor(entry);\n var tickProps = _objectSpread(_objectSpread(_objectSpread({\n textAnchor: textAnchor\n }, axisProps), {}, {\n stroke: 'none',\n fill: stroke\n }, customTickProps), {}, {\n index: i,\n payload: entry,\n x: lineCoord.x2,\n y: lineCoord.y2\n });\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: clsx('recharts-polar-angle-axis-tick', getTickClassName(tick)),\n key: \"tick-\".concat(entry.coordinate)\n }, adaptEventsOfChild(_this.props, entry, i)), tickLine && /*#__PURE__*/React.createElement(\"line\", _extends({\n className: \"recharts-polar-angle-axis-tick-line\"\n }, tickLineProps, lineCoord)), tick && PolarAngleAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-polar-angle-axis-ticks\"\n }, items);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props4 = this.props,\n ticks = _this$props4.ticks,\n radius = _this$props4.radius,\n axisLine = _this$props4.axisLine;\n if (radius <= 0 || !ticks || !ticks.length) {\n return null;\n }\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-polar-angle-axis', this.props.className)\n }, axisLine && this.renderAxisLine(), this.renderTicks());\n }\n }], [{\n key: \"renderTickItem\",\n value: function renderTickItem(option, props, value) {\n var tickItem;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n tickItem = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n tickItem = option(props);\n } else {\n tickItem = /*#__PURE__*/React.createElement(Text, _extends({}, props, {\n className: \"recharts-polar-angle-axis-tick-value\"\n }), value);\n }\n return tickItem;\n }\n }]);\n}(PureComponent);\n_defineProperty(PolarAngleAxis, \"displayName\", 'PolarAngleAxis');\n_defineProperty(PolarAngleAxis, \"axisType\", 'angleAxis');\n_defineProperty(PolarAngleAxis, \"defaultProps\", {\n type: 'category',\n angleAxisId: 0,\n scale: 'auto',\n cx: 0,\n cy: 0,\n orientation: 'outer',\n axisLine: true,\n tickLine: true,\n tickSize: 8,\n tick: true,\n hide: false,\n allowDuplicatedCategory: true\n});","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]';\n\n/**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\nfunction isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n}\n\nmodule.exports = isBoolean;\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Rectangle\n */\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport Animate from 'react-smooth';\nimport { filterProps } from '../util/ReactUtils';\nvar getTrapezoidPath = function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) {\n var widthGap = upperWidth - lowerWidth;\n var path;\n path = \"M \".concat(x, \",\").concat(y);\n path += \"L \".concat(x + upperWidth, \",\").concat(y);\n path += \"L \".concat(x + upperWidth - widthGap / 2, \",\").concat(y + height);\n path += \"L \".concat(x + upperWidth - widthGap / 2 - lowerWidth, \",\").concat(y + height);\n path += \"L \".concat(x, \",\").concat(y, \" Z\");\n return path;\n};\nvar defaultProps = {\n x: 0,\n y: 0,\n upperWidth: 0,\n lowerWidth: 0,\n height: 0,\n isUpdateAnimationActive: false,\n animationBegin: 0,\n animationDuration: 1500,\n animationEasing: 'ease'\n};\nexport var Trapezoid = function Trapezoid(props) {\n var trapezoidProps = _objectSpread(_objectSpread({}, defaultProps), props);\n var pathRef = useRef();\n var _useState = useState(-1),\n _useState2 = _slicedToArray(_useState, 2),\n totalLength = _useState2[0],\n setTotalLength = _useState2[1];\n useEffect(function () {\n if (pathRef.current && pathRef.current.getTotalLength) {\n try {\n var pathTotalLength = pathRef.current.getTotalLength();\n if (pathTotalLength) {\n setTotalLength(pathTotalLength);\n }\n } catch (err) {\n // calculate total length error\n }\n }\n }, []);\n var x = trapezoidProps.x,\n y = trapezoidProps.y,\n upperWidth = trapezoidProps.upperWidth,\n lowerWidth = trapezoidProps.lowerWidth,\n height = trapezoidProps.height,\n className = trapezoidProps.className;\n var animationEasing = trapezoidProps.animationEasing,\n animationDuration = trapezoidProps.animationDuration,\n animationBegin = trapezoidProps.animationBegin,\n isUpdateAnimationActive = trapezoidProps.isUpdateAnimationActive;\n if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) {\n return null;\n }\n var layerClass = clsx('recharts-trapezoid', className);\n if (!isUpdateAnimationActive) {\n return /*#__PURE__*/React.createElement(\"g\", null, /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(trapezoidProps, true), {\n className: layerClass,\n d: getTrapezoidPath(x, y, upperWidth, lowerWidth, height)\n })));\n }\n return /*#__PURE__*/React.createElement(Animate, {\n canBegin: totalLength > 0,\n from: {\n upperWidth: 0,\n lowerWidth: 0,\n height: height,\n x: x,\n y: y\n },\n to: {\n upperWidth: upperWidth,\n lowerWidth: lowerWidth,\n height: height,\n x: x,\n y: y\n },\n duration: animationDuration,\n animationEasing: animationEasing,\n isActive: isUpdateAnimationActive\n }, function (_ref) {\n var currUpperWidth = _ref.upperWidth,\n currLowerWidth = _ref.lowerWidth,\n currHeight = _ref.height,\n currX = _ref.x,\n currY = _ref.y;\n return /*#__PURE__*/React.createElement(Animate, {\n canBegin: totalLength > 0,\n from: \"0px \".concat(totalLength === -1 ? 1 : totalLength, \"px\"),\n to: \"\".concat(totalLength, \"px 0px\"),\n attributeName: \"strokeDasharray\",\n begin: animationBegin,\n duration: animationDuration,\n easing: animationEasing\n }, /*#__PURE__*/React.createElement(\"path\", _extends({}, filterProps(trapezoidProps, true), {\n className: layerClass,\n d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight),\n ref: pathRef\n })));\n });\n};","var _excluded = [\"option\", \"shapeType\", \"propTransformer\", \"activeClassName\", \"isActive\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport React, { isValidElement, cloneElement } from 'react';\nimport isFunction from 'lodash/isFunction';\nimport isPlainObject from 'lodash/isPlainObject';\nimport isBoolean from 'lodash/isBoolean';\nimport isEqual from 'lodash/isEqual';\nimport { Rectangle } from '../shape/Rectangle';\nimport { Trapezoid } from '../shape/Trapezoid';\nimport { Sector } from '../shape/Sector';\nimport { Layer } from '../container/Layer';\nimport { Symbols } from '../shape/Symbols';\n\n/**\n * This is an abstraction for rendering a user defined prop for a customized shape in several forms.\n *\n * is the root and will handle taking in:\n * - an object of svg properties\n * - a boolean\n * - a render prop(inline function that returns jsx)\n * - a react element\n *\n * is a subcomponent of and used to match a component\n * to the value of props.shapeType that is passed to the root.\n *\n */\n\nfunction defaultPropTransformer(option, props) {\n return _objectSpread(_objectSpread({}, props), option);\n}\nfunction isSymbolsProps(shapeType, _elementProps) {\n return shapeType === 'symbols';\n}\nfunction ShapeSelector(_ref) {\n var shapeType = _ref.shapeType,\n elementProps = _ref.elementProps;\n switch (shapeType) {\n case 'rectangle':\n return /*#__PURE__*/React.createElement(Rectangle, elementProps);\n case 'trapezoid':\n return /*#__PURE__*/React.createElement(Trapezoid, elementProps);\n case 'sector':\n return /*#__PURE__*/React.createElement(Sector, elementProps);\n case 'symbols':\n if (isSymbolsProps(shapeType, elementProps)) {\n return /*#__PURE__*/React.createElement(Symbols, elementProps);\n }\n break;\n default:\n return null;\n }\n}\nexport function getPropsFromShapeOption(option) {\n if ( /*#__PURE__*/isValidElement(option)) {\n return option.props;\n }\n return option;\n}\nexport function Shape(_ref2) {\n var option = _ref2.option,\n shapeType = _ref2.shapeType,\n _ref2$propTransformer = _ref2.propTransformer,\n propTransformer = _ref2$propTransformer === void 0 ? defaultPropTransformer : _ref2$propTransformer,\n _ref2$activeClassName = _ref2.activeClassName,\n activeClassName = _ref2$activeClassName === void 0 ? 'recharts-active-shape' : _ref2$activeClassName,\n isActive = _ref2.isActive,\n props = _objectWithoutProperties(_ref2, _excluded);\n var shape;\n if ( /*#__PURE__*/isValidElement(option)) {\n shape = /*#__PURE__*/cloneElement(option, _objectSpread(_objectSpread({}, props), getPropsFromShapeOption(option)));\n } else if (isFunction(option)) {\n shape = option(props);\n } else if (isPlainObject(option) && !isBoolean(option)) {\n var nextProps = propTransformer(option, props);\n shape = /*#__PURE__*/React.createElement(ShapeSelector, {\n shapeType: shapeType,\n elementProps: nextProps\n });\n } else {\n var elementProps = props;\n shape = /*#__PURE__*/React.createElement(ShapeSelector, {\n shapeType: shapeType,\n elementProps: elementProps\n });\n }\n if (isActive) {\n return /*#__PURE__*/React.createElement(Layer, {\n className: activeClassName\n }, shape);\n }\n return shape;\n}\n\n/**\n * This is an abstraction to handle identifying the active index from a tooltip mouse interaction\n */\n\nexport function isFunnel(graphicalItem, _item) {\n return _item != null && 'trapezoids' in graphicalItem.props;\n}\nexport function isPie(graphicalItem, _item) {\n return _item != null && 'sectors' in graphicalItem.props;\n}\nexport function isScatter(graphicalItem, _item) {\n return _item != null && 'points' in graphicalItem.props;\n}\nexport function compareFunnel(shapeData, activeTooltipItem) {\n var _activeTooltipItem$la, _activeTooltipItem$la2;\n var xMatches = shapeData.x === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la === void 0 ? void 0 : _activeTooltipItem$la.x) || shapeData.x === activeTooltipItem.x;\n var yMatches = shapeData.y === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la2 = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la2 === void 0 ? void 0 : _activeTooltipItem$la2.y) || shapeData.y === activeTooltipItem.y;\n return xMatches && yMatches;\n}\nexport function comparePie(shapeData, activeTooltipItem) {\n var startAngleMatches = shapeData.endAngle === activeTooltipItem.endAngle;\n var endAngleMatches = shapeData.startAngle === activeTooltipItem.startAngle;\n return startAngleMatches && endAngleMatches;\n}\nexport function compareScatter(shapeData, activeTooltipItem) {\n var xMatches = shapeData.x === activeTooltipItem.x;\n var yMatches = shapeData.y === activeTooltipItem.y;\n var zMatches = shapeData.z === activeTooltipItem.z;\n return xMatches && yMatches && zMatches;\n}\nfunction getComparisonFn(graphicalItem, activeItem) {\n var comparison;\n if (isFunnel(graphicalItem, activeItem)) {\n comparison = compareFunnel;\n } else if (isPie(graphicalItem, activeItem)) {\n comparison = comparePie;\n } else if (isScatter(graphicalItem, activeItem)) {\n comparison = compareScatter;\n }\n return comparison;\n}\nfunction getShapeDataKey(graphicalItem, activeItem) {\n var shapeKey;\n if (isFunnel(graphicalItem, activeItem)) {\n shapeKey = 'trapezoids';\n } else if (isPie(graphicalItem, activeItem)) {\n shapeKey = 'sectors';\n } else if (isScatter(graphicalItem, activeItem)) {\n shapeKey = 'points';\n }\n return shapeKey;\n}\nfunction getActiveShapeTooltipPayload(graphicalItem, activeItem) {\n if (isFunnel(graphicalItem, activeItem)) {\n var _activeItem$tooltipPa;\n return (_activeItem$tooltipPa = activeItem.tooltipPayload) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa[0]) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa.payload) === null || _activeItem$tooltipPa === void 0 ? void 0 : _activeItem$tooltipPa.payload;\n }\n if (isPie(graphicalItem, activeItem)) {\n var _activeItem$tooltipPa2;\n return (_activeItem$tooltipPa2 = activeItem.tooltipPayload) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2[0]) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2.payload) === null || _activeItem$tooltipPa2 === void 0 ? void 0 : _activeItem$tooltipPa2.payload;\n }\n if (isScatter(graphicalItem, activeItem)) {\n return activeItem.payload;\n }\n return {};\n}\n/**\n *\n * @param {GetActiveShapeIndexForTooltip} arg an object of incoming attributes from Tooltip\n * @returns {number}\n *\n * To handle possible duplicates in the data set,\n * match both the data value of the active item to a data value on a graph item,\n * and match the mouse coordinates of the active item to the coordinates of in a particular components shape data.\n * This assumes equal lengths of shape objects to data items.\n */\nexport function getActiveShapeIndexForTooltip(_ref3) {\n var activeTooltipItem = _ref3.activeTooltipItem,\n graphicalItem = _ref3.graphicalItem,\n itemData = _ref3.itemData;\n var shapeKey = getShapeDataKey(graphicalItem, activeTooltipItem);\n var tooltipPayload = getActiveShapeTooltipPayload(graphicalItem, activeTooltipItem);\n var activeItemMatches = itemData.filter(function (datum, dataIndex) {\n var valuesMatch = isEqual(tooltipPayload, datum);\n var mouseCoordinateMatches = graphicalItem.props[shapeKey].filter(function (shapeData) {\n var comparison = getComparisonFn(graphicalItem, activeTooltipItem);\n return comparison(shapeData, activeTooltipItem);\n });\n\n // get the last index in case of multiple matches\n var indexOfMouseCoordinates = graphicalItem.props[shapeKey].indexOf(mouseCoordinateMatches[mouseCoordinateMatches.length - 1]);\n var coordinatesMatch = dataIndex === indexOfMouseCoordinates;\n return valuesMatch && coordinatesMatch;\n });\n\n // get the last index in case of multiple matches\n var activeIndex = itemData.indexOf(activeItemMatches[activeItemMatches.length - 1]);\n return activeIndex;\n}","var _Pie;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Render sectors of a pie\n */\nimport React, { PureComponent } from 'react';\nimport Animate from 'react-smooth';\nimport get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\nimport isNil from 'lodash/isNil';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { Layer } from '../container/Layer';\nimport { Curve } from '../shape/Curve';\nimport { Text } from '../component/Text';\nimport { Label } from '../component/Label';\nimport { LabelList } from '../component/LabelList';\nimport { Cell } from '../component/Cell';\nimport { findAllByType, filterProps } from '../util/ReactUtils';\nimport { Global } from '../util/Global';\nimport { polarToCartesian, getMaxRadius } from '../util/PolarUtils';\nimport { isNumber, getPercentValue, mathSign, interpolateNumber, uniqueId } from '../util/DataUtils';\nimport { getValueByDataKey } from '../util/ChartUtils';\nimport { warn } from '../util/LogUtils';\nimport { adaptEventsOfChild } from '../util/types';\nimport { Shape } from '../util/ActiveShapeUtils';\nexport var Pie = /*#__PURE__*/function (_PureComponent) {\n function Pie(props) {\n var _this;\n _classCallCheck(this, Pie);\n _this = _callSuper(this, Pie, [props]);\n _defineProperty(_this, \"pieRef\", null);\n _defineProperty(_this, \"sectorRefs\", []);\n _defineProperty(_this, \"id\", uniqueId('recharts-pie-'));\n _defineProperty(_this, \"handleAnimationEnd\", function () {\n var onAnimationEnd = _this.props.onAnimationEnd;\n _this.setState({\n isAnimationFinished: true\n });\n if (isFunction(onAnimationEnd)) {\n onAnimationEnd();\n }\n });\n _defineProperty(_this, \"handleAnimationStart\", function () {\n var onAnimationStart = _this.props.onAnimationStart;\n _this.setState({\n isAnimationFinished: false\n });\n if (isFunction(onAnimationStart)) {\n onAnimationStart();\n }\n });\n _this.state = {\n isAnimationFinished: !props.isAnimationActive,\n prevIsAnimationActive: props.isAnimationActive,\n prevAnimationId: props.animationId,\n sectorToFocus: 0\n };\n return _this;\n }\n _inherits(Pie, _PureComponent);\n return _createClass(Pie, [{\n key: \"isActiveIndex\",\n value: function isActiveIndex(i) {\n var activeIndex = this.props.activeIndex;\n if (Array.isArray(activeIndex)) {\n return activeIndex.indexOf(i) !== -1;\n }\n return i === activeIndex;\n }\n }, {\n key: \"hasActiveIndex\",\n value: function hasActiveIndex() {\n var activeIndex = this.props.activeIndex;\n return Array.isArray(activeIndex) ? activeIndex.length !== 0 : activeIndex || activeIndex === 0;\n }\n }, {\n key: \"renderLabels\",\n value: function renderLabels(sectors) {\n var isAnimationActive = this.props.isAnimationActive;\n if (isAnimationActive && !this.state.isAnimationFinished) {\n return null;\n }\n var _this$props = this.props,\n label = _this$props.label,\n labelLine = _this$props.labelLine,\n dataKey = _this$props.dataKey,\n valueKey = _this$props.valueKey;\n var pieProps = filterProps(this.props, false);\n var customLabelProps = filterProps(label, false);\n var customLabelLineProps = filterProps(labelLine, false);\n var offsetRadius = label && label.offsetRadius || 20;\n var labels = sectors.map(function (entry, i) {\n var midAngle = (entry.startAngle + entry.endAngle) / 2;\n var endPoint = polarToCartesian(entry.cx, entry.cy, entry.outerRadius + offsetRadius, midAngle);\n var labelProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, pieProps), entry), {}, {\n stroke: 'none'\n }, customLabelProps), {}, {\n index: i,\n textAnchor: Pie.getTextAnchor(endPoint.x, entry.cx)\n }, endPoint);\n var lineProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, pieProps), entry), {}, {\n fill: 'none',\n stroke: entry.fill\n }, customLabelLineProps), {}, {\n index: i,\n points: [polarToCartesian(entry.cx, entry.cy, entry.outerRadius, midAngle), endPoint]\n });\n var realDataKey = dataKey;\n // TODO: compatible to lower versions\n if (isNil(dataKey) && isNil(valueKey)) {\n realDataKey = 'value';\n } else if (isNil(dataKey)) {\n realDataKey = valueKey;\n }\n return (\n /*#__PURE__*/\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(Layer, {\n key: \"label-\".concat(entry.startAngle, \"-\").concat(entry.endAngle, \"-\").concat(entry.midAngle, \"-\").concat(i)\n }, labelLine && Pie.renderLabelLineItem(labelLine, lineProps, 'line'), Pie.renderLabelItem(label, labelProps, getValueByDataKey(entry, realDataKey)))\n );\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-pie-labels\"\n }, labels);\n }\n }, {\n key: \"renderSectorsStatically\",\n value: function renderSectorsStatically(sectors) {\n var _this2 = this;\n var _this$props2 = this.props,\n activeShape = _this$props2.activeShape,\n blendStroke = _this$props2.blendStroke,\n inactiveShapeProp = _this$props2.inactiveShape;\n return sectors.map(function (entry, i) {\n if ((entry === null || entry === void 0 ? void 0 : entry.startAngle) === 0 && (entry === null || entry === void 0 ? void 0 : entry.endAngle) === 0 && sectors.length !== 1) return null;\n var isActive = _this2.isActiveIndex(i);\n var inactiveShape = inactiveShapeProp && _this2.hasActiveIndex() ? inactiveShapeProp : null;\n var sectorOptions = isActive ? activeShape : inactiveShape;\n var sectorProps = _objectSpread(_objectSpread({}, entry), {}, {\n stroke: blendStroke ? entry.fill : entry.stroke,\n tabIndex: -1\n });\n return /*#__PURE__*/React.createElement(Layer, _extends({\n ref: function ref(_ref) {\n if (_ref && !_this2.sectorRefs.includes(_ref)) {\n _this2.sectorRefs.push(_ref);\n }\n },\n tabIndex: -1,\n className: \"recharts-pie-sector\"\n }, adaptEventsOfChild(_this2.props, entry, i), {\n // eslint-disable-next-line react/no-array-index-key\n key: \"sector-\".concat(entry === null || entry === void 0 ? void 0 : entry.startAngle, \"-\").concat(entry === null || entry === void 0 ? void 0 : entry.endAngle, \"-\").concat(entry.midAngle, \"-\").concat(i)\n }), /*#__PURE__*/React.createElement(Shape, _extends({\n option: sectorOptions,\n isActive: isActive,\n shapeType: \"sector\"\n }, sectorProps)));\n });\n }\n }, {\n key: \"renderSectorsWithAnimation\",\n value: function renderSectorsWithAnimation() {\n var _this3 = this;\n var _this$props3 = this.props,\n sectors = _this$props3.sectors,\n isAnimationActive = _this$props3.isAnimationActive,\n animationBegin = _this$props3.animationBegin,\n animationDuration = _this$props3.animationDuration,\n animationEasing = _this$props3.animationEasing,\n animationId = _this$props3.animationId;\n var _this$state = this.state,\n prevSectors = _this$state.prevSectors,\n prevIsAnimationActive = _this$state.prevIsAnimationActive;\n return /*#__PURE__*/React.createElement(Animate, {\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing,\n from: {\n t: 0\n },\n to: {\n t: 1\n },\n key: \"pie-\".concat(animationId, \"-\").concat(prevIsAnimationActive),\n onAnimationStart: this.handleAnimationStart,\n onAnimationEnd: this.handleAnimationEnd\n }, function (_ref2) {\n var t = _ref2.t;\n var stepData = [];\n var first = sectors && sectors[0];\n var curAngle = first.startAngle;\n sectors.forEach(function (entry, index) {\n var prev = prevSectors && prevSectors[index];\n var paddingAngle = index > 0 ? get(entry, 'paddingAngle', 0) : 0;\n if (prev) {\n var angleIp = interpolateNumber(prev.endAngle - prev.startAngle, entry.endAngle - entry.startAngle);\n var latest = _objectSpread(_objectSpread({}, entry), {}, {\n startAngle: curAngle + paddingAngle,\n endAngle: curAngle + angleIp(t) + paddingAngle\n });\n stepData.push(latest);\n curAngle = latest.endAngle;\n } else {\n var endAngle = entry.endAngle,\n startAngle = entry.startAngle;\n var interpolatorAngle = interpolateNumber(0, endAngle - startAngle);\n var deltaAngle = interpolatorAngle(t);\n var _latest = _objectSpread(_objectSpread({}, entry), {}, {\n startAngle: curAngle + paddingAngle,\n endAngle: curAngle + deltaAngle + paddingAngle\n });\n stepData.push(_latest);\n curAngle = _latest.endAngle;\n }\n });\n return /*#__PURE__*/React.createElement(Layer, null, _this3.renderSectorsStatically(stepData));\n });\n }\n }, {\n key: \"attachKeyboardHandlers\",\n value: function attachKeyboardHandlers(pieRef) {\n var _this4 = this;\n // eslint-disable-next-line no-param-reassign\n pieRef.onkeydown = function (e) {\n if (!e.altKey) {\n switch (e.key) {\n case 'ArrowLeft':\n {\n var next = ++_this4.state.sectorToFocus % _this4.sectorRefs.length;\n _this4.sectorRefs[next].focus();\n _this4.setState({\n sectorToFocus: next\n });\n break;\n }\n case 'ArrowRight':\n {\n var _next = --_this4.state.sectorToFocus < 0 ? _this4.sectorRefs.length - 1 : _this4.state.sectorToFocus % _this4.sectorRefs.length;\n _this4.sectorRefs[_next].focus();\n _this4.setState({\n sectorToFocus: _next\n });\n break;\n }\n case 'Escape':\n {\n _this4.sectorRefs[_this4.state.sectorToFocus].blur();\n _this4.setState({\n sectorToFocus: 0\n });\n break;\n }\n default:\n {\n // There is nothing to do here\n }\n }\n }\n };\n }\n }, {\n key: \"renderSectors\",\n value: function renderSectors() {\n var _this$props4 = this.props,\n sectors = _this$props4.sectors,\n isAnimationActive = _this$props4.isAnimationActive;\n var prevSectors = this.state.prevSectors;\n if (isAnimationActive && sectors && sectors.length && (!prevSectors || !isEqual(prevSectors, sectors))) {\n return this.renderSectorsWithAnimation();\n }\n return this.renderSectorsStatically(sectors);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (this.pieRef) {\n this.attachKeyboardHandlers(this.pieRef);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this5 = this;\n var _this$props5 = this.props,\n hide = _this$props5.hide,\n sectors = _this$props5.sectors,\n className = _this$props5.className,\n label = _this$props5.label,\n cx = _this$props5.cx,\n cy = _this$props5.cy,\n innerRadius = _this$props5.innerRadius,\n outerRadius = _this$props5.outerRadius,\n isAnimationActive = _this$props5.isAnimationActive;\n var isAnimationFinished = this.state.isAnimationFinished;\n if (hide || !sectors || !sectors.length || !isNumber(cx) || !isNumber(cy) || !isNumber(innerRadius) || !isNumber(outerRadius)) {\n return null;\n }\n var layerClass = clsx('recharts-pie', className);\n return /*#__PURE__*/React.createElement(Layer, {\n tabIndex: this.props.rootTabIndex,\n className: layerClass,\n ref: function ref(_ref3) {\n _this5.pieRef = _ref3;\n }\n }, this.renderSectors(), label && this.renderLabels(sectors), Label.renderCallByParent(this.props, null, false), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, sectors, false));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n if (prevState.prevIsAnimationActive !== nextProps.isAnimationActive) {\n return {\n prevIsAnimationActive: nextProps.isAnimationActive,\n prevAnimationId: nextProps.animationId,\n curSectors: nextProps.sectors,\n prevSectors: [],\n isAnimationFinished: true\n };\n }\n if (nextProps.isAnimationActive && nextProps.animationId !== prevState.prevAnimationId) {\n return {\n prevAnimationId: nextProps.animationId,\n curSectors: nextProps.sectors,\n prevSectors: prevState.curSectors,\n isAnimationFinished: true\n };\n }\n if (nextProps.sectors !== prevState.curSectors) {\n return {\n curSectors: nextProps.sectors,\n isAnimationFinished: true\n };\n }\n return null;\n }\n }, {\n key: \"getTextAnchor\",\n value: function getTextAnchor(x, cx) {\n if (x > cx) {\n return 'start';\n }\n if (x < cx) {\n return 'end';\n }\n return 'middle';\n }\n }, {\n key: \"renderLabelLineItem\",\n value: function renderLabelLineItem(option, props, key) {\n if ( /*#__PURE__*/React.isValidElement(option)) {\n return /*#__PURE__*/React.cloneElement(option, props);\n }\n if (isFunction(option)) {\n return option(props);\n }\n var className = clsx('recharts-pie-label-line', typeof option !== 'boolean' ? option.className : '');\n return /*#__PURE__*/React.createElement(Curve, _extends({}, props, {\n key: key,\n type: \"linear\",\n className: className\n }));\n }\n }, {\n key: \"renderLabelItem\",\n value: function renderLabelItem(option, props, value) {\n if ( /*#__PURE__*/React.isValidElement(option)) {\n return /*#__PURE__*/React.cloneElement(option, props);\n }\n var label = value;\n if (isFunction(option)) {\n label = option(props);\n if ( /*#__PURE__*/React.isValidElement(label)) {\n return label;\n }\n }\n var className = clsx('recharts-pie-label-text', typeof option !== 'boolean' && !isFunction(option) ? option.className : '');\n return /*#__PURE__*/React.createElement(Text, _extends({}, props, {\n alignmentBaseline: \"middle\",\n className: className\n }), label);\n }\n }]);\n}(PureComponent);\n_Pie = Pie;\n_defineProperty(Pie, \"displayName\", 'Pie');\n_defineProperty(Pie, \"defaultProps\", {\n stroke: '#fff',\n fill: '#808080',\n legendType: 'rect',\n cx: '50%',\n cy: '50%',\n startAngle: 0,\n endAngle: 360,\n innerRadius: 0,\n outerRadius: '80%',\n paddingAngle: 0,\n labelLine: true,\n hide: false,\n minAngle: 0,\n isAnimationActive: !Global.isSsr,\n animationBegin: 400,\n animationDuration: 1500,\n animationEasing: 'ease',\n nameKey: 'name',\n blendStroke: false,\n rootTabIndex: 0\n});\n_defineProperty(Pie, \"parseDeltaAngle\", function (startAngle, endAngle) {\n var sign = mathSign(endAngle - startAngle);\n var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);\n return sign * deltaAngle;\n});\n_defineProperty(Pie, \"getRealPieData\", function (itemProps) {\n var data = itemProps.data,\n children = itemProps.children;\n var presentationProps = filterProps(itemProps, false);\n var cells = findAllByType(children, Cell);\n if (data && data.length) {\n return data.map(function (entry, index) {\n return _objectSpread(_objectSpread(_objectSpread({\n payload: entry\n }, presentationProps), entry), cells && cells[index] && cells[index].props);\n });\n }\n if (cells && cells.length) {\n return cells.map(function (cell) {\n return _objectSpread(_objectSpread({}, presentationProps), cell.props);\n });\n }\n return [];\n});\n_defineProperty(Pie, \"parseCoordinateOfPie\", function (itemProps, offset) {\n var top = offset.top,\n left = offset.left,\n width = offset.width,\n height = offset.height;\n var maxPieRadius = getMaxRadius(width, height);\n var cx = left + getPercentValue(itemProps.cx, width, width / 2);\n var cy = top + getPercentValue(itemProps.cy, height, height / 2);\n var innerRadius = getPercentValue(itemProps.innerRadius, maxPieRadius, 0);\n var outerRadius = getPercentValue(itemProps.outerRadius, maxPieRadius, maxPieRadius * 0.8);\n var maxRadius = itemProps.maxRadius || Math.sqrt(width * width + height * height) / 2;\n return {\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n maxRadius: maxRadius\n };\n});\n_defineProperty(Pie, \"getComposedData\", function (_ref4) {\n var item = _ref4.item,\n offset = _ref4.offset;\n var itemProps = item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var pieData = _Pie.getRealPieData(itemProps);\n if (!pieData || !pieData.length) {\n return null;\n }\n var cornerRadius = itemProps.cornerRadius,\n startAngle = itemProps.startAngle,\n endAngle = itemProps.endAngle,\n paddingAngle = itemProps.paddingAngle,\n dataKey = itemProps.dataKey,\n nameKey = itemProps.nameKey,\n valueKey = itemProps.valueKey,\n tooltipType = itemProps.tooltipType;\n var minAngle = Math.abs(itemProps.minAngle);\n var coordinate = _Pie.parseCoordinateOfPie(itemProps, offset);\n var deltaAngle = _Pie.parseDeltaAngle(startAngle, endAngle);\n var absDeltaAngle = Math.abs(deltaAngle);\n var realDataKey = dataKey;\n if (isNil(dataKey) && isNil(valueKey)) {\n warn(false, \"Use \\\"dataKey\\\" to specify the value of pie,\\n the props \\\"valueKey\\\" will be deprecated in 1.1.0\");\n realDataKey = 'value';\n } else if (isNil(dataKey)) {\n warn(false, \"Use \\\"dataKey\\\" to specify the value of pie,\\n the props \\\"valueKey\\\" will be deprecated in 1.1.0\");\n realDataKey = valueKey;\n }\n var notZeroItemCount = pieData.filter(function (entry) {\n return getValueByDataKey(entry, realDataKey, 0) !== 0;\n }).length;\n var totalPadingAngle = (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle;\n var realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPadingAngle;\n var sum = pieData.reduce(function (result, entry) {\n var val = getValueByDataKey(entry, realDataKey, 0);\n return result + (isNumber(val) ? val : 0);\n }, 0);\n var sectors;\n if (sum > 0) {\n var prev;\n sectors = pieData.map(function (entry, i) {\n var val = getValueByDataKey(entry, realDataKey, 0);\n var name = getValueByDataKey(entry, nameKey, i);\n var percent = (isNumber(val) ? val : 0) / sum;\n var tempStartAngle;\n if (i) {\n tempStartAngle = prev.endAngle + mathSign(deltaAngle) * paddingAngle * (val !== 0 ? 1 : 0);\n } else {\n tempStartAngle = startAngle;\n }\n var tempEndAngle = tempStartAngle + mathSign(deltaAngle) * ((val !== 0 ? minAngle : 0) + percent * realTotalAngle);\n var midAngle = (tempStartAngle + tempEndAngle) / 2;\n var middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2;\n var tooltipPayload = [{\n name: name,\n value: val,\n payload: entry,\n dataKey: realDataKey,\n type: tooltipType\n }];\n var tooltipPosition = polarToCartesian(coordinate.cx, coordinate.cy, middleRadius, midAngle);\n prev = _objectSpread(_objectSpread(_objectSpread({\n percent: percent,\n cornerRadius: cornerRadius,\n name: name,\n tooltipPayload: tooltipPayload,\n midAngle: midAngle,\n middleRadius: middleRadius,\n tooltipPosition: tooltipPosition\n }, entry), coordinate), {}, {\n value: getValueByDataKey(entry, realDataKey),\n startAngle: tempStartAngle,\n endAngle: tempEndAngle,\n payload: entry,\n paddingAngle: mathSign(deltaAngle) * paddingAngle\n });\n return prev;\n });\n }\n return _objectSpread(_objectSpread({}, coordinate), {}, {\n sectors: sectors,\n data: pieData\n });\n});","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil,\n nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\nmodule.exports = baseRange;\n","var toNumber = require('./toNumber');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nmodule.exports = toFinite;\n","var baseRange = require('./_baseRange'),\n isIterateeCall = require('./_isIterateeCall'),\n toFinite = require('./toFinite');\n\n/**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\nfunction createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n}\n\nmodule.exports = createRange;\n","var createRange = require('./_createRange');\n\n/**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\nvar range = createRange();\n\nmodule.exports = range;\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms'];\nexport var generatePrefixStyle = function generatePrefixStyle(name, value) {\n if (!name) {\n return null;\n }\n var camelName = name.replace(/(\\w)/, function (v) {\n return v.toUpperCase();\n });\n var result = PREFIX_LIST.reduce(function (res, entry) {\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, entry + camelName, value));\n }, {});\n result[name] = value;\n return result;\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Brush\n */\nimport React, { PureComponent, Children } from 'react';\nimport clsx from 'clsx';\nimport { scalePoint } from 'victory-vendor/d3-scale';\nimport isFunction from 'lodash/isFunction';\nimport range from 'lodash/range';\nimport { Layer } from '../container/Layer';\nimport { Text } from '../component/Text';\nimport { getValueByDataKey } from '../util/ChartUtils';\nimport { isNumber } from '../util/DataUtils';\nimport { generatePrefixStyle } from '../util/CssPrefixUtils';\nimport { filterProps } from '../util/ReactUtils';\nvar createScale = function createScale(_ref) {\n var data = _ref.data,\n startIndex = _ref.startIndex,\n endIndex = _ref.endIndex,\n x = _ref.x,\n width = _ref.width,\n travellerWidth = _ref.travellerWidth;\n if (!data || !data.length) {\n return {};\n }\n var len = data.length;\n var scale = scalePoint().domain(range(0, len)).range([x, x + width - travellerWidth]);\n var scaleValues = scale.domain().map(function (entry) {\n return scale(entry);\n });\n return {\n isTextActive: false,\n isSlideMoving: false,\n isTravellerMoving: false,\n isTravellerFocused: false,\n startX: scale(startIndex),\n endX: scale(endIndex),\n scale: scale,\n scaleValues: scaleValues\n };\n};\nvar isTouch = function isTouch(e) {\n return e.changedTouches && !!e.changedTouches.length;\n};\nexport var Brush = /*#__PURE__*/function (_PureComponent) {\n function Brush(props) {\n var _this;\n _classCallCheck(this, Brush);\n _this = _callSuper(this, Brush, [props]);\n _defineProperty(_this, \"handleDrag\", function (e) {\n if (_this.leaveTimer) {\n clearTimeout(_this.leaveTimer);\n _this.leaveTimer = null;\n }\n if (_this.state.isTravellerMoving) {\n _this.handleTravellerMove(e);\n } else if (_this.state.isSlideMoving) {\n _this.handleSlideDrag(e);\n }\n });\n _defineProperty(_this, \"handleTouchMove\", function (e) {\n if (e.changedTouches != null && e.changedTouches.length > 0) {\n _this.handleDrag(e.changedTouches[0]);\n }\n });\n _defineProperty(_this, \"handleDragEnd\", function () {\n _this.setState({\n isTravellerMoving: false,\n isSlideMoving: false\n }, function () {\n var _this$props = _this.props,\n endIndex = _this$props.endIndex,\n onDragEnd = _this$props.onDragEnd,\n startIndex = _this$props.startIndex;\n onDragEnd === null || onDragEnd === void 0 || onDragEnd({\n endIndex: endIndex,\n startIndex: startIndex\n });\n });\n _this.detachDragEndListener();\n });\n _defineProperty(_this, \"handleLeaveWrapper\", function () {\n if (_this.state.isTravellerMoving || _this.state.isSlideMoving) {\n _this.leaveTimer = window.setTimeout(_this.handleDragEnd, _this.props.leaveTimeOut);\n }\n });\n _defineProperty(_this, \"handleEnterSlideOrTraveller\", function () {\n _this.setState({\n isTextActive: true\n });\n });\n _defineProperty(_this, \"handleLeaveSlideOrTraveller\", function () {\n _this.setState({\n isTextActive: false\n });\n });\n _defineProperty(_this, \"handleSlideDragStart\", function (e) {\n var event = isTouch(e) ? e.changedTouches[0] : e;\n _this.setState({\n isTravellerMoving: false,\n isSlideMoving: true,\n slideMoveStartX: event.pageX\n });\n _this.attachDragEndListener();\n });\n _this.travellerDragStartHandlers = {\n startX: _this.handleTravellerDragStart.bind(_this, 'startX'),\n endX: _this.handleTravellerDragStart.bind(_this, 'endX')\n };\n _this.state = {};\n return _this;\n }\n _inherits(Brush, _PureComponent);\n return _createClass(Brush, [{\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.leaveTimer) {\n clearTimeout(this.leaveTimer);\n this.leaveTimer = null;\n }\n this.detachDragEndListener();\n }\n }, {\n key: \"getIndex\",\n value: function getIndex(_ref2) {\n var startX = _ref2.startX,\n endX = _ref2.endX;\n var scaleValues = this.state.scaleValues;\n var _this$props2 = this.props,\n gap = _this$props2.gap,\n data = _this$props2.data;\n var lastIndex = data.length - 1;\n var min = Math.min(startX, endX);\n var max = Math.max(startX, endX);\n var minIndex = Brush.getIndexInRange(scaleValues, min);\n var maxIndex = Brush.getIndexInRange(scaleValues, max);\n return {\n startIndex: minIndex - minIndex % gap,\n endIndex: maxIndex === lastIndex ? lastIndex : maxIndex - maxIndex % gap\n };\n }\n }, {\n key: \"getTextOfTick\",\n value: function getTextOfTick(index) {\n var _this$props3 = this.props,\n data = _this$props3.data,\n tickFormatter = _this$props3.tickFormatter,\n dataKey = _this$props3.dataKey;\n var text = getValueByDataKey(data[index], dataKey, index);\n return isFunction(tickFormatter) ? tickFormatter(text, index) : text;\n }\n }, {\n key: \"attachDragEndListener\",\n value: function attachDragEndListener() {\n window.addEventListener('mouseup', this.handleDragEnd, true);\n window.addEventListener('touchend', this.handleDragEnd, true);\n window.addEventListener('mousemove', this.handleDrag, true);\n }\n }, {\n key: \"detachDragEndListener\",\n value: function detachDragEndListener() {\n window.removeEventListener('mouseup', this.handleDragEnd, true);\n window.removeEventListener('touchend', this.handleDragEnd, true);\n window.removeEventListener('mousemove', this.handleDrag, true);\n }\n }, {\n key: \"handleSlideDrag\",\n value: function handleSlideDrag(e) {\n var _this$state = this.state,\n slideMoveStartX = _this$state.slideMoveStartX,\n startX = _this$state.startX,\n endX = _this$state.endX;\n var _this$props4 = this.props,\n x = _this$props4.x,\n width = _this$props4.width,\n travellerWidth = _this$props4.travellerWidth,\n startIndex = _this$props4.startIndex,\n endIndex = _this$props4.endIndex,\n onChange = _this$props4.onChange;\n var delta = e.pageX - slideMoveStartX;\n if (delta > 0) {\n delta = Math.min(delta, x + width - travellerWidth - endX, x + width - travellerWidth - startX);\n } else if (delta < 0) {\n delta = Math.max(delta, x - startX, x - endX);\n }\n var newIndex = this.getIndex({\n startX: startX + delta,\n endX: endX + delta\n });\n if ((newIndex.startIndex !== startIndex || newIndex.endIndex !== endIndex) && onChange) {\n onChange(newIndex);\n }\n this.setState({\n startX: startX + delta,\n endX: endX + delta,\n slideMoveStartX: e.pageX\n });\n }\n }, {\n key: \"handleTravellerDragStart\",\n value: function handleTravellerDragStart(id, e) {\n var event = isTouch(e) ? e.changedTouches[0] : e;\n this.setState({\n isSlideMoving: false,\n isTravellerMoving: true,\n movingTravellerId: id,\n brushMoveStartX: event.pageX\n });\n this.attachDragEndListener();\n }\n }, {\n key: \"handleTravellerMove\",\n value: function handleTravellerMove(e) {\n var _this$state2 = this.state,\n brushMoveStartX = _this$state2.brushMoveStartX,\n movingTravellerId = _this$state2.movingTravellerId,\n endX = _this$state2.endX,\n startX = _this$state2.startX;\n var prevValue = this.state[movingTravellerId];\n var _this$props5 = this.props,\n x = _this$props5.x,\n width = _this$props5.width,\n travellerWidth = _this$props5.travellerWidth,\n onChange = _this$props5.onChange,\n gap = _this$props5.gap,\n data = _this$props5.data;\n var params = {\n startX: this.state.startX,\n endX: this.state.endX\n };\n var delta = e.pageX - brushMoveStartX;\n if (delta > 0) {\n delta = Math.min(delta, x + width - travellerWidth - prevValue);\n } else if (delta < 0) {\n delta = Math.max(delta, x - prevValue);\n }\n params[movingTravellerId] = prevValue + delta;\n var newIndex = this.getIndex(params);\n var startIndex = newIndex.startIndex,\n endIndex = newIndex.endIndex;\n var isFullGap = function isFullGap() {\n var lastIndex = data.length - 1;\n if (movingTravellerId === 'startX' && (endX > startX ? startIndex % gap === 0 : endIndex % gap === 0) || endX < startX && endIndex === lastIndex || movingTravellerId === 'endX' && (endX > startX ? endIndex % gap === 0 : startIndex % gap === 0) || endX > startX && endIndex === lastIndex) {\n return true;\n }\n return false;\n };\n this.setState(_defineProperty(_defineProperty({}, movingTravellerId, prevValue + delta), \"brushMoveStartX\", e.pageX), function () {\n if (onChange) {\n if (isFullGap()) {\n onChange(newIndex);\n }\n }\n });\n }\n }, {\n key: \"handleTravellerMoveKeyboard\",\n value: function handleTravellerMoveKeyboard(direction, id) {\n var _this2 = this;\n // scaleValues are a list of coordinates. For example: [65, 250, 435, 620, 805, 990].\n var _this$state3 = this.state,\n scaleValues = _this$state3.scaleValues,\n startX = _this$state3.startX,\n endX = _this$state3.endX;\n // currentScaleValue refers to which coordinate the current traveller should be placed at.\n var currentScaleValue = this.state[id];\n var currentIndex = scaleValues.indexOf(currentScaleValue);\n if (currentIndex === -1) {\n return;\n }\n var newIndex = currentIndex + direction;\n if (newIndex === -1 || newIndex >= scaleValues.length) {\n return;\n }\n var newScaleValue = scaleValues[newIndex];\n\n // Prevent travellers from being on top of each other or overlapping\n if (id === 'startX' && newScaleValue >= endX || id === 'endX' && newScaleValue <= startX) {\n return;\n }\n this.setState(_defineProperty({}, id, newScaleValue), function () {\n _this2.props.onChange(_this2.getIndex({\n startX: _this2.state.startX,\n endX: _this2.state.endX\n }));\n });\n }\n }, {\n key: \"renderBackground\",\n value: function renderBackground() {\n var _this$props6 = this.props,\n x = _this$props6.x,\n y = _this$props6.y,\n width = _this$props6.width,\n height = _this$props6.height,\n fill = _this$props6.fill,\n stroke = _this$props6.stroke;\n return /*#__PURE__*/React.createElement(\"rect\", {\n stroke: stroke,\n fill: fill,\n x: x,\n y: y,\n width: width,\n height: height\n });\n }\n }, {\n key: \"renderPanorama\",\n value: function renderPanorama() {\n var _this$props7 = this.props,\n x = _this$props7.x,\n y = _this$props7.y,\n width = _this$props7.width,\n height = _this$props7.height,\n data = _this$props7.data,\n children = _this$props7.children,\n padding = _this$props7.padding;\n var chartElement = Children.only(children);\n if (!chartElement) {\n return null;\n }\n return /*#__PURE__*/React.cloneElement(chartElement, {\n x: x,\n y: y,\n width: width,\n height: height,\n margin: padding,\n compact: true,\n data: data\n });\n }\n }, {\n key: \"renderTravellerLayer\",\n value: function renderTravellerLayer(travellerX, id) {\n var _data$startIndex,\n _data$endIndex,\n _this3 = this;\n var _this$props8 = this.props,\n y = _this$props8.y,\n travellerWidth = _this$props8.travellerWidth,\n height = _this$props8.height,\n traveller = _this$props8.traveller,\n ariaLabel = _this$props8.ariaLabel,\n data = _this$props8.data,\n startIndex = _this$props8.startIndex,\n endIndex = _this$props8.endIndex;\n var x = Math.max(travellerX, this.props.x);\n var travellerProps = _objectSpread(_objectSpread({}, filterProps(this.props, false)), {}, {\n x: x,\n y: y,\n width: travellerWidth,\n height: height\n });\n var ariaLabelBrush = ariaLabel || \"Min value: \".concat((_data$startIndex = data[startIndex]) === null || _data$startIndex === void 0 ? void 0 : _data$startIndex.name, \", Max value: \").concat((_data$endIndex = data[endIndex]) === null || _data$endIndex === void 0 ? void 0 : _data$endIndex.name);\n return /*#__PURE__*/React.createElement(Layer, {\n tabIndex: 0,\n role: \"slider\",\n \"aria-label\": ariaLabelBrush,\n \"aria-valuenow\": travellerX,\n className: \"recharts-brush-traveller\",\n onMouseEnter: this.handleEnterSlideOrTraveller,\n onMouseLeave: this.handleLeaveSlideOrTraveller,\n onMouseDown: this.travellerDragStartHandlers[id],\n onTouchStart: this.travellerDragStartHandlers[id],\n onKeyDown: function onKeyDown(e) {\n if (!['ArrowLeft', 'ArrowRight'].includes(e.key)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n _this3.handleTravellerMoveKeyboard(e.key === 'ArrowRight' ? 1 : -1, id);\n },\n onFocus: function onFocus() {\n _this3.setState({\n isTravellerFocused: true\n });\n },\n onBlur: function onBlur() {\n _this3.setState({\n isTravellerFocused: false\n });\n },\n style: {\n cursor: 'col-resize'\n }\n }, Brush.renderTraveller(traveller, travellerProps));\n }\n }, {\n key: \"renderSlide\",\n value: function renderSlide(startX, endX) {\n var _this$props9 = this.props,\n y = _this$props9.y,\n height = _this$props9.height,\n stroke = _this$props9.stroke,\n travellerWidth = _this$props9.travellerWidth;\n var x = Math.min(startX, endX) + travellerWidth;\n var width = Math.max(Math.abs(endX - startX) - travellerWidth, 0);\n return /*#__PURE__*/React.createElement(\"rect\", {\n className: \"recharts-brush-slide\",\n onMouseEnter: this.handleEnterSlideOrTraveller,\n onMouseLeave: this.handleLeaveSlideOrTraveller,\n onMouseDown: this.handleSlideDragStart,\n onTouchStart: this.handleSlideDragStart,\n style: {\n cursor: 'move'\n },\n stroke: \"none\",\n fill: stroke,\n fillOpacity: 0.2,\n x: x,\n y: y,\n width: width,\n height: height\n });\n }\n }, {\n key: \"renderText\",\n value: function renderText() {\n var _this$props10 = this.props,\n startIndex = _this$props10.startIndex,\n endIndex = _this$props10.endIndex,\n y = _this$props10.y,\n height = _this$props10.height,\n travellerWidth = _this$props10.travellerWidth,\n stroke = _this$props10.stroke;\n var _this$state4 = this.state,\n startX = _this$state4.startX,\n endX = _this$state4.endX;\n var offset = 5;\n var attrs = {\n pointerEvents: 'none',\n fill: stroke\n };\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-brush-texts\"\n }, /*#__PURE__*/React.createElement(Text, _extends({\n textAnchor: \"end\",\n verticalAnchor: \"middle\",\n x: Math.min(startX, endX) - offset,\n y: y + height / 2\n }, attrs), this.getTextOfTick(startIndex)), /*#__PURE__*/React.createElement(Text, _extends({\n textAnchor: \"start\",\n verticalAnchor: \"middle\",\n x: Math.max(startX, endX) + travellerWidth + offset,\n y: y + height / 2\n }, attrs), this.getTextOfTick(endIndex)));\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props11 = this.props,\n data = _this$props11.data,\n className = _this$props11.className,\n children = _this$props11.children,\n x = _this$props11.x,\n y = _this$props11.y,\n width = _this$props11.width,\n height = _this$props11.height,\n alwaysShowText = _this$props11.alwaysShowText;\n var _this$state5 = this.state,\n startX = _this$state5.startX,\n endX = _this$state5.endX,\n isTextActive = _this$state5.isTextActive,\n isSlideMoving = _this$state5.isSlideMoving,\n isTravellerMoving = _this$state5.isTravellerMoving,\n isTravellerFocused = _this$state5.isTravellerFocused;\n if (!data || !data.length || !isNumber(x) || !isNumber(y) || !isNumber(width) || !isNumber(height) || width <= 0 || height <= 0) {\n return null;\n }\n var layerClass = clsx('recharts-brush', className);\n var isPanoramic = React.Children.count(children) === 1;\n var style = generatePrefixStyle('userSelect', 'none');\n return /*#__PURE__*/React.createElement(Layer, {\n className: layerClass,\n onMouseLeave: this.handleLeaveWrapper,\n onTouchMove: this.handleTouchMove,\n style: style\n }, this.renderBackground(), isPanoramic && this.renderPanorama(), this.renderSlide(startX, endX), this.renderTravellerLayer(startX, 'startX'), this.renderTravellerLayer(endX, 'endX'), (isTextActive || isSlideMoving || isTravellerMoving || isTravellerFocused || alwaysShowText) && this.renderText());\n }\n }], [{\n key: \"renderDefaultTraveller\",\n value: function renderDefaultTraveller(props) {\n var x = props.x,\n y = props.y,\n width = props.width,\n height = props.height,\n stroke = props.stroke;\n var lineY = Math.floor(y + height / 2) - 1;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"rect\", {\n x: x,\n y: y,\n width: width,\n height: height,\n fill: stroke,\n stroke: \"none\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: x + 1,\n y1: lineY,\n x2: x + width - 1,\n y2: lineY,\n fill: \"none\",\n stroke: \"#fff\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: x + 1,\n y1: lineY + 2,\n x2: x + width - 1,\n y2: lineY + 2,\n fill: \"none\",\n stroke: \"#fff\"\n }));\n }\n }, {\n key: \"renderTraveller\",\n value: function renderTraveller(option, props) {\n var rectangle;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n rectangle = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n rectangle = option(props);\n } else {\n rectangle = Brush.renderDefaultTraveller(props);\n }\n return rectangle;\n }\n }, {\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n var data = nextProps.data,\n width = nextProps.width,\n x = nextProps.x,\n travellerWidth = nextProps.travellerWidth,\n updateId = nextProps.updateId,\n startIndex = nextProps.startIndex,\n endIndex = nextProps.endIndex;\n if (data !== prevState.prevData || updateId !== prevState.prevUpdateId) {\n return _objectSpread({\n prevData: data,\n prevTravellerWidth: travellerWidth,\n prevUpdateId: updateId,\n prevX: x,\n prevWidth: width\n }, data && data.length ? createScale({\n data: data,\n width: width,\n x: x,\n travellerWidth: travellerWidth,\n startIndex: startIndex,\n endIndex: endIndex\n }) : {\n scale: null,\n scaleValues: null\n });\n }\n if (prevState.scale && (width !== prevState.prevWidth || x !== prevState.prevX || travellerWidth !== prevState.prevTravellerWidth)) {\n prevState.scale.range([x, x + width - travellerWidth]);\n var scaleValues = prevState.scale.domain().map(function (entry) {\n return prevState.scale(entry);\n });\n return {\n prevData: data,\n prevTravellerWidth: travellerWidth,\n prevUpdateId: updateId,\n prevX: x,\n prevWidth: width,\n startX: prevState.scale(nextProps.startIndex),\n endX: prevState.scale(nextProps.endIndex),\n scaleValues: scaleValues\n };\n }\n return null;\n }\n }, {\n key: \"getIndexInRange\",\n value: function getIndexInRange(valueRange, x) {\n var len = valueRange.length;\n var start = 0;\n var end = len - 1;\n while (end - start > 1) {\n var middle = Math.floor((start + end) / 2);\n if (valueRange[middle] > x) {\n end = middle;\n } else {\n start = middle;\n }\n }\n return x >= valueRange[end] ? end : start;\n }\n }]);\n}(PureComponent);\n_defineProperty(Brush, \"displayName\", 'Brush');\n_defineProperty(Brush, \"defaultProps\", {\n height: 40,\n travellerWidth: 5,\n gap: 1,\n fill: '#fff',\n stroke: '#666',\n padding: {\n top: 1,\n right: 1,\n bottom: 1,\n left: 1\n },\n leaveTimeOut: 1000,\n alwaysShowText: false\n});","var baseEach = require('./_baseEach');\n\n/**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n}\n\nmodule.exports = baseSome;\n","var arraySome = require('./_arraySome'),\n baseIteratee = require('./_baseIteratee'),\n baseSome = require('./_baseSome'),\n isArray = require('./isArray'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\nfunction some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nmodule.exports = some;\n","export var ifOverflowMatches = function ifOverflowMatches(props, value) {\n var alwaysShow = props.alwaysShow;\n var ifOverflow = props.ifOverflow;\n if (alwaysShow) {\n ifOverflow = 'extendDomain';\n }\n return ifOverflow === value;\n};","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n baseForOwn = require('./_baseForOwn'),\n baseIteratee = require('./_baseIteratee');\n\n/**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\nfunction mapValues(object, iteratee) {\n var result = {};\n iteratee = baseIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n}\n\nmodule.exports = mapValues;\n","/**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\nfunction arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = arrayEvery;\n","var baseEach = require('./_baseEach');\n\n/**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\nfunction baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n}\n\nmodule.exports = baseEvery;\n","var arrayEvery = require('./_arrayEvery'),\n baseEvery = require('./_baseEvery'),\n baseIteratee = require('./_baseIteratee'),\n isArray = require('./isArray'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\nfunction every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nmodule.exports = every;\n","var _excluded = [\"x\", \"y\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nimport React from 'react';\nimport invariant from 'tiny-invariant';\nimport { Shape } from './ActiveShapeUtils';\nimport { isNullish, isNumber } from './DataUtils';\n\n// Rectangle props is expecting x, y, height, width as numbers, name as a string, and radius as a custom type\n// When props are being spread in from a user defined component in Bar,\n// the prop types of an SVGElement have these typed as something else.\n// This function will return the passed in props\n// along with x, y, height as numbers, name as a string, and radius as number | [number, number, number, number]\nfunction typeguardBarRectangleProps(_ref, props) {\n var xProp = _ref.x,\n yProp = _ref.y,\n option = _objectWithoutProperties(_ref, _excluded);\n var xValue = \"\".concat(xProp);\n var x = parseInt(xValue, 10);\n var yValue = \"\".concat(yProp);\n var y = parseInt(yValue, 10);\n var heightValue = \"\".concat(props.height || option.height);\n var height = parseInt(heightValue, 10);\n var widthValue = \"\".concat(props.width || option.width);\n var width = parseInt(widthValue, 10);\n return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props), option), x ? {\n x: x\n } : {}), y ? {\n y: y\n } : {}), {}, {\n height: height,\n width: width,\n name: props.name,\n radius: props.radius\n });\n}\nexport function BarRectangle(props) {\n return /*#__PURE__*/React.createElement(Shape, _extends({\n shapeType: \"rectangle\",\n propTransformer: typeguardBarRectangleProps,\n activeClassName: \"recharts-active-bar\"\n }, props));\n}\n/**\n * Safely gets minPointSize from from the minPointSize prop if it is a function\n * @param minPointSize minPointSize as passed to the Bar component\n * @param defaultValue default minPointSize\n * @returns minPointSize\n */\nexport var minPointSizeCallback = function minPointSizeCallback(minPointSize) {\n var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n return function (value, index) {\n if (typeof minPointSize === 'number') return minPointSize;\n var isValueNumberOrNil = isNumber(value) || isNullish(value);\n if (isValueNumberOrNil) {\n return minPointSize(value, index);\n }\n !isValueNumberOrNil ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"minPointSize callback function received a value with type of \".concat(_typeof(value), \". Currently only numbers or null/undefined are supported.\")) : invariant(false) : void 0;\n return defaultValue;\n };\n};","var _excluded = [\"value\", \"background\"];\nvar _Bar;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Render a group of bar\n */\nimport React, { PureComponent } from 'react';\nimport clsx from 'clsx';\nimport Animate from 'react-smooth';\nimport isEqual from 'lodash/isEqual';\nimport isNil from 'lodash/isNil';\nimport { Layer } from '../container/Layer';\nimport { ErrorBar } from './ErrorBar';\nimport { Cell } from '../component/Cell';\nimport { LabelList } from '../component/LabelList';\nimport { uniqueId, mathSign, interpolateNumber } from '../util/DataUtils';\nimport { filterProps, findAllByType } from '../util/ReactUtils';\nimport { Global } from '../util/Global';\nimport { getCateCoordinateOfBar, getValueByDataKey, truncateByDomain, getBaseValueOfBar, findPositionOfBar, getTooltipItem } from '../util/ChartUtils';\nimport { adaptEventsOfChild } from '../util/types';\nimport { BarRectangle, minPointSizeCallback } from '../util/BarUtils';\nexport var Bar = /*#__PURE__*/function (_PureComponent) {\n function Bar() {\n var _this;\n _classCallCheck(this, Bar);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, Bar, [].concat(args));\n _defineProperty(_this, \"state\", {\n isAnimationFinished: false\n });\n _defineProperty(_this, \"id\", uniqueId('recharts-bar-'));\n _defineProperty(_this, \"handleAnimationEnd\", function () {\n var onAnimationEnd = _this.props.onAnimationEnd;\n _this.setState({\n isAnimationFinished: true\n });\n if (onAnimationEnd) {\n onAnimationEnd();\n }\n });\n _defineProperty(_this, \"handleAnimationStart\", function () {\n var onAnimationStart = _this.props.onAnimationStart;\n _this.setState({\n isAnimationFinished: false\n });\n if (onAnimationStart) {\n onAnimationStart();\n }\n });\n return _this;\n }\n _inherits(Bar, _PureComponent);\n return _createClass(Bar, [{\n key: \"renderRectanglesStatically\",\n value: function renderRectanglesStatically(data) {\n var _this2 = this;\n var _this$props = this.props,\n shape = _this$props.shape,\n dataKey = _this$props.dataKey,\n activeIndex = _this$props.activeIndex,\n activeBar = _this$props.activeBar;\n var baseProps = filterProps(this.props, false);\n return data && data.map(function (entry, i) {\n var isActive = i === activeIndex;\n var option = isActive ? activeBar : shape;\n var props = _objectSpread(_objectSpread(_objectSpread({}, baseProps), entry), {}, {\n isActive: isActive,\n option: option,\n index: i,\n dataKey: dataKey,\n onAnimationStart: _this2.handleAnimationStart,\n onAnimationEnd: _this2.handleAnimationEnd\n });\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-bar-rectangle\"\n }, adaptEventsOfChild(_this2.props, entry, i), {\n // https://github.com/recharts/recharts/issues/5415\n // eslint-disable-next-line react/no-array-index-key\n key: \"rectangle-\".concat(entry === null || entry === void 0 ? void 0 : entry.x, \"-\").concat(entry === null || entry === void 0 ? void 0 : entry.y, \"-\").concat(entry === null || entry === void 0 ? void 0 : entry.value, \"-\").concat(i)\n }), /*#__PURE__*/React.createElement(BarRectangle, props));\n });\n }\n }, {\n key: \"renderRectanglesWithAnimation\",\n value: function renderRectanglesWithAnimation() {\n var _this3 = this;\n var _this$props2 = this.props,\n data = _this$props2.data,\n layout = _this$props2.layout,\n isAnimationActive = _this$props2.isAnimationActive,\n animationBegin = _this$props2.animationBegin,\n animationDuration = _this$props2.animationDuration,\n animationEasing = _this$props2.animationEasing,\n animationId = _this$props2.animationId;\n var prevData = this.state.prevData;\n return /*#__PURE__*/React.createElement(Animate, {\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing,\n from: {\n t: 0\n },\n to: {\n t: 1\n },\n key: \"bar-\".concat(animationId),\n onAnimationEnd: this.handleAnimationEnd,\n onAnimationStart: this.handleAnimationStart\n }, function (_ref) {\n var t = _ref.t;\n var stepData = data.map(function (entry, index) {\n var prev = prevData && prevData[index];\n if (prev) {\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n var interpolatorWidth = interpolateNumber(prev.width, entry.width);\n var interpolatorHeight = interpolateNumber(prev.height, entry.height);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t),\n width: interpolatorWidth(t),\n height: interpolatorHeight(t)\n });\n }\n if (layout === 'horizontal') {\n var _interpolatorHeight = interpolateNumber(0, entry.height);\n var h = _interpolatorHeight(t);\n return _objectSpread(_objectSpread({}, entry), {}, {\n y: entry.y + entry.height - h,\n height: h\n });\n }\n var interpolator = interpolateNumber(0, entry.width);\n var w = interpolator(t);\n return _objectSpread(_objectSpread({}, entry), {}, {\n width: w\n });\n });\n return /*#__PURE__*/React.createElement(Layer, null, _this3.renderRectanglesStatically(stepData));\n });\n }\n }, {\n key: \"renderRectangles\",\n value: function renderRectangles() {\n var _this$props3 = this.props,\n data = _this$props3.data,\n isAnimationActive = _this$props3.isAnimationActive;\n var prevData = this.state.prevData;\n if (isAnimationActive && data && data.length && (!prevData || !isEqual(prevData, data))) {\n return this.renderRectanglesWithAnimation();\n }\n return this.renderRectanglesStatically(data);\n }\n }, {\n key: \"renderBackground\",\n value: function renderBackground() {\n var _this4 = this;\n var _this$props4 = this.props,\n data = _this$props4.data,\n dataKey = _this$props4.dataKey,\n activeIndex = _this$props4.activeIndex;\n var backgroundProps = filterProps(this.props.background, false);\n return data.map(function (entry, i) {\n var value = entry.value,\n background = entry.background,\n rest = _objectWithoutProperties(entry, _excluded);\n if (!background) {\n return null;\n }\n var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, rest), {}, {\n fill: '#eee'\n }, background), backgroundProps), adaptEventsOfChild(_this4.props, entry, i)), {}, {\n onAnimationStart: _this4.handleAnimationStart,\n onAnimationEnd: _this4.handleAnimationEnd,\n dataKey: dataKey,\n index: i,\n className: 'recharts-bar-background-rectangle'\n });\n return /*#__PURE__*/React.createElement(BarRectangle, _extends({\n key: \"background-bar-\".concat(i),\n option: _this4.props.background,\n isActive: i === activeIndex\n }, props));\n });\n }\n }, {\n key: \"renderErrorBar\",\n value: function renderErrorBar(needClip, clipPathId) {\n if (this.props.isAnimationActive && !this.state.isAnimationFinished) {\n return null;\n }\n var _this$props5 = this.props,\n data = _this$props5.data,\n xAxis = _this$props5.xAxis,\n yAxis = _this$props5.yAxis,\n layout = _this$props5.layout,\n children = _this$props5.children;\n var errorBarItems = findAllByType(children, ErrorBar);\n if (!errorBarItems) {\n return null;\n }\n var offset = layout === 'vertical' ? data[0].height / 2 : data[0].width / 2;\n var dataPointFormatter = function dataPointFormatter(dataPoint, dataKey) {\n /**\n * if the value coming from `getComposedData` is an array then this is a stacked bar chart.\n * arr[1] represents end value of the bar since the data is in the form of [startValue, endValue].\n * */\n var value = Array.isArray(dataPoint.value) ? dataPoint.value[1] : dataPoint.value;\n return {\n x: dataPoint.x,\n y: dataPoint.y,\n value: value,\n errorVal: getValueByDataKey(dataPoint, dataKey)\n };\n };\n var errorBarProps = {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null\n };\n return /*#__PURE__*/React.createElement(Layer, errorBarProps, errorBarItems.map(function (item) {\n return /*#__PURE__*/React.cloneElement(item, {\n key: \"error-bar-\".concat(clipPathId, \"-\").concat(item.props.dataKey),\n data: data,\n xAxis: xAxis,\n yAxis: yAxis,\n layout: layout,\n offset: offset,\n dataPointFormatter: dataPointFormatter\n });\n }));\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props6 = this.props,\n hide = _this$props6.hide,\n data = _this$props6.data,\n className = _this$props6.className,\n xAxis = _this$props6.xAxis,\n yAxis = _this$props6.yAxis,\n left = _this$props6.left,\n top = _this$props6.top,\n width = _this$props6.width,\n height = _this$props6.height,\n isAnimationActive = _this$props6.isAnimationActive,\n background = _this$props6.background,\n id = _this$props6.id;\n if (hide || !data || !data.length) {\n return null;\n }\n var isAnimationFinished = this.state.isAnimationFinished;\n var layerClass = clsx('recharts-bar', className);\n var needClipX = xAxis && xAxis.allowDataOverflow;\n var needClipY = yAxis && yAxis.allowDataOverflow;\n var needClip = needClipX || needClipY;\n var clipPathId = isNil(id) ? this.id : id;\n return /*#__PURE__*/React.createElement(Layer, {\n className: layerClass\n }, needClipX || needClipY ? /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: needClipX ? left : left - width / 2,\n y: needClipY ? top : top - height / 2,\n width: needClipX ? width : width * 2,\n height: needClipY ? height : height * 2\n }))) : null, /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-bar-rectangles\",\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null\n }, background ? this.renderBackground() : null, this.renderRectangles()), this.renderErrorBar(needClip, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, data));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n if (nextProps.animationId !== prevState.prevAnimationId) {\n return {\n prevAnimationId: nextProps.animationId,\n curData: nextProps.data,\n prevData: prevState.curData\n };\n }\n if (nextProps.data !== prevState.curData) {\n return {\n curData: nextProps.data\n };\n }\n return null;\n }\n }]);\n}(PureComponent);\n_Bar = Bar;\n_defineProperty(Bar, \"displayName\", 'Bar');\n_defineProperty(Bar, \"defaultProps\", {\n xAxisId: 0,\n yAxisId: 0,\n legendType: 'rect',\n minPointSize: 0,\n hide: false,\n data: [],\n layout: 'vertical',\n activeBar: false,\n isAnimationActive: !Global.isSsr,\n animationBegin: 0,\n animationDuration: 400,\n animationEasing: 'ease'\n});\n/**\n * Compose the data of each group\n * @param {Object} props Props for the component\n * @param {Object} item An instance of Bar\n * @param {Array} barPosition The offset and size of each bar\n * @param {Object} xAxis The configuration of x-axis\n * @param {Object} yAxis The configuration of y-axis\n * @param {Array} stackedData The stacked data of a bar item\n * @return{Array} Composed data\n */\n_defineProperty(Bar, \"getComposedData\", function (_ref2) {\n var props = _ref2.props,\n item = _ref2.item,\n barPosition = _ref2.barPosition,\n bandSize = _ref2.bandSize,\n xAxis = _ref2.xAxis,\n yAxis = _ref2.yAxis,\n xAxisTicks = _ref2.xAxisTicks,\n yAxisTicks = _ref2.yAxisTicks,\n stackedData = _ref2.stackedData,\n dataStartIndex = _ref2.dataStartIndex,\n displayedData = _ref2.displayedData,\n offset = _ref2.offset;\n var pos = findPositionOfBar(barPosition, item);\n if (!pos) {\n return null;\n }\n var layout = props.layout;\n var itemDefaultProps = item.type.defaultProps;\n var itemProps = itemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, itemDefaultProps), item.props) : item.props;\n var dataKey = itemProps.dataKey,\n children = itemProps.children,\n minPointSizeProp = itemProps.minPointSize;\n var numericAxis = layout === 'horizontal' ? yAxis : xAxis;\n var stackedDomain = stackedData ? numericAxis.scale.domain() : null;\n var baseValue = getBaseValueOfBar({\n numericAxis: numericAxis\n });\n var cells = findAllByType(children, Cell);\n var rects = displayedData.map(function (entry, index) {\n var value, x, y, width, height, background;\n if (stackedData) {\n value = truncateByDomain(stackedData[dataStartIndex + index], stackedDomain);\n } else {\n value = getValueByDataKey(entry, dataKey);\n if (!Array.isArray(value)) {\n value = [baseValue, value];\n }\n }\n var minPointSize = minPointSizeCallback(minPointSizeProp, _Bar.defaultProps.minPointSize)(value[1], index);\n if (layout === 'horizontal') {\n var _ref4;\n var _ref3 = [yAxis.scale(value[0]), yAxis.scale(value[1])],\n baseValueScale = _ref3[0],\n currentValueScale = _ref3[1];\n x = getCateCoordinateOfBar({\n axis: xAxis,\n ticks: xAxisTicks,\n bandSize: bandSize,\n offset: pos.offset,\n entry: entry,\n index: index\n });\n y = (_ref4 = currentValueScale !== null && currentValueScale !== void 0 ? currentValueScale : baseValueScale) !== null && _ref4 !== void 0 ? _ref4 : undefined;\n width = pos.size;\n var computedHeight = baseValueScale - currentValueScale;\n height = Number.isNaN(computedHeight) ? 0 : computedHeight;\n background = {\n x: x,\n y: yAxis.y,\n width: width,\n height: yAxis.height\n };\n if (Math.abs(minPointSize) > 0 && Math.abs(height) < Math.abs(minPointSize)) {\n var delta = mathSign(height || minPointSize) * (Math.abs(minPointSize) - Math.abs(height));\n y -= delta;\n height += delta;\n }\n } else {\n var _ref5 = [xAxis.scale(value[0]), xAxis.scale(value[1])],\n _baseValueScale = _ref5[0],\n _currentValueScale = _ref5[1];\n x = _baseValueScale;\n y = getCateCoordinateOfBar({\n axis: yAxis,\n ticks: yAxisTicks,\n bandSize: bandSize,\n offset: pos.offset,\n entry: entry,\n index: index\n });\n width = _currentValueScale - _baseValueScale;\n height = pos.size;\n background = {\n x: xAxis.x,\n y: y,\n width: xAxis.width,\n height: height\n };\n if (Math.abs(minPointSize) > 0 && Math.abs(width) < Math.abs(minPointSize)) {\n var _delta = mathSign(width || minPointSize) * (Math.abs(minPointSize) - Math.abs(width));\n width += _delta;\n }\n }\n return _objectSpread(_objectSpread(_objectSpread({}, entry), {}, {\n x: x,\n y: y,\n width: width,\n height: height,\n value: stackedData ? value : value[1],\n payload: entry,\n background: background\n }, cells && cells[index] && cells[index].props), {}, {\n tooltipPayload: [getTooltipItem(item, entry)],\n tooltipPosition: {\n x: x + width / 2,\n y: y + height / 2\n }\n });\n });\n return _objectSpread({\n data: rects,\n layout: layout\n }, offset);\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport mapValues from 'lodash/mapValues';\nimport every from 'lodash/every';\nimport { getTicksOfScale, parseScale, checkDomainOfScale, getBandSizeOfAxis } from './ChartUtils';\nimport { findChildByType } from './ReactUtils';\nimport { compareValues, getPercentValue } from './DataUtils';\nimport { Bar } from '../cartesian/Bar';\n\n/**\n * Calculate the scale function, position, width, height of axes\n * @param {Object} props Latest props\n * @param {Object} axisMap The configuration of axes\n * @param {Object} offset The offset of main part in the svg element\n * @param {String} axisType The type of axes, x-axis or y-axis\n * @param {String} chartName The name of chart\n * @return {Object} Configuration\n */\nexport var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {\n var width = props.width,\n height = props.height,\n layout = props.layout,\n children = props.children;\n var ids = Object.keys(axisMap);\n var steps = {\n left: offset.left,\n leftMirror: offset.left,\n right: width - offset.right,\n rightMirror: width - offset.right,\n top: offset.top,\n topMirror: offset.top,\n bottom: height - offset.bottom,\n bottomMirror: height - offset.bottom\n };\n var hasBar = !!findChildByType(children, Bar);\n return ids.reduce(function (result, id) {\n var axis = axisMap[id];\n var orientation = axis.orientation,\n domain = axis.domain,\n _axis$padding = axis.padding,\n padding = _axis$padding === void 0 ? {} : _axis$padding,\n mirror = axis.mirror,\n reversed = axis.reversed;\n var offsetKey = \"\".concat(orientation).concat(mirror ? 'Mirror' : '');\n var calculatedPadding, range, x, y, needSpace;\n if (axis.type === 'number' && (axis.padding === 'gap' || axis.padding === 'no-gap')) {\n var diff = domain[1] - domain[0];\n var smallestDistanceBetweenValues = Infinity;\n var sortedValues = axis.categoricalDomain.sort(compareValues);\n sortedValues.forEach(function (value, index) {\n if (index > 0) {\n smallestDistanceBetweenValues = Math.min((value || 0) - (sortedValues[index - 1] || 0), smallestDistanceBetweenValues);\n }\n });\n if (Number.isFinite(smallestDistanceBetweenValues)) {\n var smallestDistanceInPercent = smallestDistanceBetweenValues / diff;\n var rangeWidth = axis.layout === 'vertical' ? offset.height : offset.width;\n if (axis.padding === 'gap') {\n calculatedPadding = smallestDistanceInPercent * rangeWidth / 2;\n }\n if (axis.padding === 'no-gap') {\n var gap = getPercentValue(props.barCategoryGap, smallestDistanceInPercent * rangeWidth);\n var halfBand = smallestDistanceInPercent * rangeWidth / 2;\n calculatedPadding = halfBand - gap - (halfBand - gap) / rangeWidth * gap;\n }\n }\n }\n if (axisType === 'xAxis') {\n range = [offset.left + (padding.left || 0) + (calculatedPadding || 0), offset.left + offset.width - (padding.right || 0) - (calculatedPadding || 0)];\n } else if (axisType === 'yAxis') {\n range = layout === 'horizontal' ? [offset.top + offset.height - (padding.bottom || 0), offset.top + (padding.top || 0)] : [offset.top + (padding.top || 0) + (calculatedPadding || 0), offset.top + offset.height - (padding.bottom || 0) - (calculatedPadding || 0)];\n } else {\n range = axis.range;\n }\n if (reversed) {\n range = [range[1], range[0]];\n }\n var _parseScale = parseScale(axis, chartName, hasBar),\n scale = _parseScale.scale,\n realScaleType = _parseScale.realScaleType;\n scale.domain(domain).range(range);\n checkDomainOfScale(scale);\n var ticks = getTicksOfScale(scale, _objectSpread(_objectSpread({}, axis), {}, {\n realScaleType: realScaleType\n }));\n if (axisType === 'xAxis') {\n needSpace = orientation === 'top' && !mirror || orientation === 'bottom' && mirror;\n x = offset.left;\n y = steps[offsetKey] - needSpace * axis.height;\n } else if (axisType === 'yAxis') {\n needSpace = orientation === 'left' && !mirror || orientation === 'right' && mirror;\n x = steps[offsetKey] - needSpace * axis.width;\n y = offset.top;\n }\n var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {\n realScaleType: realScaleType,\n x: x,\n y: y,\n scale: scale,\n width: axisType === 'xAxis' ? offset.width : axis.width,\n height: axisType === 'yAxis' ? offset.height : axis.height\n });\n finalAxis.bandSize = getBandSizeOfAxis(finalAxis, ticks);\n if (!axis.hide && axisType === 'xAxis') {\n steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.height;\n } else if (!axis.hide) {\n steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.width;\n }\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));\n }, {});\n};\nexport var rectWithPoints = function rectWithPoints(_ref, _ref2) {\n var x1 = _ref.x,\n y1 = _ref.y;\n var x2 = _ref2.x,\n y2 = _ref2.y;\n return {\n x: Math.min(x1, x2),\n y: Math.min(y1, y2),\n width: Math.abs(x2 - x1),\n height: Math.abs(y2 - y1)\n };\n};\n\n/**\n * Compute the x, y, width, and height of a box from two reference points.\n * @param {Object} coords x1, x2, y1, and y2\n * @return {Object} object\n */\nexport var rectWithCoords = function rectWithCoords(_ref3) {\n var x1 = _ref3.x1,\n y1 = _ref3.y1,\n x2 = _ref3.x2,\n y2 = _ref3.y2;\n return rectWithPoints({\n x: x1,\n y: y1\n }, {\n x: x2,\n y: y2\n });\n};\nexport var ScaleHelper = /*#__PURE__*/function () {\n function ScaleHelper(scale) {\n _classCallCheck(this, ScaleHelper);\n this.scale = scale;\n }\n return _createClass(ScaleHelper, [{\n key: \"domain\",\n get: function get() {\n return this.scale.domain;\n }\n }, {\n key: \"range\",\n get: function get() {\n return this.scale.range;\n }\n }, {\n key: \"rangeMin\",\n get: function get() {\n return this.range()[0];\n }\n }, {\n key: \"rangeMax\",\n get: function get() {\n return this.range()[1];\n }\n }, {\n key: \"bandwidth\",\n get: function get() {\n return this.scale.bandwidth;\n }\n }, {\n key: \"apply\",\n value: function apply(value) {\n var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n bandAware = _ref4.bandAware,\n position = _ref4.position;\n if (value === undefined) {\n return undefined;\n }\n if (position) {\n switch (position) {\n case 'start':\n {\n return this.scale(value);\n }\n case 'middle':\n {\n var offset = this.bandwidth ? this.bandwidth() / 2 : 0;\n return this.scale(value) + offset;\n }\n case 'end':\n {\n var _offset = this.bandwidth ? this.bandwidth() : 0;\n return this.scale(value) + _offset;\n }\n default:\n {\n return this.scale(value);\n }\n }\n }\n if (bandAware) {\n var _offset2 = this.bandwidth ? this.bandwidth() / 2 : 0;\n return this.scale(value) + _offset2;\n }\n return this.scale(value);\n }\n }, {\n key: \"isInRange\",\n value: function isInRange(value) {\n var range = this.range();\n var first = range[0];\n var last = range[range.length - 1];\n return first <= last ? value >= first && value <= last : value >= last && value <= first;\n }\n }], [{\n key: \"create\",\n value: function create(obj) {\n return new ScaleHelper(obj);\n }\n }]);\n}();\n_defineProperty(ScaleHelper, \"EPS\", 1e-4);\nexport var createLabeledScales = function createLabeledScales(options) {\n var scales = Object.keys(options).reduce(function (res, key) {\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, ScaleHelper.create(options[key])));\n }, {});\n return _objectSpread(_objectSpread({}, scales), {}, {\n apply: function apply(coord) {\n var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n bandAware = _ref5.bandAware,\n position = _ref5.position;\n return mapValues(coord, function (value, label) {\n return scales[label].apply(value, {\n bandAware: bandAware,\n position: position\n });\n });\n },\n isInRange: function isInRange(coord) {\n return every(coord, function (value, label) {\n return scales[label].isInRange(value);\n });\n }\n });\n};\n\n/** Normalizes the angle so that 0 <= angle < 180.\n * @param {number} angle Angle in degrees.\n * @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */\nexport function normalizeAngle(angle) {\n return (angle % 180 + 180) % 180;\n}\n\n/** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.\n * @param {Object} size Width and height of the text in a horizontal position.\n * @param {number} angle Angle in degrees in which the text is displayed.\n * @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.\n */\nexport var getAngledRectangleWidth = function getAngledRectangleWidth(_ref6) {\n var width = _ref6.width,\n height = _ref6.height;\n var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Ensure angle is >= 0 && < 180\n var normalizedAngle = normalizeAngle(angle);\n var angleRadians = normalizedAngle * Math.PI / 180;\n\n /* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled\n * width. This threshold defines when each formula should kick in. */\n var angleThreshold = Math.atan(height / width);\n var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);\n return Math.abs(angledWidth);\n};","var baseIteratee = require('./_baseIteratee'),\n isArrayLike = require('./isArrayLike'),\n keys = require('./keys');\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nmodule.exports = createFind;\n","var toFinite = require('./toFinite');\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nmodule.exports = toInteger;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIteratee = require('./_baseIteratee'),\n toInteger = require('./toInteger');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\nfunction findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, baseIteratee(predicate, 3), index);\n}\n\nmodule.exports = findIndex;\n","var createFind = require('./_createFind'),\n findIndex = require('./findIndex');\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nmodule.exports = find;\n","import memoize from 'lodash/memoize';\n/**\n * This is memoized because the viewBox is unlikely to change often\n * - but because it is computed from offset, any change to it would re-render all children.\n *\n * And because we have many readers of the viewBox, and update it only rarely,\n * then let's optimize with memoization.\n */\nexport var calculateViewBox = memoize(function (offset) {\n return {\n x: offset.left,\n y: offset.top,\n width: offset.width,\n height: offset.height\n };\n}, function (offset) {\n return ['l', offset.left, 't', offset.top, 'w', offset.width, 'h', offset.height].join('');\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nimport React, { createContext, useContext } from 'react';\nimport invariant from 'tiny-invariant';\nimport find from 'lodash/find';\nimport every from 'lodash/every';\nimport { calculateViewBox } from '../util/calculateViewBox';\nimport { getAnyElementOfObject } from '../util/DataUtils';\nexport var XAxisContext = /*#__PURE__*/createContext(undefined);\nexport var YAxisContext = /*#__PURE__*/createContext(undefined);\nexport var ViewBoxContext = /*#__PURE__*/createContext(undefined);\nexport var OffsetContext = /*#__PURE__*/createContext({});\nexport var ClipPathIdContext = /*#__PURE__*/createContext(undefined);\nexport var ChartHeightContext = /*#__PURE__*/createContext(0);\nexport var ChartWidthContext = /*#__PURE__*/createContext(0);\n\n/**\n * Will add all the properties required to render all individual Recharts components into a React Context.\n *\n * If you want to read these properties, see the collection of hooks exported from this file.\n *\n * @param {object} props CategoricalChartState, plus children\n * @returns {ReactElement} React Context Provider\n */\nexport var ChartLayoutContextProvider = function ChartLayoutContextProvider(props) {\n var _props$state = props.state,\n xAxisMap = _props$state.xAxisMap,\n yAxisMap = _props$state.yAxisMap,\n offset = _props$state.offset,\n clipPathId = props.clipPathId,\n children = props.children,\n width = props.width,\n height = props.height;\n\n /**\n * Perhaps we should compute this property when reading? Let's see what is more often used\n */\n var viewBox = calculateViewBox(offset);\n\n /*\n * This pretends to be a single context but actually is split into multiple smaller ones.\n * Why?\n * Because one React Context only allows to set one value.\n * But we need to set multiple values.\n * If we do that with one context, then we force re-render on components that might not even be interested\n * in the part of the state that has changed.\n *\n * By splitting into smaller contexts, we allow each components to be optimized and only re-render when its dependencies change.\n *\n * To actually achieve the optimal re-render, it is necessary to use React.memo().\n * See the test file for details.\n */\n return /*#__PURE__*/React.createElement(XAxisContext.Provider, {\n value: xAxisMap\n }, /*#__PURE__*/React.createElement(YAxisContext.Provider, {\n value: yAxisMap\n }, /*#__PURE__*/React.createElement(OffsetContext.Provider, {\n value: offset\n }, /*#__PURE__*/React.createElement(ViewBoxContext.Provider, {\n value: viewBox\n }, /*#__PURE__*/React.createElement(ClipPathIdContext.Provider, {\n value: clipPathId\n }, /*#__PURE__*/React.createElement(ChartHeightContext.Provider, {\n value: height\n }, /*#__PURE__*/React.createElement(ChartWidthContext.Provider, {\n value: width\n }, children)))))));\n};\nexport var useClipPathId = function useClipPathId() {\n return useContext(ClipPathIdContext);\n};\nfunction getKeysForDebug(object) {\n var keys = Object.keys(object);\n if (keys.length === 0) {\n return 'There are no available ids.';\n }\n return \"Available ids are: \".concat(keys, \".\");\n}\n\n/**\n * This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist.\n *\n * @param xAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as \n * @returns axis configuration object\n * @throws Error if no axis with this ID exists\n */\nexport var useXAxisOrThrow = function useXAxisOrThrow(xAxisId) {\n var xAxisMap = useContext(XAxisContext);\n !(xAxisMap != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?') : invariant(false) : void 0;\n var xAxis = xAxisMap[xAxisId];\n !(xAxis != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Could not find xAxis by id \\\"\".concat(xAxisId, \"\\\" [\").concat(_typeof(xAxisId), \"]. \").concat(getKeysForDebug(xAxisMap))) : invariant(false) : void 0;\n return xAxis;\n};\n\n/**\n * This will find an arbitrary first XAxis. If there's exactly one it always returns that one\n * - but if there are multiple then it can return any of those.\n *\n * If you want specific XAxis out of multiple then prefer using useXAxisOrThrow\n *\n * @returns X axisOptions, or undefined - if there are no X axes\n */\nexport var useArbitraryXAxis = function useArbitraryXAxis() {\n var xAxisMap = useContext(XAxisContext);\n return getAnyElementOfObject(xAxisMap);\n};\n\n/**\n * This will find an arbitrary first YAxis. If there's exactly one it always returns that one\n * - but if there are multiple then it can return any of those.\n *\n * If you want specific YAxis out of multiple then prefer using useXAxisOrThrow\n *\n * @returns Y axisOptions, or undefined - if there are no Y axes\n */\nexport var useArbitraryYAxis = function useArbitraryYAxis() {\n var yAxisMap = useContext(YAxisContext);\n return getAnyElementOfObject(yAxisMap);\n};\n\n/**\n * This hooks will:\n * 1st attempt to find an YAxis that has all elements in its domain finite\n * If no such axis exists, it will return an arbitrary YAxis\n * if there are no Y axes then it returns undefined\n *\n * @returns Either Y axisOptions, or undefined if there are no Y axes\n */\nexport var useYAxisWithFiniteDomainOrRandom = function useYAxisWithFiniteDomainOrRandom() {\n var yAxisMap = useContext(YAxisContext);\n var yAxisWithFiniteDomain = find(yAxisMap, function (axis) {\n return every(axis.domain, Number.isFinite);\n });\n return yAxisWithFiniteDomain || getAnyElementOfObject(yAxisMap);\n};\n\n/**\n * This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist.\n *\n * @param yAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as \n * @returns axis configuration object\n * @throws Error if no axis with this ID exists\n */\nexport var useYAxisOrThrow = function useYAxisOrThrow(yAxisId) {\n var yAxisMap = useContext(YAxisContext);\n !(yAxisMap != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?') : invariant(false) : void 0;\n var yAxis = yAxisMap[yAxisId];\n !(yAxis != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Could not find yAxis by id \\\"\".concat(yAxisId, \"\\\" [\").concat(_typeof(yAxisId), \"]. \").concat(getKeysForDebug(yAxisMap))) : invariant(false) : void 0;\n return yAxis;\n};\nexport var useViewBox = function useViewBox() {\n var viewBox = useContext(ViewBoxContext);\n return viewBox;\n};\nexport var useOffset = function useOffset() {\n return useContext(OffsetContext);\n};\nexport var useChartWidth = function useChartWidth() {\n return useContext(ChartWidthContext);\n};\nexport var useChartHeight = function useChartHeight() {\n return useContext(ChartHeightContext);\n};","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n/**\n * @fileOverview Reference Line\n */\nimport React from 'react';\nimport isFunction from 'lodash/isFunction';\nimport some from 'lodash/some';\nimport clsx from 'clsx';\nimport { Layer } from '../container/Layer';\nimport { Label } from '../component/Label';\nimport { ifOverflowMatches } from '../util/IfOverflowMatches';\nimport { isNumOrStr } from '../util/DataUtils';\nimport { createLabeledScales, rectWithCoords } from '../util/CartesianUtils';\nimport { warn } from '../util/LogUtils';\nimport { filterProps } from '../util/ReactUtils';\nimport { useClipPathId, useViewBox, useXAxisOrThrow, useYAxisOrThrow } from '../context/chartLayoutContext';\n\n/**\n * This excludes `viewBox` prop from svg for two reasons:\n * 1. The components wants viewBox of object type, and svg wants string\n * - so there's a conflict, and the component will throw if it gets string\n * 2. Internally the component calls `filterProps` which filters the viewBox away anyway\n */\n\nvar renderLine = function renderLine(option, props) {\n var line;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n line = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n line = option(props);\n } else {\n line = /*#__PURE__*/React.createElement(\"line\", _extends({}, props, {\n className: \"recharts-reference-line-line\"\n }));\n }\n return line;\n};\n// TODO: ScaleHelper\nexport var getEndPoints = function getEndPoints(scales, isFixedX, isFixedY, isSegment, viewBox, position, xAxisOrientation, yAxisOrientation, props) {\n var x = viewBox.x,\n y = viewBox.y,\n width = viewBox.width,\n height = viewBox.height;\n if (isFixedY) {\n var yCoord = props.y;\n var coord = scales.y.apply(yCoord, {\n position: position\n });\n if (ifOverflowMatches(props, 'discard') && !scales.y.isInRange(coord)) {\n return null;\n }\n var points = [{\n x: x + width,\n y: coord\n }, {\n x: x,\n y: coord\n }];\n return yAxisOrientation === 'left' ? points.reverse() : points;\n }\n if (isFixedX) {\n var xCoord = props.x;\n var _coord = scales.x.apply(xCoord, {\n position: position\n });\n if (ifOverflowMatches(props, 'discard') && !scales.x.isInRange(_coord)) {\n return null;\n }\n var _points = [{\n x: _coord,\n y: y + height\n }, {\n x: _coord,\n y: y\n }];\n return xAxisOrientation === 'top' ? _points.reverse() : _points;\n }\n if (isSegment) {\n var segment = props.segment;\n var _points2 = segment.map(function (p) {\n return scales.apply(p, {\n position: position\n });\n });\n if (ifOverflowMatches(props, 'discard') && some(_points2, function (p) {\n return !scales.isInRange(p);\n })) {\n return null;\n }\n return _points2;\n }\n return null;\n};\nfunction ReferenceLineImpl(props) {\n var fixedX = props.x,\n fixedY = props.y,\n segment = props.segment,\n xAxisId = props.xAxisId,\n yAxisId = props.yAxisId,\n shape = props.shape,\n className = props.className,\n alwaysShow = props.alwaysShow;\n var clipPathId = useClipPathId();\n var xAxis = useXAxisOrThrow(xAxisId);\n var yAxis = useYAxisOrThrow(yAxisId);\n var viewBox = useViewBox();\n if (!clipPathId || !viewBox) {\n return null;\n }\n warn(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow=\"extendDomain\" instead.');\n var scales = createLabeledScales({\n x: xAxis.scale,\n y: yAxis.scale\n });\n var isX = isNumOrStr(fixedX);\n var isY = isNumOrStr(fixedY);\n var isSegment = segment && segment.length === 2;\n var endPoints = getEndPoints(scales, isX, isY, isSegment, viewBox, props.position, xAxis.orientation, yAxis.orientation, props);\n if (!endPoints) {\n return null;\n }\n var _endPoints = _slicedToArray(endPoints, 2),\n _endPoints$ = _endPoints[0],\n x1 = _endPoints$.x,\n y1 = _endPoints$.y,\n _endPoints$2 = _endPoints[1],\n x2 = _endPoints$2.x,\n y2 = _endPoints$2.y;\n var clipPath = ifOverflowMatches(props, 'hidden') ? \"url(#\".concat(clipPathId, \")\") : undefined;\n var lineProps = _objectSpread(_objectSpread({\n clipPath: clipPath\n }, filterProps(props, true)), {}, {\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-reference-line', className)\n }, renderLine(shape, lineProps), Label.renderCallByParent(props, rectWithCoords({\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2\n })));\n}\n\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var ReferenceLine = /*#__PURE__*/function (_React$Component) {\n function ReferenceLine() {\n _classCallCheck(this, ReferenceLine);\n return _callSuper(this, ReferenceLine, arguments);\n }\n _inherits(ReferenceLine, _React$Component);\n return _createClass(ReferenceLine, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ReferenceLineImpl, this.props);\n }\n }]);\n}(React.Component);\n_defineProperty(ReferenceLine, \"displayName\", 'ReferenceLine');\n_defineProperty(ReferenceLine, \"defaultProps\", {\n isFront: false,\n ifOverflow: 'discard',\n xAxisId: 0,\n yAxisId: 0,\n fill: 'none',\n stroke: '#ccc',\n fillOpacity: 1,\n strokeWidth: 1,\n position: 'middle'\n});","function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Reference Dot\n */\nimport React from 'react';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { Layer } from '../container/Layer';\nimport { Dot } from '../shape/Dot';\nimport { Label } from '../component/Label';\nimport { isNumOrStr } from '../util/DataUtils';\nimport { ifOverflowMatches } from '../util/IfOverflowMatches';\nimport { createLabeledScales } from '../util/CartesianUtils';\nimport { warn } from '../util/LogUtils';\nimport { filterProps } from '../util/ReactUtils';\nvar getCoordinate = function getCoordinate(props) {\n var x = props.x,\n y = props.y,\n xAxis = props.xAxis,\n yAxis = props.yAxis;\n var scales = createLabeledScales({\n x: xAxis.scale,\n y: yAxis.scale\n });\n var result = scales.apply({\n x: x,\n y: y\n }, {\n bandAware: true\n });\n if (ifOverflowMatches(props, 'discard') && !scales.isInRange(result)) {\n return null;\n }\n return result;\n};\n\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var ReferenceDot = /*#__PURE__*/function (_React$Component) {\n function ReferenceDot() {\n _classCallCheck(this, ReferenceDot);\n return _callSuper(this, ReferenceDot, arguments);\n }\n _inherits(ReferenceDot, _React$Component);\n return _createClass(ReferenceDot, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n x = _this$props.x,\n y = _this$props.y,\n r = _this$props.r,\n alwaysShow = _this$props.alwaysShow,\n clipPathId = _this$props.clipPathId;\n var isX = isNumOrStr(x);\n var isY = isNumOrStr(y);\n warn(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow=\"extendDomain\" instead.');\n if (!isX || !isY) {\n return null;\n }\n var coordinate = getCoordinate(this.props);\n if (!coordinate) {\n return null;\n }\n var cx = coordinate.x,\n cy = coordinate.y;\n var _this$props2 = this.props,\n shape = _this$props2.shape,\n className = _this$props2.className;\n var clipPath = ifOverflowMatches(this.props, 'hidden') ? \"url(#\".concat(clipPathId, \")\") : undefined;\n var dotProps = _objectSpread(_objectSpread({\n clipPath: clipPath\n }, filterProps(this.props, true)), {}, {\n cx: cx,\n cy: cy\n });\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-reference-dot', className)\n }, ReferenceDot.renderDot(shape, dotProps), Label.renderCallByParent(this.props, {\n x: cx - r,\n y: cy - r,\n width: 2 * r,\n height: 2 * r\n }));\n }\n }]);\n}(React.Component);\n_defineProperty(ReferenceDot, \"displayName\", 'ReferenceDot');\n_defineProperty(ReferenceDot, \"defaultProps\", {\n isFront: false,\n ifOverflow: 'discard',\n xAxisId: 0,\n yAxisId: 0,\n r: 10,\n fill: '#fff',\n stroke: '#ccc',\n fillOpacity: 1,\n strokeWidth: 1\n});\n_defineProperty(ReferenceDot, \"renderDot\", function (option, props) {\n var dot;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n dot = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n dot = option(props);\n } else {\n dot = /*#__PURE__*/React.createElement(Dot, _extends({}, props, {\n cx: props.cx,\n cy: props.cy,\n className: \"recharts-reference-dot-dot\"\n }));\n }\n return dot;\n});","function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Reference Line\n */\nimport React from 'react';\nimport isFunction from 'lodash/isFunction';\nimport clsx from 'clsx';\nimport { Layer } from '../container/Layer';\nimport { Label } from '../component/Label';\nimport { createLabeledScales, rectWithPoints } from '../util/CartesianUtils';\nimport { ifOverflowMatches } from '../util/IfOverflowMatches';\nimport { isNumOrStr } from '../util/DataUtils';\nimport { warn } from '../util/LogUtils';\nimport { Rectangle } from '../shape/Rectangle';\nimport { filterProps } from '../util/ReactUtils';\nvar getRect = function getRect(hasX1, hasX2, hasY1, hasY2, props) {\n var xValue1 = props.x1,\n xValue2 = props.x2,\n yValue1 = props.y1,\n yValue2 = props.y2,\n xAxis = props.xAxis,\n yAxis = props.yAxis;\n if (!xAxis || !yAxis) return null;\n var scales = createLabeledScales({\n x: xAxis.scale,\n y: yAxis.scale\n });\n var p1 = {\n x: hasX1 ? scales.x.apply(xValue1, {\n position: 'start'\n }) : scales.x.rangeMin,\n y: hasY1 ? scales.y.apply(yValue1, {\n position: 'start'\n }) : scales.y.rangeMin\n };\n var p2 = {\n x: hasX2 ? scales.x.apply(xValue2, {\n position: 'end'\n }) : scales.x.rangeMax,\n y: hasY2 ? scales.y.apply(yValue2, {\n position: 'end'\n }) : scales.y.rangeMax\n };\n if (ifOverflowMatches(props, 'discard') && (!scales.isInRange(p1) || !scales.isInRange(p2))) {\n return null;\n }\n return rectWithPoints(p1, p2);\n};\n\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var ReferenceArea = /*#__PURE__*/function (_React$Component) {\n function ReferenceArea() {\n _classCallCheck(this, ReferenceArea);\n return _callSuper(this, ReferenceArea, arguments);\n }\n _inherits(ReferenceArea, _React$Component);\n return _createClass(ReferenceArea, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n x1 = _this$props.x1,\n x2 = _this$props.x2,\n y1 = _this$props.y1,\n y2 = _this$props.y2,\n className = _this$props.className,\n alwaysShow = _this$props.alwaysShow,\n clipPathId = _this$props.clipPathId;\n warn(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow=\"extendDomain\" instead.');\n var hasX1 = isNumOrStr(x1);\n var hasX2 = isNumOrStr(x2);\n var hasY1 = isNumOrStr(y1);\n var hasY2 = isNumOrStr(y2);\n var shape = this.props.shape;\n if (!hasX1 && !hasX2 && !hasY1 && !hasY2 && !shape) {\n return null;\n }\n var rect = getRect(hasX1, hasX2, hasY1, hasY2, this.props);\n if (!rect && !shape) {\n return null;\n }\n var clipPath = ifOverflowMatches(this.props, 'hidden') ? \"url(#\".concat(clipPathId, \")\") : undefined;\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-reference-area', className)\n }, ReferenceArea.renderRect(shape, _objectSpread(_objectSpread({\n clipPath: clipPath\n }, filterProps(this.props, true)), rect)), Label.renderCallByParent(this.props, rect));\n }\n }]);\n}(React.Component);\n_defineProperty(ReferenceArea, \"displayName\", 'ReferenceArea');\n_defineProperty(ReferenceArea, \"defaultProps\", {\n isFront: false,\n ifOverflow: 'discard',\n xAxisId: 0,\n yAxisId: 0,\n r: 10,\n fill: '#ccc',\n fillOpacity: 0.5,\n stroke: 'none',\n strokeWidth: 1\n});\n_defineProperty(ReferenceArea, \"renderRect\", function (option, props) {\n var rect;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n rect = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n rect = option(props);\n } else {\n rect = /*#__PURE__*/React.createElement(Rectangle, _extends({}, props, {\n className: \"recharts-reference-area-rect\"\n }));\n }\n return rect;\n});","/**\n * Given an array and a number N, return a new array which contains every nTh\n * element of the input array. For n below 1, an empty array is returned.\n * If isValid is provided, all candidates must suffice the condition, else undefined is returned.\n * @param {T[]} array An input array.\n * @param {integer} n A number\n * @param {Function} isValid A function to evaluate a candidate form the array\n * @returns {T[]} The result array of the same type as the input array.\n */\nexport function getEveryNthWithCondition(array, n, isValid) {\n if (n < 1) {\n return [];\n }\n if (n === 1 && isValid === undefined) {\n return array;\n }\n var result = [];\n for (var i = 0; i < array.length; i += n) {\n if (isValid === undefined || isValid(array[i]) === true) {\n result.push(array[i]);\n } else {\n return undefined;\n }\n }\n return result;\n}","import { getAngledRectangleWidth } from './CartesianUtils';\nimport { getEveryNthWithCondition } from './getEveryNthWithCondition';\nexport function getAngledTickWidth(contentSize, unitSize, angle) {\n var size = {\n width: contentSize.width + unitSize.width,\n height: contentSize.height + unitSize.height\n };\n return getAngledRectangleWidth(size, angle);\n}\nexport function getTickBoundaries(viewBox, sign, sizeKey) {\n var isWidth = sizeKey === 'width';\n var x = viewBox.x,\n y = viewBox.y,\n width = viewBox.width,\n height = viewBox.height;\n if (sign === 1) {\n return {\n start: isWidth ? x : y,\n end: isWidth ? x + width : y + height\n };\n }\n return {\n start: isWidth ? x + width : y + height,\n end: isWidth ? x : y\n };\n}\nexport function isVisible(sign, tickPosition, getSize, start, end) {\n /* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating\n * the tick's size. */\n if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {\n return false;\n }\n var size = getSize();\n return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;\n}\nexport function getNumberIntervalTicks(ticks, interval) {\n return getEveryNthWithCondition(ticks, interval + 1);\n}","import { isVisible } from '../util/TickUtils';\nimport { getEveryNthWithCondition } from '../util/getEveryNthWithCondition';\nexport function getEquidistantTicks(sign, boundaries, getTickSize, ticks, minTickGap) {\n var result = (ticks || []).slice();\n var initialStart = boundaries.start,\n end = boundaries.end;\n var index = 0;\n // Premature optimisation idea 1: Estimate a lower bound, and start from there.\n // For now, start from every tick\n var stepsize = 1;\n var start = initialStart;\n var _loop = function _loop() {\n // Given stepsize, evaluate whether every stepsize-th tick can be shown.\n // If it can not, then increase the stepsize by 1, and try again.\n\n var entry = ticks === null || ticks === void 0 ? void 0 : ticks[index];\n\n // Break condition - If we have evaluate all the ticks, then we are done.\n if (entry === undefined) {\n return {\n v: getEveryNthWithCondition(ticks, stepsize)\n };\n }\n\n // Check if the element collides with the next element\n var i = index;\n var size;\n var getSize = function getSize() {\n if (size === undefined) {\n size = getTickSize(entry, i);\n }\n return size;\n };\n var tickCoord = entry.coordinate;\n // We will always show the first tick.\n var isShow = index === 0 || isVisible(sign, tickCoord, getSize, start, end);\n if (!isShow) {\n // Start all over with a larger stepsize\n index = 0;\n start = initialStart;\n stepsize += 1;\n }\n if (isShow) {\n // If it can be shown, update the start\n start = tickCoord + sign * (getSize() / 2 + minTickGap);\n index += stepsize;\n }\n },\n _ret;\n while (stepsize <= result.length) {\n _ret = _loop();\n if (_ret) return _ret.v;\n }\n return [];\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport isFunction from 'lodash/isFunction';\nimport { mathSign, isNumber } from '../util/DataUtils';\nimport { getStringSize } from '../util/DOMUtils';\nimport { Global } from '../util/Global';\nimport { isVisible, getTickBoundaries, getNumberIntervalTicks, getAngledTickWidth } from '../util/TickUtils';\nimport { getEquidistantTicks } from './getEquidistantTicks';\nfunction getTicksEnd(sign, boundaries, getTickSize, ticks, minTickGap) {\n var result = (ticks || []).slice();\n var len = result.length;\n var start = boundaries.start;\n var end = boundaries.end;\n var _loop = function _loop(i) {\n var entry = result[i];\n var size;\n var getSize = function getSize() {\n if (size === undefined) {\n size = getTickSize(entry, i);\n }\n return size;\n };\n if (i === len - 1) {\n var gap = sign * (entry.coordinate + sign * getSize() / 2 - end);\n result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {\n tickCoord: gap > 0 ? entry.coordinate - gap * sign : entry.coordinate\n });\n } else {\n result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {\n tickCoord: entry.coordinate\n });\n }\n var isShow = isVisible(sign, entry.tickCoord, getSize, start, end);\n if (isShow) {\n end = entry.tickCoord - sign * (getSize() / 2 + minTickGap);\n result[i] = _objectSpread(_objectSpread({}, entry), {}, {\n isShow: true\n });\n }\n };\n for (var i = len - 1; i >= 0; i--) {\n _loop(i);\n }\n return result;\n}\nfunction getTicksStart(sign, boundaries, getTickSize, ticks, minTickGap, preserveEnd) {\n var result = (ticks || []).slice();\n var len = result.length;\n var start = boundaries.start,\n end = boundaries.end;\n if (preserveEnd) {\n // Try to guarantee the tail to be displayed\n var tail = ticks[len - 1];\n var tailSize = getTickSize(tail, len - 1);\n var tailGap = sign * (tail.coordinate + sign * tailSize / 2 - end);\n result[len - 1] = tail = _objectSpread(_objectSpread({}, tail), {}, {\n tickCoord: tailGap > 0 ? tail.coordinate - tailGap * sign : tail.coordinate\n });\n var isTailShow = isVisible(sign, tail.tickCoord, function () {\n return tailSize;\n }, start, end);\n if (isTailShow) {\n end = tail.tickCoord - sign * (tailSize / 2 + minTickGap);\n result[len - 1] = _objectSpread(_objectSpread({}, tail), {}, {\n isShow: true\n });\n }\n }\n var count = preserveEnd ? len - 1 : len;\n var _loop2 = function _loop2(i) {\n var entry = result[i];\n var size;\n var getSize = function getSize() {\n if (size === undefined) {\n size = getTickSize(entry, i);\n }\n return size;\n };\n if (i === 0) {\n var gap = sign * (entry.coordinate - sign * getSize() / 2 - start);\n result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {\n tickCoord: gap < 0 ? entry.coordinate - gap * sign : entry.coordinate\n });\n } else {\n result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {\n tickCoord: entry.coordinate\n });\n }\n var isShow = isVisible(sign, entry.tickCoord, getSize, start, end);\n if (isShow) {\n start = entry.tickCoord + sign * (getSize() / 2 + minTickGap);\n result[i] = _objectSpread(_objectSpread({}, entry), {}, {\n isShow: true\n });\n }\n };\n for (var i = 0; i < count; i++) {\n _loop2(i);\n }\n return result;\n}\nexport function getTicks(props, fontSize, letterSpacing) {\n var tick = props.tick,\n ticks = props.ticks,\n viewBox = props.viewBox,\n minTickGap = props.minTickGap,\n orientation = props.orientation,\n interval = props.interval,\n tickFormatter = props.tickFormatter,\n unit = props.unit,\n angle = props.angle;\n if (!ticks || !ticks.length || !tick) {\n return [];\n }\n if (isNumber(interval) || Global.isSsr) {\n return getNumberIntervalTicks(ticks, typeof interval === 'number' && isNumber(interval) ? interval : 0);\n }\n var candidates = [];\n var sizeKey = orientation === 'top' || orientation === 'bottom' ? 'width' : 'height';\n var unitSize = unit && sizeKey === 'width' ? getStringSize(unit, {\n fontSize: fontSize,\n letterSpacing: letterSpacing\n }) : {\n width: 0,\n height: 0\n };\n var getTickSize = function getTickSize(content, index) {\n var value = isFunction(tickFormatter) ? tickFormatter(content.value, index) : content.value;\n // Recharts only supports angles when sizeKey === 'width'\n return sizeKey === 'width' ? getAngledTickWidth(getStringSize(value, {\n fontSize: fontSize,\n letterSpacing: letterSpacing\n }), unitSize, angle) : getStringSize(value, {\n fontSize: fontSize,\n letterSpacing: letterSpacing\n })[sizeKey];\n };\n var sign = ticks.length >= 2 ? mathSign(ticks[1].coordinate - ticks[0].coordinate) : 1;\n var boundaries = getTickBoundaries(viewBox, sign, sizeKey);\n if (interval === 'equidistantPreserveStart') {\n return getEquidistantTicks(sign, boundaries, getTickSize, ticks, minTickGap);\n }\n if (interval === 'preserveStart' || interval === 'preserveStartEnd') {\n candidates = getTicksStart(sign, boundaries, getTickSize, ticks, minTickGap, interval === 'preserveStartEnd');\n } else {\n candidates = getTicksEnd(sign, boundaries, getTickSize, ticks, minTickGap);\n }\n return candidates.filter(function (entry) {\n return entry.isShow;\n });\n}","var _excluded = [\"viewBox\"],\n _excluded2 = [\"viewBox\"],\n _excluded3 = [\"ticks\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Cartesian Axis\n */\nimport React, { Component } from 'react';\nimport isFunction from 'lodash/isFunction';\nimport get from 'lodash/get';\nimport clsx from 'clsx';\nimport { shallowEqual } from '../util/ShallowEqual';\nimport { Layer } from '../container/Layer';\nimport { Text } from '../component/Text';\nimport { Label } from '../component/Label';\nimport { isNumber } from '../util/DataUtils';\nimport { adaptEventsOfChild } from '../util/types';\nimport { filterProps } from '../util/ReactUtils';\nimport { getTicks } from './getTicks';\n\n/** The orientation of the axis in correspondence to the chart */\n\n/** A unit to be appended to a value */\n\n/** The formatter function of tick */\n\nexport var CartesianAxis = /*#__PURE__*/function (_Component) {\n function CartesianAxis(props) {\n var _this;\n _classCallCheck(this, CartesianAxis);\n _this = _callSuper(this, CartesianAxis, [props]);\n _this.state = {\n fontSize: '',\n letterSpacing: ''\n };\n return _this;\n }\n _inherits(CartesianAxis, _Component);\n return _createClass(CartesianAxis, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(_ref, nextState) {\n var viewBox = _ref.viewBox,\n restProps = _objectWithoutProperties(_ref, _excluded);\n // props.viewBox is sometimes generated every time -\n // check that specially as object equality is likely to fail\n var _this$props = this.props,\n viewBoxOld = _this$props.viewBox,\n restPropsOld = _objectWithoutProperties(_this$props, _excluded2);\n return !shallowEqual(viewBox, viewBoxOld) || !shallowEqual(restProps, restPropsOld) || !shallowEqual(nextState, this.state);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var htmlLayer = this.layerReference;\n if (!htmlLayer) return;\n var tick = htmlLayer.getElementsByClassName('recharts-cartesian-axis-tick-value')[0];\n if (tick) {\n this.setState({\n fontSize: window.getComputedStyle(tick).fontSize,\n letterSpacing: window.getComputedStyle(tick).letterSpacing\n });\n }\n }\n\n /**\n * Calculate the coordinates of endpoints in ticks\n * @param {Object} data The data of a simple tick\n * @return {Object} (x1, y1): The coordinate of endpoint close to tick text\n * (x2, y2): The coordinate of endpoint close to axis\n */\n }, {\n key: \"getTickLineCoord\",\n value: function getTickLineCoord(data) {\n var _this$props2 = this.props,\n x = _this$props2.x,\n y = _this$props2.y,\n width = _this$props2.width,\n height = _this$props2.height,\n orientation = _this$props2.orientation,\n tickSize = _this$props2.tickSize,\n mirror = _this$props2.mirror,\n tickMargin = _this$props2.tickMargin;\n var x1, x2, y1, y2, tx, ty;\n var sign = mirror ? -1 : 1;\n var finalTickSize = data.tickSize || tickSize;\n var tickCoord = isNumber(data.tickCoord) ? data.tickCoord : data.coordinate;\n switch (orientation) {\n case 'top':\n x1 = x2 = data.coordinate;\n y2 = y + +!mirror * height;\n y1 = y2 - sign * finalTickSize;\n ty = y1 - sign * tickMargin;\n tx = tickCoord;\n break;\n case 'left':\n y1 = y2 = data.coordinate;\n x2 = x + +!mirror * width;\n x1 = x2 - sign * finalTickSize;\n tx = x1 - sign * tickMargin;\n ty = tickCoord;\n break;\n case 'right':\n y1 = y2 = data.coordinate;\n x2 = x + +mirror * width;\n x1 = x2 + sign * finalTickSize;\n tx = x1 + sign * tickMargin;\n ty = tickCoord;\n break;\n default:\n x1 = x2 = data.coordinate;\n y2 = y + +mirror * height;\n y1 = y2 + sign * finalTickSize;\n ty = y1 + sign * tickMargin;\n tx = tickCoord;\n break;\n }\n return {\n line: {\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2\n },\n tick: {\n x: tx,\n y: ty\n }\n };\n }\n }, {\n key: \"getTickTextAnchor\",\n value: function getTickTextAnchor() {\n var _this$props3 = this.props,\n orientation = _this$props3.orientation,\n mirror = _this$props3.mirror;\n var textAnchor;\n switch (orientation) {\n case 'left':\n textAnchor = mirror ? 'start' : 'end';\n break;\n case 'right':\n textAnchor = mirror ? 'end' : 'start';\n break;\n default:\n textAnchor = 'middle';\n break;\n }\n return textAnchor;\n }\n }, {\n key: \"getTickVerticalAnchor\",\n value: function getTickVerticalAnchor() {\n var _this$props4 = this.props,\n orientation = _this$props4.orientation,\n mirror = _this$props4.mirror;\n var verticalAnchor = 'end';\n switch (orientation) {\n case 'left':\n case 'right':\n verticalAnchor = 'middle';\n break;\n case 'top':\n verticalAnchor = mirror ? 'start' : 'end';\n break;\n default:\n verticalAnchor = mirror ? 'end' : 'start';\n break;\n }\n return verticalAnchor;\n }\n }, {\n key: \"renderAxisLine\",\n value: function renderAxisLine() {\n var _this$props5 = this.props,\n x = _this$props5.x,\n y = _this$props5.y,\n width = _this$props5.width,\n height = _this$props5.height,\n orientation = _this$props5.orientation,\n mirror = _this$props5.mirror,\n axisLine = _this$props5.axisLine;\n var props = _objectSpread(_objectSpread(_objectSpread({}, filterProps(this.props, false)), filterProps(axisLine, false)), {}, {\n fill: 'none'\n });\n if (orientation === 'top' || orientation === 'bottom') {\n var needHeight = +(orientation === 'top' && !mirror || orientation === 'bottom' && mirror);\n props = _objectSpread(_objectSpread({}, props), {}, {\n x1: x,\n y1: y + needHeight * height,\n x2: x + width,\n y2: y + needHeight * height\n });\n } else {\n var needWidth = +(orientation === 'left' && !mirror || orientation === 'right' && mirror);\n props = _objectSpread(_objectSpread({}, props), {}, {\n x1: x + needWidth * width,\n y1: y,\n x2: x + needWidth * width,\n y2: y + height\n });\n }\n return /*#__PURE__*/React.createElement(\"line\", _extends({}, props, {\n className: clsx('recharts-cartesian-axis-line', get(axisLine, 'className'))\n }));\n }\n }, {\n key: \"renderTicks\",\n value:\n /**\n * render the ticks\n * @param {Array} ticks The ticks to actually render (overrides what was passed in props)\n * @param {string} fontSize Fontsize to consider for tick spacing\n * @param {string} letterSpacing Letterspacing to consider for tick spacing\n * @return {ReactComponent} renderedTicks\n */\n function renderTicks(ticks, fontSize, letterSpacing) {\n var _this2 = this;\n var _this$props6 = this.props,\n tickLine = _this$props6.tickLine,\n stroke = _this$props6.stroke,\n tick = _this$props6.tick,\n tickFormatter = _this$props6.tickFormatter,\n unit = _this$props6.unit;\n var finalTicks = getTicks(_objectSpread(_objectSpread({}, this.props), {}, {\n ticks: ticks\n }), fontSize, letterSpacing);\n var textAnchor = this.getTickTextAnchor();\n var verticalAnchor = this.getTickVerticalAnchor();\n var axisProps = filterProps(this.props, false);\n var customTickProps = filterProps(tick, false);\n var tickLineProps = _objectSpread(_objectSpread({}, axisProps), {}, {\n fill: 'none'\n }, filterProps(tickLine, false));\n var items = finalTicks.map(function (entry, i) {\n var _this2$getTickLineCoo = _this2.getTickLineCoord(entry),\n lineCoord = _this2$getTickLineCoo.line,\n tickCoord = _this2$getTickLineCoo.tick;\n var tickProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({\n textAnchor: textAnchor,\n verticalAnchor: verticalAnchor\n }, axisProps), {}, {\n stroke: 'none',\n fill: stroke\n }, customTickProps), tickCoord), {}, {\n index: i,\n payload: entry,\n visibleTicksCount: finalTicks.length,\n tickFormatter: tickFormatter\n });\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-cartesian-axis-tick\",\n key: \"tick-\".concat(entry.value, \"-\").concat(entry.coordinate, \"-\").concat(entry.tickCoord)\n }, adaptEventsOfChild(_this2.props, entry, i)), tickLine && /*#__PURE__*/React.createElement(\"line\", _extends({}, tickLineProps, lineCoord, {\n className: clsx('recharts-cartesian-axis-tick-line', get(tickLine, 'className'))\n })), tick && CartesianAxis.renderTickItem(tick, tickProps, \"\".concat(isFunction(tickFormatter) ? tickFormatter(entry.value, i) : entry.value).concat(unit || '')));\n });\n return /*#__PURE__*/React.createElement(\"g\", {\n className: \"recharts-cartesian-axis-ticks\"\n }, items);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n var _this$props7 = this.props,\n axisLine = _this$props7.axisLine,\n width = _this$props7.width,\n height = _this$props7.height,\n ticksGenerator = _this$props7.ticksGenerator,\n className = _this$props7.className,\n hide = _this$props7.hide;\n if (hide) {\n return null;\n }\n var _this$props8 = this.props,\n ticks = _this$props8.ticks,\n noTicksProps = _objectWithoutProperties(_this$props8, _excluded3);\n var finalTicks = ticks;\n if (isFunction(ticksGenerator)) {\n finalTicks = ticks && ticks.length > 0 ? ticksGenerator(this.props) : ticksGenerator(noTicksProps);\n }\n if (width <= 0 || height <= 0 || !finalTicks || !finalTicks.length) {\n return null;\n }\n return /*#__PURE__*/React.createElement(Layer, {\n className: clsx('recharts-cartesian-axis', className),\n ref: function ref(_ref2) {\n _this3.layerReference = _ref2;\n }\n }, axisLine && this.renderAxisLine(), this.renderTicks(finalTicks, this.state.fontSize, this.state.letterSpacing), Label.renderCallByParent(this.props));\n }\n }], [{\n key: \"renderTickItem\",\n value: function renderTickItem(option, props, value) {\n var tickItem;\n var combinedClassName = clsx(props.className, 'recharts-cartesian-axis-tick-value');\n if ( /*#__PURE__*/React.isValidElement(option)) {\n tickItem = /*#__PURE__*/React.cloneElement(option, _objectSpread(_objectSpread({}, props), {}, {\n className: combinedClassName\n }));\n } else if (isFunction(option)) {\n tickItem = option(_objectSpread(_objectSpread({}, props), {}, {\n className: combinedClassName\n }));\n } else {\n tickItem = /*#__PURE__*/React.createElement(Text, _extends({}, props, {\n className: \"recharts-cartesian-axis-tick-value\"\n }), value);\n }\n return tickItem;\n }\n }]);\n}(Component);\n_defineProperty(CartesianAxis, \"displayName\", 'CartesianAxis');\n_defineProperty(CartesianAxis, \"defaultProps\", {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n viewBox: {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n },\n // The orientation of axis\n orientation: 'bottom',\n // The ticks\n ticks: [],\n stroke: '#666',\n tickLine: true,\n axisLine: true,\n tick: true,\n mirror: false,\n minTickGap: 5,\n // The width or height of tick\n tickSize: 6,\n tickMargin: 2,\n interval: 'preserveEnd'\n});","var _excluded = [\"x1\", \"y1\", \"x2\", \"y2\", \"key\"],\n _excluded2 = [\"offset\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\n/**\n * @fileOverview Cartesian Grid\n */\nimport React from 'react';\nimport isFunction from 'lodash/isFunction';\nimport { warn } from '../util/LogUtils';\nimport { isNumber } from '../util/DataUtils';\nimport { filterProps } from '../util/ReactUtils';\nimport { getCoordinatesOfGrid, getTicksOfAxis } from '../util/ChartUtils';\nimport { getTicks } from './getTicks';\nimport { CartesianAxis } from './CartesianAxis';\nimport { useArbitraryXAxis, useChartHeight, useChartWidth, useOffset, useYAxisWithFiniteDomainOrRandom } from '../context/chartLayoutContext';\n\n/**\n * The = 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Line\n */\nimport React, { PureComponent } from 'react';\nimport Animate from 'react-smooth';\nimport isFunction from 'lodash/isFunction';\nimport isNil from 'lodash/isNil';\nimport isEqual from 'lodash/isEqual';\nimport clsx from 'clsx';\nimport { Curve } from '../shape/Curve';\nimport { Dot } from '../shape/Dot';\nimport { Layer } from '../container/Layer';\nimport { LabelList } from '../component/LabelList';\nimport { ErrorBar } from './ErrorBar';\nimport { uniqueId, interpolateNumber } from '../util/DataUtils';\nimport { findAllByType, filterProps, hasClipDot } from '../util/ReactUtils';\nimport { Global } from '../util/Global';\nimport { getCateCoordinateOfLine, getValueByDataKey } from '../util/ChartUtils';\nexport var Line = /*#__PURE__*/function (_PureComponent) {\n function Line() {\n var _this;\n _classCallCheck(this, Line);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, Line, [].concat(args));\n _defineProperty(_this, \"state\", {\n isAnimationFinished: true,\n totalLength: 0\n });\n _defineProperty(_this, \"generateSimpleStrokeDasharray\", function (totalLength, length) {\n return \"\".concat(length, \"px \").concat(totalLength - length, \"px\");\n });\n _defineProperty(_this, \"getStrokeDasharray\", function (length, totalLength, lines) {\n var lineLength = lines.reduce(function (pre, next) {\n return pre + next;\n });\n\n // if lineLength is 0 return the default when no strokeDasharray is provided\n if (!lineLength) {\n return _this.generateSimpleStrokeDasharray(totalLength, length);\n }\n var count = Math.floor(length / lineLength);\n var remainLength = length % lineLength;\n var restLength = totalLength - length;\n var remainLines = [];\n for (var i = 0, sum = 0; i < lines.length; sum += lines[i], ++i) {\n if (sum + lines[i] > remainLength) {\n remainLines = [].concat(_toConsumableArray(lines.slice(0, i)), [remainLength - sum]);\n break;\n }\n }\n var emptyLines = remainLines.length % 2 === 0 ? [0, restLength] : [restLength];\n return [].concat(_toConsumableArray(Line.repeat(lines, count)), _toConsumableArray(remainLines), emptyLines).map(function (line) {\n return \"\".concat(line, \"px\");\n }).join(', ');\n });\n _defineProperty(_this, \"id\", uniqueId('recharts-line-'));\n _defineProperty(_this, \"pathRef\", function (node) {\n _this.mainCurve = node;\n });\n _defineProperty(_this, \"handleAnimationEnd\", function () {\n _this.setState({\n isAnimationFinished: true\n });\n if (_this.props.onAnimationEnd) {\n _this.props.onAnimationEnd();\n }\n });\n _defineProperty(_this, \"handleAnimationStart\", function () {\n _this.setState({\n isAnimationFinished: false\n });\n if (_this.props.onAnimationStart) {\n _this.props.onAnimationStart();\n }\n });\n return _this;\n }\n _inherits(Line, _PureComponent);\n return _createClass(Line, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (!this.props.isAnimationActive) {\n return;\n }\n var totalLength = this.getTotalLength();\n this.setState({\n totalLength: totalLength\n });\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n if (!this.props.isAnimationActive) {\n return;\n }\n var totalLength = this.getTotalLength();\n if (totalLength !== this.state.totalLength) {\n this.setState({\n totalLength: totalLength\n });\n }\n }\n }, {\n key: \"getTotalLength\",\n value: function getTotalLength() {\n var curveDom = this.mainCurve;\n try {\n return curveDom && curveDom.getTotalLength && curveDom.getTotalLength() || 0;\n } catch (err) {\n return 0;\n }\n }\n }, {\n key: \"renderErrorBar\",\n value: function renderErrorBar(needClip, clipPathId) {\n if (this.props.isAnimationActive && !this.state.isAnimationFinished) {\n return null;\n }\n var _this$props = this.props,\n points = _this$props.points,\n xAxis = _this$props.xAxis,\n yAxis = _this$props.yAxis,\n layout = _this$props.layout,\n children = _this$props.children;\n var errorBarItems = findAllByType(children, ErrorBar);\n if (!errorBarItems) {\n return null;\n }\n var dataPointFormatter = function dataPointFormatter(dataPoint, dataKey) {\n return {\n x: dataPoint.x,\n y: dataPoint.y,\n value: dataPoint.value,\n errorVal: getValueByDataKey(dataPoint.payload, dataKey)\n };\n };\n var errorBarProps = {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null\n };\n return /*#__PURE__*/React.createElement(Layer, errorBarProps, errorBarItems.map(function (item) {\n return /*#__PURE__*/React.cloneElement(item, {\n key: \"bar-\".concat(item.props.dataKey),\n data: points,\n xAxis: xAxis,\n yAxis: yAxis,\n layout: layout,\n dataPointFormatter: dataPointFormatter\n });\n }));\n }\n }, {\n key: \"renderDots\",\n value: function renderDots(needClip, clipDot, clipPathId) {\n var isAnimationActive = this.props.isAnimationActive;\n if (isAnimationActive && !this.state.isAnimationFinished) {\n return null;\n }\n var _this$props2 = this.props,\n dot = _this$props2.dot,\n points = _this$props2.points,\n dataKey = _this$props2.dataKey;\n var lineProps = filterProps(this.props, false);\n var customDotProps = filterProps(dot, true);\n var dots = points.map(function (entry, i) {\n var dotProps = _objectSpread(_objectSpread(_objectSpread({\n key: \"dot-\".concat(i),\n r: 3\n }, lineProps), customDotProps), {}, {\n index: i,\n cx: entry.x,\n cy: entry.y,\n value: entry.value,\n dataKey: dataKey,\n payload: entry.payload,\n points: points\n });\n return Line.renderDotItem(dot, dotProps);\n });\n var dotsProps = {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipDot ? '' : 'dots-').concat(clipPathId, \")\") : null\n };\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-line-dots\",\n key: \"dots\"\n }, dotsProps), dots);\n }\n }, {\n key: \"renderCurveStatically\",\n value: function renderCurveStatically(points, needClip, clipPathId, props) {\n var _this$props3 = this.props,\n type = _this$props3.type,\n layout = _this$props3.layout,\n connectNulls = _this$props3.connectNulls,\n ref = _this$props3.ref,\n others = _objectWithoutProperties(_this$props3, _excluded);\n var curveProps = _objectSpread(_objectSpread(_objectSpread({}, filterProps(others, true)), {}, {\n fill: 'none',\n className: 'recharts-line-curve',\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null,\n points: points\n }, props), {}, {\n type: type,\n layout: layout,\n connectNulls: connectNulls\n });\n return /*#__PURE__*/React.createElement(Curve, _extends({}, curveProps, {\n pathRef: this.pathRef\n }));\n }\n }, {\n key: \"renderCurveWithAnimation\",\n value: function renderCurveWithAnimation(needClip, clipPathId) {\n var _this2 = this;\n var _this$props4 = this.props,\n points = _this$props4.points,\n strokeDasharray = _this$props4.strokeDasharray,\n isAnimationActive = _this$props4.isAnimationActive,\n animationBegin = _this$props4.animationBegin,\n animationDuration = _this$props4.animationDuration,\n animationEasing = _this$props4.animationEasing,\n animationId = _this$props4.animationId,\n animateNewValues = _this$props4.animateNewValues,\n width = _this$props4.width,\n height = _this$props4.height;\n var _this$state = this.state,\n prevPoints = _this$state.prevPoints,\n totalLength = _this$state.totalLength;\n return /*#__PURE__*/React.createElement(Animate, {\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing,\n from: {\n t: 0\n },\n to: {\n t: 1\n },\n key: \"line-\".concat(animationId),\n onAnimationEnd: this.handleAnimationEnd,\n onAnimationStart: this.handleAnimationStart\n }, function (_ref) {\n var t = _ref.t;\n if (prevPoints) {\n var prevPointsDiffFactor = prevPoints.length / points.length;\n var stepData = points.map(function (entry, index) {\n var prevPointIndex = Math.floor(index * prevPointsDiffFactor);\n if (prevPoints[prevPointIndex]) {\n var prev = prevPoints[prevPointIndex];\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t)\n });\n }\n\n // magic number of faking previous x and y location\n if (animateNewValues) {\n var _interpolatorX = interpolateNumber(width * 2, entry.x);\n var _interpolatorY = interpolateNumber(height / 2, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: _interpolatorX(t),\n y: _interpolatorY(t)\n });\n }\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: entry.x,\n y: entry.y\n });\n });\n return _this2.renderCurveStatically(stepData, needClip, clipPathId);\n }\n var interpolator = interpolateNumber(0, totalLength);\n var curLength = interpolator(t);\n var currentStrokeDasharray;\n if (strokeDasharray) {\n var lines = \"\".concat(strokeDasharray).split(/[,\\s]+/gim).map(function (num) {\n return parseFloat(num);\n });\n currentStrokeDasharray = _this2.getStrokeDasharray(curLength, totalLength, lines);\n } else {\n currentStrokeDasharray = _this2.generateSimpleStrokeDasharray(totalLength, curLength);\n }\n return _this2.renderCurveStatically(points, needClip, clipPathId, {\n strokeDasharray: currentStrokeDasharray\n });\n });\n }\n }, {\n key: \"renderCurve\",\n value: function renderCurve(needClip, clipPathId) {\n var _this$props5 = this.props,\n points = _this$props5.points,\n isAnimationActive = _this$props5.isAnimationActive;\n var _this$state2 = this.state,\n prevPoints = _this$state2.prevPoints,\n totalLength = _this$state2.totalLength;\n if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !isEqual(prevPoints, points))) {\n return this.renderCurveWithAnimation(needClip, clipPathId);\n }\n return this.renderCurveStatically(points, needClip, clipPathId);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _filterProps;\n var _this$props6 = this.props,\n hide = _this$props6.hide,\n dot = _this$props6.dot,\n points = _this$props6.points,\n className = _this$props6.className,\n xAxis = _this$props6.xAxis,\n yAxis = _this$props6.yAxis,\n top = _this$props6.top,\n left = _this$props6.left,\n width = _this$props6.width,\n height = _this$props6.height,\n isAnimationActive = _this$props6.isAnimationActive,\n id = _this$props6.id;\n if (hide || !points || !points.length) {\n return null;\n }\n var isAnimationFinished = this.state.isAnimationFinished;\n var hasSinglePoint = points.length === 1;\n var layerClass = clsx('recharts-line', className);\n var needClipX = xAxis && xAxis.allowDataOverflow;\n var needClipY = yAxis && yAxis.allowDataOverflow;\n var needClip = needClipX || needClipY;\n var clipPathId = isNil(id) ? this.id : id;\n var _ref2 = (_filterProps = filterProps(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {\n r: 3,\n strokeWidth: 2\n },\n _ref2$r = _ref2.r,\n r = _ref2$r === void 0 ? 3 : _ref2$r,\n _ref2$strokeWidth = _ref2.strokeWidth,\n strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;\n var _ref3 = hasClipDot(dot) ? dot : {},\n _ref3$clipDot = _ref3.clipDot,\n clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;\n var dotSize = r * 2 + strokeWidth;\n return /*#__PURE__*/React.createElement(Layer, {\n className: layerClass\n }, needClipX || needClipY ? /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: needClipX ? left : left - width / 2,\n y: needClipY ? top : top - height / 2,\n width: needClipX ? width : width * 2,\n height: needClipY ? height : height * 2\n })), !clipDot && /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-dots-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: left - dotSize / 2,\n y: top - dotSize / 2,\n width: width + dotSize,\n height: height + dotSize\n }))) : null, !hasSinglePoint && this.renderCurve(needClip, clipPathId), this.renderErrorBar(needClip, clipPathId), (hasSinglePoint || dot) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n if (nextProps.animationId !== prevState.prevAnimationId) {\n return {\n prevAnimationId: nextProps.animationId,\n curPoints: nextProps.points,\n prevPoints: prevState.curPoints\n };\n }\n if (nextProps.points !== prevState.curPoints) {\n return {\n curPoints: nextProps.points\n };\n }\n return null;\n }\n }, {\n key: \"repeat\",\n value: function repeat(lines, count) {\n var linesUnit = lines.length % 2 !== 0 ? [].concat(_toConsumableArray(lines), [0]) : lines;\n var result = [];\n for (var i = 0; i < count; ++i) {\n result = [].concat(_toConsumableArray(result), _toConsumableArray(linesUnit));\n }\n return result;\n }\n }, {\n key: \"renderDotItem\",\n value: function renderDotItem(option, props) {\n var dotItem;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n dotItem = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n dotItem = option(props);\n } else {\n var key = props.key,\n dotProps = _objectWithoutProperties(props, _excluded2);\n var className = clsx('recharts-line-dot', typeof option !== 'boolean' ? option.className : '');\n dotItem = /*#__PURE__*/React.createElement(Dot, _extends({\n key: key\n }, dotProps, {\n className: className\n }));\n }\n return dotItem;\n }\n }]);\n}(PureComponent);\n_defineProperty(Line, \"displayName\", 'Line');\n_defineProperty(Line, \"defaultProps\", {\n xAxisId: 0,\n yAxisId: 0,\n connectNulls: false,\n activeDot: true,\n dot: true,\n legendType: 'line',\n stroke: '#3182bd',\n strokeWidth: 1,\n fill: '#fff',\n points: [],\n isAnimationActive: !Global.isSsr,\n animateNewValues: true,\n animationBegin: 0,\n animationDuration: 1500,\n animationEasing: 'ease',\n hide: false,\n label: false\n});\n/**\n * Compose the data of each group\n * @param {Object} props The props from the component\n * @param {Object} xAxis The configuration of x-axis\n * @param {Object} yAxis The configuration of y-axis\n * @param {String} dataKey The unique key of a group\n * @return {Array} Composed data\n */\n_defineProperty(Line, \"getComposedData\", function (_ref4) {\n var props = _ref4.props,\n xAxis = _ref4.xAxis,\n yAxis = _ref4.yAxis,\n xAxisTicks = _ref4.xAxisTicks,\n yAxisTicks = _ref4.yAxisTicks,\n dataKey = _ref4.dataKey,\n bandSize = _ref4.bandSize,\n displayedData = _ref4.displayedData,\n offset = _ref4.offset;\n var layout = props.layout;\n var points = displayedData.map(function (entry, index) {\n var value = getValueByDataKey(entry, dataKey);\n if (layout === 'horizontal') {\n return {\n x: getCateCoordinateOfLine({\n axis: xAxis,\n ticks: xAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n y: isNil(value) ? null : yAxis.scale(value),\n value: value,\n payload: entry\n };\n }\n return {\n x: isNil(value) ? null : xAxis.scale(value),\n y: getCateCoordinateOfLine({\n axis: yAxis,\n ticks: yAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n value: value,\n payload: entry\n };\n });\n return _objectSpread({\n points: points,\n layout: layout\n }, offset);\n});","var _excluded = [\"layout\", \"type\", \"stroke\", \"connectNulls\", \"isRange\", \"ref\"],\n _excluded2 = [\"key\"];\nvar _Area;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Area\n */\nimport React, { PureComponent } from 'react';\nimport clsx from 'clsx';\nimport Animate from 'react-smooth';\nimport isFunction from 'lodash/isFunction';\nimport max from 'lodash/max';\nimport isNil from 'lodash/isNil';\nimport isNan from 'lodash/isNaN';\nimport isEqual from 'lodash/isEqual';\nimport { Curve } from '../shape/Curve';\nimport { Dot } from '../shape/Dot';\nimport { Layer } from '../container/Layer';\nimport { LabelList } from '../component/LabelList';\nimport { Global } from '../util/Global';\nimport { isNumber, uniqueId, interpolateNumber } from '../util/DataUtils';\nimport { getCateCoordinateOfLine, getValueByDataKey } from '../util/ChartUtils';\nimport { filterProps, hasClipDot } from '../util/ReactUtils';\nexport var Area = /*#__PURE__*/function (_PureComponent) {\n function Area() {\n var _this;\n _classCallCheck(this, Area);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, Area, [].concat(args));\n _defineProperty(_this, \"state\", {\n isAnimationFinished: true\n });\n _defineProperty(_this, \"id\", uniqueId('recharts-area-'));\n _defineProperty(_this, \"handleAnimationEnd\", function () {\n var onAnimationEnd = _this.props.onAnimationEnd;\n _this.setState({\n isAnimationFinished: true\n });\n if (isFunction(onAnimationEnd)) {\n onAnimationEnd();\n }\n });\n _defineProperty(_this, \"handleAnimationStart\", function () {\n var onAnimationStart = _this.props.onAnimationStart;\n _this.setState({\n isAnimationFinished: false\n });\n if (isFunction(onAnimationStart)) {\n onAnimationStart();\n }\n });\n return _this;\n }\n _inherits(Area, _PureComponent);\n return _createClass(Area, [{\n key: \"renderDots\",\n value: function renderDots(needClip, clipDot, clipPathId) {\n var isAnimationActive = this.props.isAnimationActive;\n var isAnimationFinished = this.state.isAnimationFinished;\n if (isAnimationActive && !isAnimationFinished) {\n return null;\n }\n var _this$props = this.props,\n dot = _this$props.dot,\n points = _this$props.points,\n dataKey = _this$props.dataKey;\n var areaProps = filterProps(this.props, false);\n var customDotProps = filterProps(dot, true);\n var dots = points.map(function (entry, i) {\n var dotProps = _objectSpread(_objectSpread(_objectSpread({\n key: \"dot-\".concat(i),\n r: 3\n }, areaProps), customDotProps), {}, {\n index: i,\n cx: entry.x,\n cy: entry.y,\n dataKey: dataKey,\n value: entry.value,\n payload: entry.payload,\n points: points\n });\n return Area.renderDotItem(dot, dotProps);\n });\n var dotsProps = {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipDot ? '' : 'dots-').concat(clipPathId, \")\") : null\n };\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-area-dots\"\n }, dotsProps), dots);\n }\n }, {\n key: \"renderHorizontalRect\",\n value: function renderHorizontalRect(alpha) {\n var _this$props2 = this.props,\n baseLine = _this$props2.baseLine,\n points = _this$props2.points,\n strokeWidth = _this$props2.strokeWidth;\n var startX = points[0].x;\n var endX = points[points.length - 1].x;\n var width = alpha * Math.abs(startX - endX);\n var maxY = max(points.map(function (entry) {\n return entry.y || 0;\n }));\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n maxY = Math.max(baseLine, maxY);\n } else if (baseLine && Array.isArray(baseLine) && baseLine.length) {\n maxY = Math.max(max(baseLine.map(function (entry) {\n return entry.y || 0;\n })), maxY);\n }\n if (isNumber(maxY)) {\n return /*#__PURE__*/React.createElement(\"rect\", {\n x: startX < endX ? startX : startX - width,\n y: 0,\n width: width,\n height: Math.floor(maxY + (strokeWidth ? parseInt(\"\".concat(strokeWidth), 10) : 1))\n });\n }\n return null;\n }\n }, {\n key: \"renderVerticalRect\",\n value: function renderVerticalRect(alpha) {\n var _this$props3 = this.props,\n baseLine = _this$props3.baseLine,\n points = _this$props3.points,\n strokeWidth = _this$props3.strokeWidth;\n var startY = points[0].y;\n var endY = points[points.length - 1].y;\n var height = alpha * Math.abs(startY - endY);\n var maxX = max(points.map(function (entry) {\n return entry.x || 0;\n }));\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n maxX = Math.max(baseLine, maxX);\n } else if (baseLine && Array.isArray(baseLine) && baseLine.length) {\n maxX = Math.max(max(baseLine.map(function (entry) {\n return entry.x || 0;\n })), maxX);\n }\n if (isNumber(maxX)) {\n return /*#__PURE__*/React.createElement(\"rect\", {\n x: 0,\n y: startY < endY ? startY : startY - height,\n width: maxX + (strokeWidth ? parseInt(\"\".concat(strokeWidth), 10) : 1),\n height: Math.floor(height)\n });\n }\n return null;\n }\n }, {\n key: \"renderClipRect\",\n value: function renderClipRect(alpha) {\n var layout = this.props.layout;\n if (layout === 'vertical') {\n return this.renderVerticalRect(alpha);\n }\n return this.renderHorizontalRect(alpha);\n }\n }, {\n key: \"renderAreaStatically\",\n value: function renderAreaStatically(points, baseLine, needClip, clipPathId) {\n var _this$props4 = this.props,\n layout = _this$props4.layout,\n type = _this$props4.type,\n stroke = _this$props4.stroke,\n connectNulls = _this$props4.connectNulls,\n isRange = _this$props4.isRange,\n ref = _this$props4.ref,\n others = _objectWithoutProperties(_this$props4, _excluded);\n return /*#__PURE__*/React.createElement(Layer, {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null\n }, /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(others, true), {\n points: points,\n connectNulls: connectNulls,\n type: type,\n baseLine: baseLine,\n layout: layout,\n stroke: \"none\",\n className: \"recharts-area-area\"\n })), stroke !== 'none' && /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(this.props, false), {\n className: \"recharts-area-curve\",\n layout: layout,\n type: type,\n connectNulls: connectNulls,\n fill: \"none\",\n points: points\n })), stroke !== 'none' && isRange && /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(this.props, false), {\n className: \"recharts-area-curve\",\n layout: layout,\n type: type,\n connectNulls: connectNulls,\n fill: \"none\",\n points: baseLine\n })));\n }\n }, {\n key: \"renderAreaWithAnimation\",\n value: function renderAreaWithAnimation(needClip, clipPathId) {\n var _this2 = this;\n var _this$props5 = this.props,\n points = _this$props5.points,\n baseLine = _this$props5.baseLine,\n isAnimationActive = _this$props5.isAnimationActive,\n animationBegin = _this$props5.animationBegin,\n animationDuration = _this$props5.animationDuration,\n animationEasing = _this$props5.animationEasing,\n animationId = _this$props5.animationId;\n var _this$state = this.state,\n prevPoints = _this$state.prevPoints,\n prevBaseLine = _this$state.prevBaseLine;\n // const clipPathId = isNil(id) ? this.id : id;\n\n return /*#__PURE__*/React.createElement(Animate, {\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing,\n from: {\n t: 0\n },\n to: {\n t: 1\n },\n key: \"area-\".concat(animationId),\n onAnimationEnd: this.handleAnimationEnd,\n onAnimationStart: this.handleAnimationStart\n }, function (_ref) {\n var t = _ref.t;\n if (prevPoints) {\n var prevPointsDiffFactor = prevPoints.length / points.length;\n // update animtaion\n var stepPoints = points.map(function (entry, index) {\n var prevPointIndex = Math.floor(index * prevPointsDiffFactor);\n if (prevPoints[prevPointIndex]) {\n var prev = prevPoints[prevPointIndex];\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t)\n });\n }\n return entry;\n });\n var stepBaseLine;\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n var interpolator = interpolateNumber(prevBaseLine, baseLine);\n stepBaseLine = interpolator(t);\n } else if (isNil(baseLine) || isNan(baseLine)) {\n var _interpolator = interpolateNumber(prevBaseLine, 0);\n stepBaseLine = _interpolator(t);\n } else {\n stepBaseLine = baseLine.map(function (entry, index) {\n var prevPointIndex = Math.floor(index * prevPointsDiffFactor);\n if (prevBaseLine[prevPointIndex]) {\n var prev = prevBaseLine[prevPointIndex];\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t)\n });\n }\n return entry;\n });\n }\n return _this2.renderAreaStatically(stepPoints, stepBaseLine, needClip, clipPathId);\n }\n return /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"animationClipPath-\".concat(clipPathId)\n }, _this2.renderClipRect(t))), /*#__PURE__*/React.createElement(Layer, {\n clipPath: \"url(#animationClipPath-\".concat(clipPathId, \")\")\n }, _this2.renderAreaStatically(points, baseLine, needClip, clipPathId)));\n });\n }\n }, {\n key: \"renderArea\",\n value: function renderArea(needClip, clipPathId) {\n var _this$props6 = this.props,\n points = _this$props6.points,\n baseLine = _this$props6.baseLine,\n isAnimationActive = _this$props6.isAnimationActive;\n var _this$state2 = this.state,\n prevPoints = _this$state2.prevPoints,\n prevBaseLine = _this$state2.prevBaseLine,\n totalLength = _this$state2.totalLength;\n if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !isEqual(prevPoints, points) || !isEqual(prevBaseLine, baseLine))) {\n return this.renderAreaWithAnimation(needClip, clipPathId);\n }\n return this.renderAreaStatically(points, baseLine, needClip, clipPathId);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _filterProps;\n var _this$props7 = this.props,\n hide = _this$props7.hide,\n dot = _this$props7.dot,\n points = _this$props7.points,\n className = _this$props7.className,\n top = _this$props7.top,\n left = _this$props7.left,\n xAxis = _this$props7.xAxis,\n yAxis = _this$props7.yAxis,\n width = _this$props7.width,\n height = _this$props7.height,\n isAnimationActive = _this$props7.isAnimationActive,\n id = _this$props7.id;\n if (hide || !points || !points.length) {\n return null;\n }\n var isAnimationFinished = this.state.isAnimationFinished;\n var hasSinglePoint = points.length === 1;\n var layerClass = clsx('recharts-area', className);\n var needClipX = xAxis && xAxis.allowDataOverflow;\n var needClipY = yAxis && yAxis.allowDataOverflow;\n var needClip = needClipX || needClipY;\n var clipPathId = isNil(id) ? this.id : id;\n var _ref2 = (_filterProps = filterProps(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {\n r: 3,\n strokeWidth: 2\n },\n _ref2$r = _ref2.r,\n r = _ref2$r === void 0 ? 3 : _ref2$r,\n _ref2$strokeWidth = _ref2.strokeWidth,\n strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;\n var _ref3 = hasClipDot(dot) ? dot : {},\n _ref3$clipDot = _ref3.clipDot,\n clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;\n var dotSize = r * 2 + strokeWidth;\n return /*#__PURE__*/React.createElement(Layer, {\n className: layerClass\n }, needClipX || needClipY ? /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: needClipX ? left : left - width / 2,\n y: needClipY ? top : top - height / 2,\n width: needClipX ? width : width * 2,\n height: needClipY ? height : height * 2\n })), !clipDot && /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-dots-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: left - dotSize / 2,\n y: top - dotSize / 2,\n width: width + dotSize,\n height: height + dotSize\n }))) : null, !hasSinglePoint ? this.renderArea(needClip, clipPathId) : null, (dot || hasSinglePoint) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n if (nextProps.animationId !== prevState.prevAnimationId) {\n return {\n prevAnimationId: nextProps.animationId,\n curPoints: nextProps.points,\n curBaseLine: nextProps.baseLine,\n prevPoints: prevState.curPoints,\n prevBaseLine: prevState.curBaseLine\n };\n }\n if (nextProps.points !== prevState.curPoints || nextProps.baseLine !== prevState.curBaseLine) {\n return {\n curPoints: nextProps.points,\n curBaseLine: nextProps.baseLine\n };\n }\n return null;\n }\n }]);\n}(PureComponent);\n_Area = Area;\n_defineProperty(Area, \"displayName\", 'Area');\n_defineProperty(Area, \"defaultProps\", {\n stroke: '#3182bd',\n fill: '#3182bd',\n fillOpacity: 0.6,\n xAxisId: 0,\n yAxisId: 0,\n legendType: 'line',\n connectNulls: false,\n // points of area\n points: [],\n dot: false,\n activeDot: true,\n hide: false,\n isAnimationActive: !Global.isSsr,\n animationBegin: 0,\n animationDuration: 1500,\n animationEasing: 'ease'\n});\n_defineProperty(Area, \"getBaseValue\", function (props, item, xAxis, yAxis) {\n var layout = props.layout,\n chartBaseValue = props.baseValue;\n var itemBaseValue = item.props.baseValue;\n\n // The baseValue can be defined both on the AreaChart as well as on the Area.\n // The value for the item takes precedence.\n var baseValue = itemBaseValue !== null && itemBaseValue !== void 0 ? itemBaseValue : chartBaseValue;\n if (isNumber(baseValue) && typeof baseValue === 'number') {\n return baseValue;\n }\n var numericAxis = layout === 'horizontal' ? yAxis : xAxis;\n var domain = numericAxis.scale.domain();\n if (numericAxis.type === 'number') {\n var domainMax = Math.max(domain[0], domain[1]);\n var domainMin = Math.min(domain[0], domain[1]);\n if (baseValue === 'dataMin') {\n return domainMin;\n }\n if (baseValue === 'dataMax') {\n return domainMax;\n }\n return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);\n }\n if (baseValue === 'dataMin') {\n return domain[0];\n }\n if (baseValue === 'dataMax') {\n return domain[1];\n }\n return domain[0];\n});\n_defineProperty(Area, \"getComposedData\", function (_ref4) {\n var props = _ref4.props,\n item = _ref4.item,\n xAxis = _ref4.xAxis,\n yAxis = _ref4.yAxis,\n xAxisTicks = _ref4.xAxisTicks,\n yAxisTicks = _ref4.yAxisTicks,\n bandSize = _ref4.bandSize,\n dataKey = _ref4.dataKey,\n stackedData = _ref4.stackedData,\n dataStartIndex = _ref4.dataStartIndex,\n displayedData = _ref4.displayedData,\n offset = _ref4.offset;\n var layout = props.layout;\n var hasStack = stackedData && stackedData.length;\n var baseValue = _Area.getBaseValue(props, item, xAxis, yAxis);\n var isHorizontalLayout = layout === 'horizontal';\n var isRange = false;\n var points = displayedData.map(function (entry, index) {\n var value;\n if (hasStack) {\n value = stackedData[dataStartIndex + index];\n } else {\n value = getValueByDataKey(entry, dataKey);\n if (!Array.isArray(value)) {\n value = [baseValue, value];\n } else {\n isRange = true;\n }\n }\n var isBreakPoint = value[1] == null || hasStack && getValueByDataKey(entry, dataKey) == null;\n if (isHorizontalLayout) {\n return {\n x: getCateCoordinateOfLine({\n axis: xAxis,\n ticks: xAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n y: isBreakPoint ? null : yAxis.scale(value[1]),\n value: value,\n payload: entry\n };\n }\n return {\n x: isBreakPoint ? null : xAxis.scale(value[1]),\n y: getCateCoordinateOfLine({\n axis: yAxis,\n ticks: yAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n value: value,\n payload: entry\n };\n });\n var baseLine;\n if (hasStack || isRange) {\n baseLine = points.map(function (entry) {\n var x = Array.isArray(entry.value) ? entry.value[0] : null;\n if (isHorizontalLayout) {\n return {\n x: entry.x,\n y: x != null && entry.y != null ? yAxis.scale(x) : null\n };\n }\n return {\n x: x != null ? xAxis.scale(x) : null,\n y: entry.y\n };\n });\n } else {\n baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);\n }\n return _objectSpread({\n points: points,\n baseLine: baseLine,\n layout: layout,\n isRange: isRange\n }, offset);\n});\n_defineProperty(Area, \"renderDotItem\", function (option, props) {\n var dotItem;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n dotItem = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n dotItem = option(props);\n } else {\n var className = clsx('recharts-area-dot', typeof option !== 'boolean' ? option.className : '');\n var key = props.key,\n rest = _objectWithoutProperties(props, _excluded2);\n dotItem = /*#__PURE__*/React.createElement(Dot, _extends({}, rest, {\n key: key,\n className: className\n }));\n }\n return dotItem;\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n/**\n * @fileOverview X Axis\n */\nimport * as React from 'react';\nimport clsx from 'clsx';\nimport { useChartHeight, useChartWidth, useXAxisOrThrow } from '../context/chartLayoutContext';\nimport { CartesianAxis } from './CartesianAxis';\nimport { getTicksOfAxis } from '../util/ChartUtils';\n\n/** Define of XAxis props */\n\nfunction XAxisImpl(_ref) {\n var xAxisId = _ref.xAxisId;\n var width = useChartWidth();\n var height = useChartHeight();\n var axisOptions = useXAxisOrThrow(xAxisId);\n if (axisOptions == null) {\n return null;\n }\n return (\n /*#__PURE__*/\n // @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.\n React.createElement(CartesianAxis, _extends({}, axisOptions, {\n className: clsx(\"recharts-\".concat(axisOptions.axisType, \" \").concat(axisOptions.axisType), axisOptions.className),\n viewBox: {\n x: 0,\n y: 0,\n width: width,\n height: height\n },\n ticksGenerator: function ticksGenerator(axis) {\n return getTicksOfAxis(axis, true);\n }\n }))\n );\n}\n\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var XAxis = /*#__PURE__*/function (_React$Component) {\n function XAxis() {\n _classCallCheck(this, XAxis);\n return _callSuper(this, XAxis, arguments);\n }\n _inherits(XAxis, _React$Component);\n return _createClass(XAxis, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(XAxisImpl, this.props);\n }\n }]);\n}(React.Component);\n_defineProperty(XAxis, \"displayName\", 'XAxis');\n_defineProperty(XAxis, \"defaultProps\", {\n allowDecimals: true,\n hide: false,\n orientation: 'bottom',\n width: 0,\n height: 30,\n mirror: false,\n xAxisId: 0,\n tickCount: 5,\n type: 'category',\n padding: {\n left: 0,\n right: 0\n },\n allowDataOverflow: false,\n scale: 'auto',\n reversed: false,\n allowDuplicatedCategory: true\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n/**\n * @fileOverview Y Axis\n */\nimport * as React from 'react';\nimport clsx from 'clsx';\nimport { useChartHeight, useChartWidth, useYAxisOrThrow } from '../context/chartLayoutContext';\nimport { CartesianAxis } from './CartesianAxis';\nimport { getTicksOfAxis } from '../util/ChartUtils';\nvar YAxisImpl = function YAxisImpl(_ref) {\n var yAxisId = _ref.yAxisId;\n var width = useChartWidth();\n var height = useChartHeight();\n var axisOptions = useYAxisOrThrow(yAxisId);\n if (axisOptions == null) {\n return null;\n }\n return (\n /*#__PURE__*/\n // @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.\n React.createElement(CartesianAxis, _extends({}, axisOptions, {\n className: clsx(\"recharts-\".concat(axisOptions.axisType, \" \").concat(axisOptions.axisType), axisOptions.className),\n viewBox: {\n x: 0,\n y: 0,\n width: width,\n height: height\n },\n ticksGenerator: function ticksGenerator(axis) {\n return getTicksOfAxis(axis, true);\n }\n }))\n );\n};\n\n// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps\nexport var YAxis = /*#__PURE__*/function (_React$Component) {\n function YAxis() {\n _classCallCheck(this, YAxis);\n return _callSuper(this, YAxis, arguments);\n }\n _inherits(YAxis, _React$Component);\n return _createClass(YAxis, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(YAxisImpl, this.props);\n }\n }]);\n}(React.Component);\n_defineProperty(YAxis, \"displayName\", 'YAxis');\n_defineProperty(YAxis, \"defaultProps\", {\n allowDuplicatedCategory: true,\n allowDecimals: true,\n hide: false,\n orientation: 'left',\n width: 60,\n height: 0,\n mirror: false,\n yAxisId: 0,\n tickCount: 5,\n type: 'number',\n padding: {\n top: 0,\n bottom: 0\n },\n allowDataOverflow: false,\n scale: 'auto',\n reversed: false\n});","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nimport { ReferenceDot } from '../cartesian/ReferenceDot';\nimport { ReferenceLine } from '../cartesian/ReferenceLine';\nimport { ReferenceArea } from '../cartesian/ReferenceArea';\nimport { ifOverflowMatches } from './IfOverflowMatches';\nimport { findAllByType } from './ReactUtils';\nimport { isNumber } from './DataUtils';\nexport var detectReferenceElementsDomain = function detectReferenceElementsDomain(children, domain, axisId, axisType, specifiedTicks) {\n var lines = findAllByType(children, ReferenceLine);\n var dots = findAllByType(children, ReferenceDot);\n var elements = [].concat(_toConsumableArray(lines), _toConsumableArray(dots));\n var areas = findAllByType(children, ReferenceArea);\n var idKey = \"\".concat(axisType, \"Id\");\n var valueKey = axisType[0];\n var finalDomain = domain;\n if (elements.length) {\n finalDomain = elements.reduce(function (result, el) {\n if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && isNumber(el.props[valueKey])) {\n var value = el.props[valueKey];\n return [Math.min(result[0], value), Math.max(result[1], value)];\n }\n return result;\n }, finalDomain);\n }\n if (areas.length) {\n var key1 = \"\".concat(valueKey, \"1\");\n var key2 = \"\".concat(valueKey, \"2\");\n finalDomain = areas.reduce(function (result, el) {\n if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && isNumber(el.props[key1]) && isNumber(el.props[key2])) {\n var value1 = el.props[key1];\n var value2 = el.props[key2];\n return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];\n }\n return result;\n }, finalDomain);\n }\n if (specifiedTicks && specifiedTicks.length) {\n finalDomain = specifiedTicks.reduce(function (result, tick) {\n if (isNumber(tick)) {\n return [Math.min(result[0], tick), Math.max(result[1], tick)];\n }\n return result;\n }, finalDomain);\n }\n return finalDomain;\n};","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import EventEmitter from 'eventemitter3';\nvar eventCenter = new EventEmitter();\nexport { eventCenter };\nexport var SYNC_EVENT = 'recharts.syncMouseEvents';","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nexport var AccessibilityManager = /*#__PURE__*/function () {\n function AccessibilityManager() {\n _classCallCheck(this, AccessibilityManager);\n _defineProperty(this, \"activeIndex\", 0);\n _defineProperty(this, \"coordinateList\", []);\n _defineProperty(this, \"layout\", 'horizontal');\n }\n return _createClass(AccessibilityManager, [{\n key: \"setDetails\",\n value: function setDetails(_ref) {\n var _ref2;\n var _ref$coordinateList = _ref.coordinateList,\n coordinateList = _ref$coordinateList === void 0 ? null : _ref$coordinateList,\n _ref$container = _ref.container,\n container = _ref$container === void 0 ? null : _ref$container,\n _ref$layout = _ref.layout,\n layout = _ref$layout === void 0 ? null : _ref$layout,\n _ref$offset = _ref.offset,\n offset = _ref$offset === void 0 ? null : _ref$offset,\n _ref$mouseHandlerCall = _ref.mouseHandlerCallback,\n mouseHandlerCallback = _ref$mouseHandlerCall === void 0 ? null : _ref$mouseHandlerCall;\n this.coordinateList = (_ref2 = coordinateList !== null && coordinateList !== void 0 ? coordinateList : this.coordinateList) !== null && _ref2 !== void 0 ? _ref2 : [];\n this.container = container !== null && container !== void 0 ? container : this.container;\n this.layout = layout !== null && layout !== void 0 ? layout : this.layout;\n this.offset = offset !== null && offset !== void 0 ? offset : this.offset;\n this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback;\n\n // Keep activeIndex in the bounds between 0 and the last coordinate index\n this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1);\n }\n }, {\n key: \"focus\",\n value: function focus() {\n this.spoofMouse();\n }\n }, {\n key: \"keyboardEvent\",\n value: function keyboardEvent(e) {\n // The AccessibilityManager relies on the Tooltip component. When tooltips suddenly stop existing,\n // it can cause errors. We use this function to check. We don't want arrow keys to be processed\n // if there are no tooltips, since that will cause unexpected behavior of users.\n if (this.coordinateList.length === 0) {\n return;\n }\n switch (e.key) {\n case 'ArrowRight':\n {\n if (this.layout !== 'horizontal') {\n return;\n }\n this.activeIndex = Math.min(this.activeIndex + 1, this.coordinateList.length - 1);\n this.spoofMouse();\n break;\n }\n case 'ArrowLeft':\n {\n if (this.layout !== 'horizontal') {\n return;\n }\n this.activeIndex = Math.max(this.activeIndex - 1, 0);\n this.spoofMouse();\n break;\n }\n default:\n {\n break;\n }\n }\n }\n }, {\n key: \"setIndex\",\n value: function setIndex(newIndex) {\n this.activeIndex = newIndex;\n }\n }, {\n key: \"spoofMouse\",\n value: function spoofMouse() {\n var _window, _window2;\n if (this.layout !== 'horizontal') {\n return;\n }\n\n // This can happen when the tooltips suddenly stop existing as children of the component\n // That update doesn't otherwise fire events, so we have to double check here.\n if (this.coordinateList.length === 0) {\n return;\n }\n var _this$container$getBo = this.container.getBoundingClientRect(),\n x = _this$container$getBo.x,\n y = _this$container$getBo.y,\n height = _this$container$getBo.height;\n var coordinate = this.coordinateList[this.activeIndex].coordinate;\n var scrollOffsetX = ((_window = window) === null || _window === void 0 ? void 0 : _window.scrollX) || 0;\n var scrollOffsetY = ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) || 0;\n var pageX = x + coordinate + scrollOffsetX;\n var pageY = y + this.offset.top + height / 2 + scrollOffsetY;\n this.mouseHandlerCallback({\n pageX: pageX,\n pageY: pageY\n });\n }\n }]);\n}();","import { isNumber } from './DataUtils';\n/**\n * Takes a domain and user props to determine whether he provided the domain via props or if we need to calculate it.\n * @param {AxisDomain} domain The potential domain from props\n * @param {Boolean} allowDataOverflow from props\n * @param {String} axisType from props\n * @returns {Boolean} `true` if domain is specified by user\n */\nexport function isDomainSpecifiedByUser(domain, allowDataOverflow, axisType) {\n if (axisType === 'number' && allowDataOverflow === true && Array.isArray(domain)) {\n var domainStart = domain === null || domain === void 0 ? void 0 : domain[0];\n var domainEnd = domain === null || domain === void 0 ? void 0 : domain[1];\n\n /*\n * The `isNumber` check is needed because the user could also provide strings like \"dataMin\" via the domain props.\n * In such case, we have to compute the domain from the data.\n */\n if (!!domainStart && !!domainEnd && isNumber(domainStart) && isNumber(domainEnd)) {\n return true;\n }\n }\n return false;\n}","export function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) {\n var halfSize = tooltipAxisBandSize / 2;\n return {\n stroke: 'none',\n fill: '#ccc',\n x: layout === 'horizontal' ? activeCoordinate.x - halfSize : offset.left + 0.5,\n y: layout === 'horizontal' ? offset.top + 0.5 : activeCoordinate.y - halfSize,\n width: layout === 'horizontal' ? tooltipAxisBandSize : offset.width - 1,\n height: layout === 'horizontal' ? offset.height - 1 : tooltipAxisBandSize\n };\n}","import { polarToCartesian } from '../PolarUtils';\n/**\n * Only applicable for radial layouts\n * @param {Object} activeCoordinate ChartCoordinate\n * @returns {Object} RadialCursorPoints\n */\nexport function getRadialCursorPoints(activeCoordinate) {\n var cx = activeCoordinate.cx,\n cy = activeCoordinate.cy,\n radius = activeCoordinate.radius,\n startAngle = activeCoordinate.startAngle,\n endAngle = activeCoordinate.endAngle;\n var startPoint = polarToCartesian(cx, cy, radius, startAngle);\n var endPoint = polarToCartesian(cx, cy, radius, endAngle);\n return {\n points: [startPoint, endPoint],\n cx: cx,\n cy: cy,\n radius: radius,\n startAngle: startAngle,\n endAngle: endAngle\n };\n}","import { polarToCartesian } from '../PolarUtils';\nimport { getRadialCursorPoints } from './getRadialCursorPoints';\nexport function getCursorPoints(layout, activeCoordinate, offset) {\n var x1, y1, x2, y2;\n if (layout === 'horizontal') {\n x1 = activeCoordinate.x;\n x2 = x1;\n y1 = offset.top;\n y2 = offset.top + offset.height;\n } else if (layout === 'vertical') {\n y1 = activeCoordinate.y;\n y2 = y1;\n x1 = offset.left;\n x2 = offset.left + offset.width;\n } else if (activeCoordinate.cx != null && activeCoordinate.cy != null) {\n if (layout === 'centric') {\n var cx = activeCoordinate.cx,\n cy = activeCoordinate.cy,\n innerRadius = activeCoordinate.innerRadius,\n outerRadius = activeCoordinate.outerRadius,\n angle = activeCoordinate.angle;\n var innerPoint = polarToCartesian(cx, cy, innerRadius, angle);\n var outerPoint = polarToCartesian(cx, cy, outerRadius, angle);\n x1 = innerPoint.x;\n y1 = innerPoint.y;\n x2 = outerPoint.x;\n y2 = outerPoint.y;\n } else {\n return getRadialCursorPoints(activeCoordinate);\n }\n }\n return [{\n x: x1,\n y: y1\n }, {\n x: x2,\n y: y2\n }];\n}","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { cloneElement, createElement, isValidElement } from 'react';\nimport clsx from 'clsx';\nimport { Curve } from '../shape/Curve';\nimport { Cross } from '../shape/Cross';\nimport { getCursorRectangle } from '../util/cursor/getCursorRectangle';\nimport { Rectangle } from '../shape/Rectangle';\nimport { getRadialCursorPoints } from '../util/cursor/getRadialCursorPoints';\nimport { Sector } from '../shape/Sector';\nimport { getCursorPoints } from '../util/cursor/getCursorPoints';\nimport { filterProps } from '../util/ReactUtils';\n/*\n * Cursor is the background, or a highlight,\n * that shows when user mouses over or activates\n * an area.\n *\n * It usually shows together with a tooltip\n * to emphasise which part of the chart does the tooltip refer to.\n */\nexport function Cursor(props) {\n var _element$props$cursor, _defaultProps;\n var element = props.element,\n tooltipEventType = props.tooltipEventType,\n isActive = props.isActive,\n activeCoordinate = props.activeCoordinate,\n activePayload = props.activePayload,\n offset = props.offset,\n activeTooltipIndex = props.activeTooltipIndex,\n tooltipAxisBandSize = props.tooltipAxisBandSize,\n layout = props.layout,\n chartName = props.chartName;\n var elementPropsCursor = (_element$props$cursor = element.props.cursor) !== null && _element$props$cursor !== void 0 ? _element$props$cursor : (_defaultProps = element.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.cursor;\n if (!element || !elementPropsCursor || !isActive || !activeCoordinate || chartName !== 'ScatterChart' && tooltipEventType !== 'axis') {\n return null;\n }\n var restProps;\n var cursorComp = Curve;\n if (chartName === 'ScatterChart') {\n restProps = activeCoordinate;\n cursorComp = Cross;\n } else if (chartName === 'BarChart') {\n restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize);\n cursorComp = Rectangle;\n } else if (layout === 'radial') {\n var _getRadialCursorPoint = getRadialCursorPoints(activeCoordinate),\n cx = _getRadialCursorPoint.cx,\n cy = _getRadialCursorPoint.cy,\n radius = _getRadialCursorPoint.radius,\n startAngle = _getRadialCursorPoint.startAngle,\n endAngle = _getRadialCursorPoint.endAngle;\n restProps = {\n cx: cx,\n cy: cy,\n startAngle: startAngle,\n endAngle: endAngle,\n innerRadius: radius,\n outerRadius: radius\n };\n cursorComp = Sector;\n } else {\n restProps = {\n points: getCursorPoints(layout, activeCoordinate, offset)\n };\n cursorComp = Curve;\n }\n var cursorProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({\n stroke: '#ccc',\n pointerEvents: 'none'\n }, offset), restProps), filterProps(elementPropsCursor, false)), {}, {\n payload: activePayload,\n payloadIndex: activeTooltipIndex,\n className: clsx('recharts-tooltip-cursor', elementPropsCursor.className)\n });\n return /*#__PURE__*/isValidElement(elementPropsCursor) ? /*#__PURE__*/cloneElement(elementPropsCursor, cursorProps) : /*#__PURE__*/createElement(cursorComp, cursorProps);\n}","var _excluded = [\"item\"],\n _excluded2 = [\"children\", \"className\", \"width\", \"height\", \"style\", \"compact\", \"title\", \"desc\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport React, { Component, cloneElement, isValidElement, forwardRef } from 'react';\nimport isNil from 'lodash/isNil';\nimport isFunction from 'lodash/isFunction';\nimport range from 'lodash/range';\nimport get from 'lodash/get';\nimport sortBy from 'lodash/sortBy';\nimport throttle from 'lodash/throttle';\nimport clsx from 'clsx';\n// eslint-disable-next-line no-restricted-imports\n\nimport invariant from 'tiny-invariant';\nimport { Surface } from '../container/Surface';\nimport { Layer } from '../container/Layer';\nimport { Tooltip } from '../component/Tooltip';\nimport { Legend } from '../component/Legend';\nimport { Dot } from '../shape/Dot';\nimport { isInRectangle } from '../shape/Rectangle';\nimport { filterProps, findAllByType, findChildByType, getDisplayName, getReactEventByType, isChildrenEqual, parseChildIndex, renderByOrder, validateWidthHeight } from '../util/ReactUtils';\nimport { Brush } from '../cartesian/Brush';\nimport { getOffset } from '../util/DOMUtils';\nimport { findEntryInArray, getAnyElementOfObject, hasDuplicate, isNumber, uniqueId } from '../util/DataUtils';\nimport { appendOffsetOfLegend, calculateActiveTickIndex, combineEventHandlers, getBandSizeOfAxis, getBarPosition, getBarSizeList, getDomainOfDataByKey, getDomainOfItemsWithSameAxis, getDomainOfStackGroups, getLegendProps, getMainColorOfGraphicItem, getStackedDataOfItem, getStackGroupsByAxisId, getTicksOfAxis, getTooltipItem, isCategoricalAxis, parseDomainOfCategoryAxis, parseErrorBarsOfAxis, parseSpecifiedDomain } from '../util/ChartUtils';\nimport { detectReferenceElementsDomain } from '../util/DetectReferenceElementsDomain';\nimport { inRangeOfSector, polarToCartesian } from '../util/PolarUtils';\nimport { shallowEqual } from '../util/ShallowEqual';\nimport { eventCenter, SYNC_EVENT } from '../util/Events';\nimport { adaptEventHandlers } from '../util/types';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { isDomainSpecifiedByUser } from '../util/isDomainSpecifiedByUser';\nimport { getActiveShapeIndexForTooltip, isFunnel, isPie, isScatter } from '../util/ActiveShapeUtils';\nimport { Cursor } from '../component/Cursor';\nimport { ChartLayoutContextProvider } from '../context/chartLayoutContext';\nvar ORIENT_MAP = {\n xAxis: ['bottom', 'top'],\n yAxis: ['left', 'right']\n};\nvar FULL_WIDTH_AND_HEIGHT = {\n width: '100%',\n height: '100%'\n};\nvar originCoordinate = {\n x: 0,\n y: 0\n};\n\n/**\n * This function exists as a temporary workaround.\n *\n * Why? generateCategoricalChart does not render `{children}` directly;\n * instead it passes them through `renderByOrder` function which reads their handlers.\n *\n * So, this is a handler that does nothing.\n * Once we get rid of `renderByOrder` and switch to JSX only, we can get rid of this handler too.\n *\n * @param {JSX} element as is in JSX\n * @returns {JSX} the same element\n */\nfunction renderAsIs(element) {\n return element;\n}\nvar calculateTooltipPos = function calculateTooltipPos(rangeObj, layout) {\n if (layout === 'horizontal') {\n return rangeObj.x;\n }\n if (layout === 'vertical') {\n return rangeObj.y;\n }\n if (layout === 'centric') {\n return rangeObj.angle;\n }\n return rangeObj.radius;\n};\nvar getActiveCoordinate = function getActiveCoordinate(layout, tooltipTicks, activeIndex, rangeObj) {\n var entry = tooltipTicks.find(function (tick) {\n return tick && tick.index === activeIndex;\n });\n if (entry) {\n if (layout === 'horizontal') {\n return {\n x: entry.coordinate,\n y: rangeObj.y\n };\n }\n if (layout === 'vertical') {\n return {\n x: rangeObj.x,\n y: entry.coordinate\n };\n }\n if (layout === 'centric') {\n var _angle = entry.coordinate;\n var _radius = rangeObj.radius;\n return _objectSpread(_objectSpread(_objectSpread({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, _radius, _angle)), {}, {\n angle: _angle,\n radius: _radius\n });\n }\n var radius = entry.coordinate;\n var angle = rangeObj.angle;\n return _objectSpread(_objectSpread(_objectSpread({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, radius, angle)), {}, {\n angle: angle,\n radius: radius\n });\n }\n return originCoordinate;\n};\nvar getDisplayedData = function getDisplayedData(data, _ref) {\n var graphicalItems = _ref.graphicalItems,\n dataStartIndex = _ref.dataStartIndex,\n dataEndIndex = _ref.dataEndIndex;\n var itemsData = (graphicalItems !== null && graphicalItems !== void 0 ? graphicalItems : []).reduce(function (result, child) {\n var itemData = child.props.data;\n if (itemData && itemData.length) {\n return [].concat(_toConsumableArray(result), _toConsumableArray(itemData));\n }\n return result;\n }, []);\n if (itemsData.length > 0) {\n return itemsData;\n }\n if (data && data.length && isNumber(dataStartIndex) && isNumber(dataEndIndex)) {\n return data.slice(dataStartIndex, dataEndIndex + 1);\n }\n return [];\n};\nfunction getDefaultDomainByAxisType(axisType) {\n return axisType === 'number' ? [0, 'auto'] : undefined;\n}\n\n/**\n * Get the content to be displayed in the tooltip\n * @param {Object} state Current state\n * @param {Array} chartData The data defined in chart\n * @param {Number} activeIndex Active index of data\n * @param {String} activeLabel Active label of data\n * @return {Array} The content of tooltip\n */\nvar getTooltipContent = function getTooltipContent(state, chartData, activeIndex, activeLabel) {\n var graphicalItems = state.graphicalItems,\n tooltipAxis = state.tooltipAxis;\n var displayedData = getDisplayedData(chartData, state);\n if (activeIndex < 0 || !graphicalItems || !graphicalItems.length || activeIndex >= displayedData.length) {\n return null;\n }\n // get data by activeIndex when the axis don't allow duplicated category\n return graphicalItems.reduce(function (result, child) {\n var _child$props$data;\n /**\n * Fixes: https://github.com/recharts/recharts/issues/3669\n * Defaulting to chartData below to fix an edge case where the tooltip does not include data from all charts\n * when a separate dataset is passed to chart prop data and specified on Line/Area/etc prop data\n */\n var data = (_child$props$data = child.props.data) !== null && _child$props$data !== void 0 ? _child$props$data : chartData;\n if (data && state.dataStartIndex + state.dataEndIndex !== 0 &&\n // https://github.com/recharts/recharts/issues/4717\n // The data is sliced only when the active index is within the start/end index range.\n state.dataEndIndex - state.dataStartIndex >= activeIndex) {\n data = data.slice(state.dataStartIndex, state.dataEndIndex + 1);\n }\n var payload;\n if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) {\n // graphic child has data props\n var entries = data === undefined ? displayedData : data;\n payload = findEntryInArray(entries, tooltipAxis.dataKey, activeLabel);\n } else {\n payload = data && data[activeIndex] || displayedData[activeIndex];\n }\n if (!payload) {\n return result;\n }\n return [].concat(_toConsumableArray(result), [getTooltipItem(child, payload)]);\n }, []);\n};\n\n/**\n * Returns tooltip data based on a mouse position (as a parameter or in state)\n * @param {Object} state current state\n * @param {Array} chartData the data defined in chart\n * @param {String} layout The layout type of chart\n * @param {Object} rangeObj { x, y } coordinates\n * @return {Object} Tooltip data data\n */\nvar getTooltipData = function getTooltipData(state, chartData, layout, rangeObj) {\n var rangeData = rangeObj || {\n x: state.chartX,\n y: state.chartY\n };\n var pos = calculateTooltipPos(rangeData, layout);\n var ticks = state.orderedTooltipTicks,\n axis = state.tooltipAxis,\n tooltipTicks = state.tooltipTicks;\n var activeIndex = calculateActiveTickIndex(pos, ticks, tooltipTicks, axis);\n if (activeIndex >= 0 && tooltipTicks) {\n var activeLabel = tooltipTicks[activeIndex] && tooltipTicks[activeIndex].value;\n var activePayload = getTooltipContent(state, chartData, activeIndex, activeLabel);\n var activeCoordinate = getActiveCoordinate(layout, ticks, activeIndex, rangeData);\n return {\n activeTooltipIndex: activeIndex,\n activeLabel: activeLabel,\n activePayload: activePayload,\n activeCoordinate: activeCoordinate\n };\n }\n return null;\n};\n\n/**\n * Get the configuration of axis by the options of axis instance\n * @param {Object} props Latest props\n * @param {Array} axes The instance of axes\n * @param {Array} graphicalItems The instances of item\n * @param {String} axisType The type of axis, xAxis - x-axis, yAxis - y-axis\n * @param {String} axisIdKey The unique id of an axis\n * @param {Object} stackGroups The items grouped by axisId and stackId\n * @param {Number} dataStartIndex The start index of the data series when a brush is applied\n * @param {Number} dataEndIndex The end index of the data series when a brush is applied\n * @return {Object} Configuration\n */\nexport var getAxisMapByAxes = function getAxisMapByAxes(props, _ref2) {\n var axes = _ref2.axes,\n graphicalItems = _ref2.graphicalItems,\n axisType = _ref2.axisType,\n axisIdKey = _ref2.axisIdKey,\n stackGroups = _ref2.stackGroups,\n dataStartIndex = _ref2.dataStartIndex,\n dataEndIndex = _ref2.dataEndIndex;\n var layout = props.layout,\n children = props.children,\n stackOffset = props.stackOffset;\n var isCategorical = isCategoricalAxis(layout, axisType);\n\n // Eliminate duplicated axes\n return axes.reduce(function (result, child) {\n var _childProps$domain2;\n var childProps = child.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, child.type.defaultProps), child.props) : child.props;\n var type = childProps.type,\n dataKey = childProps.dataKey,\n allowDataOverflow = childProps.allowDataOverflow,\n allowDuplicatedCategory = childProps.allowDuplicatedCategory,\n scale = childProps.scale,\n ticks = childProps.ticks,\n includeHidden = childProps.includeHidden;\n var axisId = childProps[axisIdKey];\n if (result[axisId]) {\n return result;\n }\n var displayedData = getDisplayedData(props.data, {\n graphicalItems: graphicalItems.filter(function (item) {\n var _defaultProps;\n var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps = item.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps[axisIdKey];\n return itemAxisId === axisId;\n }),\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n });\n var len = displayedData.length;\n var domain, duplicateDomain, categoricalDomain;\n\n /*\n * This is a hack to short-circuit the domain creation here to enhance performance.\n * Usually, the data is used to determine the domain, but when the user specifies\n * a domain upfront (via props), there is no need to calculate the domain start and end,\n * which is very expensive for a larger amount of data.\n * The only thing that would prohibit short-circuiting is when the user doesn't allow data overflow,\n * because the axis is supposed to ignore the specified domain that way.\n */\n if (isDomainSpecifiedByUser(childProps.domain, allowDataOverflow, type)) {\n domain = parseSpecifiedDomain(childProps.domain, null, allowDataOverflow);\n /* The chart can be categorical and have the domain specified in numbers\n * we still need to calculate the categorical domain\n * TODO: refactor this more\n */\n if (isCategorical && (type === 'number' || scale !== 'auto')) {\n categoricalDomain = getDomainOfDataByKey(displayedData, dataKey, 'category');\n }\n }\n\n // if the domain is defaulted we need this for `originalDomain` as well\n var defaultDomain = getDefaultDomainByAxisType(type);\n\n // we didn't create the domain from user's props above, so we need to calculate it\n if (!domain || domain.length === 0) {\n var _childProps$domain;\n var childDomain = (_childProps$domain = childProps.domain) !== null && _childProps$domain !== void 0 ? _childProps$domain : defaultDomain;\n if (dataKey) {\n // has dataKey in \n domain = getDomainOfDataByKey(displayedData, dataKey, type);\n if (type === 'category' && isCategorical) {\n // the field type is category data and this axis is categorical axis\n var duplicate = hasDuplicate(domain);\n if (allowDuplicatedCategory && duplicate) {\n duplicateDomain = domain;\n // When category axis has duplicated text, serial numbers are used to generate scale\n domain = range(0, len);\n } else if (!allowDuplicatedCategory) {\n // remove duplicated category\n domain = parseDomainOfCategoryAxis(childDomain, domain, child).reduce(function (finalDomain, entry) {\n return finalDomain.indexOf(entry) >= 0 ? finalDomain : [].concat(_toConsumableArray(finalDomain), [entry]);\n }, []);\n }\n } else if (type === 'category') {\n // the field type is category data and this axis is numerical axis\n if (!allowDuplicatedCategory) {\n domain = parseDomainOfCategoryAxis(childDomain, domain, child).reduce(function (finalDomain, entry) {\n return finalDomain.indexOf(entry) >= 0 || entry === '' || isNil(entry) ? finalDomain : [].concat(_toConsumableArray(finalDomain), [entry]);\n }, []);\n } else {\n // eliminate undefined or null or empty string\n domain = domain.filter(function (entry) {\n return entry !== '' && !isNil(entry);\n });\n }\n } else if (type === 'number') {\n // the field type is numerical\n var errorBarsDomain = parseErrorBarsOfAxis(displayedData, graphicalItems.filter(function (item) {\n var _defaultProps2, _defaultProps3;\n var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps2 = item.type.defaultProps) === null || _defaultProps2 === void 0 ? void 0 : _defaultProps2[axisIdKey];\n var itemHide = 'hide' in item.props ? item.props.hide : (_defaultProps3 = item.type.defaultProps) === null || _defaultProps3 === void 0 ? void 0 : _defaultProps3.hide;\n return itemAxisId === axisId && (includeHidden || !itemHide);\n }), dataKey, axisType, layout);\n if (errorBarsDomain) {\n domain = errorBarsDomain;\n }\n }\n if (isCategorical && (type === 'number' || scale !== 'auto')) {\n categoricalDomain = getDomainOfDataByKey(displayedData, dataKey, 'category');\n }\n } else if (isCategorical) {\n // the axis is a categorical axis\n domain = range(0, len);\n } else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack && type === 'number') {\n // when stackOffset is 'expand', the domain may be calculated as [0, 1.000000000002]\n domain = stackOffset === 'expand' ? [0, 1] : getDomainOfStackGroups(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex);\n } else {\n domain = getDomainOfItemsWithSameAxis(displayedData, graphicalItems.filter(function (item) {\n var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : item.type.defaultProps[axisIdKey];\n var itemHide = 'hide' in item.props ? item.props.hide : item.type.defaultProps.hide;\n return itemAxisId === axisId && (includeHidden || !itemHide);\n }), type, layout, true);\n }\n if (type === 'number') {\n // To detect wether there is any reference lines whose props alwaysShow is true\n domain = detectReferenceElementsDomain(children, domain, axisId, axisType, ticks);\n if (childDomain) {\n domain = parseSpecifiedDomain(childDomain, domain, allowDataOverflow);\n }\n } else if (type === 'category' && childDomain) {\n var axisDomain = childDomain;\n var isDomainValid = domain.every(function (entry) {\n return axisDomain.indexOf(entry) >= 0;\n });\n if (isDomainValid) {\n domain = axisDomain;\n }\n }\n }\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, axisId, _objectSpread(_objectSpread({}, childProps), {}, {\n axisType: axisType,\n domain: domain,\n categoricalDomain: categoricalDomain,\n duplicateDomain: duplicateDomain,\n originalDomain: (_childProps$domain2 = childProps.domain) !== null && _childProps$domain2 !== void 0 ? _childProps$domain2 : defaultDomain,\n isCategorical: isCategorical,\n layout: layout\n })));\n }, {});\n};\n\n/**\n * Get the configuration of axis by the options of item,\n * this kind of axis does not display in chart\n * @param {Object} props Latest props\n * @param {Array} graphicalItems The instances of item\n * @param {ReactElement} Axis Axis Component\n * @param {String} axisType The type of axis, xAxis - x-axis, yAxis - y-axis\n * @param {String} axisIdKey The unique id of an axis\n * @param {Object} stackGroups The items grouped by axisId and stackId\n * @param {Number} dataStartIndex The start index of the data series when a brush is applied\n * @param {Number} dataEndIndex The end index of the data series when a brush is applied\n * @return {Object} Configuration\n */\nvar getAxisMapByItems = function getAxisMapByItems(props, _ref3) {\n var graphicalItems = _ref3.graphicalItems,\n Axis = _ref3.Axis,\n axisType = _ref3.axisType,\n axisIdKey = _ref3.axisIdKey,\n stackGroups = _ref3.stackGroups,\n dataStartIndex = _ref3.dataStartIndex,\n dataEndIndex = _ref3.dataEndIndex;\n var layout = props.layout,\n children = props.children;\n var displayedData = getDisplayedData(props.data, {\n graphicalItems: graphicalItems,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n });\n var len = displayedData.length;\n var isCategorical = isCategoricalAxis(layout, axisType);\n var index = -1;\n\n // The default type of x-axis is category axis,\n // The default contents of x-axis is the serial numbers of data\n // The default type of y-axis is number axis\n // The default contents of y-axis is the domain of data\n return graphicalItems.reduce(function (result, child) {\n var childProps = child.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, child.type.defaultProps), child.props) : child.props;\n var axisId = childProps[axisIdKey];\n var originalDomain = getDefaultDomainByAxisType('number');\n if (!result[axisId]) {\n index++;\n var domain;\n if (isCategorical) {\n domain = range(0, len);\n } else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack) {\n domain = getDomainOfStackGroups(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex);\n domain = detectReferenceElementsDomain(children, domain, axisId, axisType);\n } else {\n domain = parseSpecifiedDomain(originalDomain, getDomainOfItemsWithSameAxis(displayedData, graphicalItems.filter(function (item) {\n var _defaultProps4, _defaultProps5;\n var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps4 = item.type.defaultProps) === null || _defaultProps4 === void 0 ? void 0 : _defaultProps4[axisIdKey];\n var itemHide = 'hide' in item.props ? item.props.hide : (_defaultProps5 = item.type.defaultProps) === null || _defaultProps5 === void 0 ? void 0 : _defaultProps5.hide;\n return itemAxisId === axisId && !itemHide;\n }), 'number', layout), Axis.defaultProps.allowDataOverflow);\n domain = detectReferenceElementsDomain(children, domain, axisId, axisType);\n }\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, axisId, _objectSpread(_objectSpread({\n axisType: axisType\n }, Axis.defaultProps), {}, {\n hide: true,\n orientation: get(ORIENT_MAP, \"\".concat(axisType, \".\").concat(index % 2), null),\n domain: domain,\n originalDomain: originalDomain,\n isCategorical: isCategorical,\n layout: layout\n // specify scale when no Axis\n // scale: isCategorical ? 'band' : 'linear',\n })));\n }\n return result;\n }, {});\n};\n\n/**\n * Get the configuration of all x-axis or y-axis\n * @param {Object} props Latest props\n * @param {String} axisType The type of axis\n * @param {React.ComponentType} [AxisComp] Axis Component\n * @param {Array} graphicalItems The instances of item\n * @param {Object} stackGroups The items grouped by axisId and stackId\n * @param {Number} dataStartIndex The start index of the data series when a brush is applied\n * @param {Number} dataEndIndex The end index of the data series when a brush is applied\n * @return {Object} Configuration\n */\nvar getAxisMap = function getAxisMap(props, _ref4) {\n var _ref4$axisType = _ref4.axisType,\n axisType = _ref4$axisType === void 0 ? 'xAxis' : _ref4$axisType,\n AxisComp = _ref4.AxisComp,\n graphicalItems = _ref4.graphicalItems,\n stackGroups = _ref4.stackGroups,\n dataStartIndex = _ref4.dataStartIndex,\n dataEndIndex = _ref4.dataEndIndex;\n var children = props.children;\n var axisIdKey = \"\".concat(axisType, \"Id\");\n // Get all the instance of Axis\n var axes = findAllByType(children, AxisComp);\n var axisMap = {};\n if (axes && axes.length) {\n axisMap = getAxisMapByAxes(props, {\n axes: axes,\n graphicalItems: graphicalItems,\n axisType: axisType,\n axisIdKey: axisIdKey,\n stackGroups: stackGroups,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n });\n } else if (graphicalItems && graphicalItems.length) {\n axisMap = getAxisMapByItems(props, {\n Axis: AxisComp,\n graphicalItems: graphicalItems,\n axisType: axisType,\n axisIdKey: axisIdKey,\n stackGroups: stackGroups,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n });\n }\n return axisMap;\n};\nvar tooltipTicksGenerator = function tooltipTicksGenerator(axisMap) {\n var axis = getAnyElementOfObject(axisMap);\n var tooltipTicks = getTicksOfAxis(axis, false, true);\n return {\n tooltipTicks: tooltipTicks,\n orderedTooltipTicks: sortBy(tooltipTicks, function (o) {\n return o.coordinate;\n }),\n tooltipAxis: axis,\n tooltipAxisBandSize: getBandSizeOfAxis(axis, tooltipTicks)\n };\n};\n\n/**\n * Returns default, reset state for the categorical chart.\n * @param {Object} props Props object to use when creating the default state\n * @return {Object} Whole new state\n */\nexport var createDefaultState = function createDefaultState(props) {\n var children = props.children,\n defaultShowTooltip = props.defaultShowTooltip;\n var brushItem = findChildByType(children, Brush);\n var startIndex = 0;\n var endIndex = 0;\n if (props.data && props.data.length !== 0) {\n endIndex = props.data.length - 1;\n }\n if (brushItem && brushItem.props) {\n if (brushItem.props.startIndex >= 0) {\n startIndex = brushItem.props.startIndex;\n }\n if (brushItem.props.endIndex >= 0) {\n endIndex = brushItem.props.endIndex;\n }\n }\n return {\n chartX: 0,\n chartY: 0,\n dataStartIndex: startIndex,\n dataEndIndex: endIndex,\n activeTooltipIndex: -1,\n isTooltipActive: Boolean(defaultShowTooltip)\n };\n};\nvar hasGraphicalBarItem = function hasGraphicalBarItem(graphicalItems) {\n if (!graphicalItems || !graphicalItems.length) {\n return false;\n }\n return graphicalItems.some(function (item) {\n var name = getDisplayName(item && item.type);\n return name && name.indexOf('Bar') >= 0;\n });\n};\nvar getAxisNameByLayout = function getAxisNameByLayout(layout) {\n if (layout === 'horizontal') {\n return {\n numericAxisName: 'yAxis',\n cateAxisName: 'xAxis'\n };\n }\n if (layout === 'vertical') {\n return {\n numericAxisName: 'xAxis',\n cateAxisName: 'yAxis'\n };\n }\n if (layout === 'centric') {\n return {\n numericAxisName: 'radiusAxis',\n cateAxisName: 'angleAxis'\n };\n }\n return {\n numericAxisName: 'angleAxis',\n cateAxisName: 'radiusAxis'\n };\n};\n\n/**\n * Calculate the offset of main part in the svg element\n * @param {Object} params.props Latest props\n * @param {Array} params.graphicalItems The instances of item\n * @param {Object} params.xAxisMap The configuration of x-axis\n * @param {Object} params.yAxisMap The configuration of y-axis\n * @param {Object} prevLegendBBox The boundary box of legend\n * @return {Object} The offset of main part in the svg element\n */\nvar calculateOffset = function calculateOffset(_ref5, prevLegendBBox) {\n var props = _ref5.props,\n graphicalItems = _ref5.graphicalItems,\n _ref5$xAxisMap = _ref5.xAxisMap,\n xAxisMap = _ref5$xAxisMap === void 0 ? {} : _ref5$xAxisMap,\n _ref5$yAxisMap = _ref5.yAxisMap,\n yAxisMap = _ref5$yAxisMap === void 0 ? {} : _ref5$yAxisMap;\n var width = props.width,\n height = props.height,\n children = props.children;\n var margin = props.margin || {};\n var brushItem = findChildByType(children, Brush);\n var legendItem = findChildByType(children, Legend);\n var offsetH = Object.keys(yAxisMap).reduce(function (result, id) {\n var entry = yAxisMap[id];\n var orientation = entry.orientation;\n if (!entry.mirror && !entry.hide) {\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, orientation, result[orientation] + entry.width));\n }\n return result;\n }, {\n left: margin.left || 0,\n right: margin.right || 0\n });\n var offsetV = Object.keys(xAxisMap).reduce(function (result, id) {\n var entry = xAxisMap[id];\n var orientation = entry.orientation;\n if (!entry.mirror && !entry.hide) {\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, orientation, get(result, \"\".concat(orientation)) + entry.height));\n }\n return result;\n }, {\n top: margin.top || 0,\n bottom: margin.bottom || 0\n });\n var offset = _objectSpread(_objectSpread({}, offsetV), offsetH);\n var brushBottom = offset.bottom;\n if (brushItem) {\n offset.bottom += brushItem.props.height || Brush.defaultProps.height;\n }\n if (legendItem && prevLegendBBox) {\n // @ts-expect-error margin is optional in props but required in appendOffsetOfLegend\n offset = appendOffsetOfLegend(offset, graphicalItems, props, prevLegendBBox);\n }\n var offsetWidth = width - offset.left - offset.right;\n var offsetHeight = height - offset.top - offset.bottom;\n return _objectSpread(_objectSpread({\n brushBottom: brushBottom\n }, offset), {}, {\n // never return negative values for height and width\n width: Math.max(offsetWidth, 0),\n height: Math.max(offsetHeight, 0)\n });\n};\n// Determine the size of the axis, used for calculation of relative bar sizes\nvar getCartesianAxisSize = function getCartesianAxisSize(axisObj, axisName) {\n if (axisName === 'xAxis') {\n return axisObj[axisName].width;\n }\n if (axisName === 'yAxis') {\n return axisObj[axisName].height;\n }\n // This is only supported for Bar charts (i.e. charts with cartesian axes), so we should never get here\n return undefined;\n};\nexport var generateCategoricalChart = function generateCategoricalChart(_ref6) {\n var chartName = _ref6.chartName,\n GraphicalChild = _ref6.GraphicalChild,\n _ref6$defaultTooltipE = _ref6.defaultTooltipEventType,\n defaultTooltipEventType = _ref6$defaultTooltipE === void 0 ? 'axis' : _ref6$defaultTooltipE,\n _ref6$validateTooltip = _ref6.validateTooltipEventTypes,\n validateTooltipEventTypes = _ref6$validateTooltip === void 0 ? ['axis'] : _ref6$validateTooltip,\n axisComponents = _ref6.axisComponents,\n legendContent = _ref6.legendContent,\n formatAxisMap = _ref6.formatAxisMap,\n defaultProps = _ref6.defaultProps;\n var getFormatItems = function getFormatItems(props, currentState) {\n var graphicalItems = currentState.graphicalItems,\n stackGroups = currentState.stackGroups,\n offset = currentState.offset,\n updateId = currentState.updateId,\n dataStartIndex = currentState.dataStartIndex,\n dataEndIndex = currentState.dataEndIndex;\n var barSize = props.barSize,\n layout = props.layout,\n barGap = props.barGap,\n barCategoryGap = props.barCategoryGap,\n globalMaxBarSize = props.maxBarSize;\n var _getAxisNameByLayout = getAxisNameByLayout(layout),\n numericAxisName = _getAxisNameByLayout.numericAxisName,\n cateAxisName = _getAxisNameByLayout.cateAxisName;\n var hasBar = hasGraphicalBarItem(graphicalItems);\n var formattedItems = [];\n graphicalItems.forEach(function (item, index) {\n var displayedData = getDisplayedData(props.data, {\n graphicalItems: [item],\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n });\n var itemProps = item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var dataKey = itemProps.dataKey,\n childMaxBarSize = itemProps.maxBarSize;\n // axisId of the numerical axis\n var numericAxisId = itemProps[\"\".concat(numericAxisName, \"Id\")];\n // axisId of the categorical axis\n var cateAxisId = itemProps[\"\".concat(cateAxisName, \"Id\")];\n var axisObjInitialValue = {};\n var axisObj = axisComponents.reduce(function (result, entry) {\n var _item$type$displayNam, _item$type;\n // map of axisId to axis for a specific axis type\n var axisMap = currentState[\"\".concat(entry.axisType, \"Map\")];\n // axisId of axis we are currently computing\n var id = itemProps[\"\".concat(entry.axisType, \"Id\")];\n\n /**\n * tell the user in dev mode that their configuration is incorrect if we cannot find a match between\n * axisId on the chart and axisId on the axis. zAxis does not get passed in the map for ComposedChart,\n * leave it out of the check for now.\n */\n !(axisMap && axisMap[id] || entry.axisType === 'zAxis') ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Specifying a(n) \".concat(entry.axisType, \"Id requires a corresponding \").concat(entry.axisType\n // @ts-expect-error we should stop reading data from ReactElements\n , \"Id on the targeted graphical component \").concat((_item$type$displayNam = item === null || item === void 0 || (_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.displayName) !== null && _item$type$displayNam !== void 0 ? _item$type$displayNam : '')) : invariant(false) : void 0;\n\n // the axis we are currently formatting\n var axis = axisMap[id];\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty(_defineProperty({}, entry.axisType, axis), \"\".concat(entry.axisType, \"Ticks\"), getTicksOfAxis(axis)));\n }, axisObjInitialValue);\n var cateAxis = axisObj[cateAxisName];\n var cateTicks = axisObj[\"\".concat(cateAxisName, \"Ticks\")];\n var stackedData = stackGroups && stackGroups[numericAxisId] && stackGroups[numericAxisId].hasStack && getStackedDataOfItem(item, stackGroups[numericAxisId].stackGroups);\n var itemIsBar = getDisplayName(item.type).indexOf('Bar') >= 0;\n var bandSize = getBandSizeOfAxis(cateAxis, cateTicks);\n var barPosition = [];\n var sizeList = hasBar && getBarSizeList({\n barSize: barSize,\n stackGroups: stackGroups,\n totalSize: getCartesianAxisSize(axisObj, cateAxisName)\n });\n if (itemIsBar) {\n var _ref7, _getBandSizeOfAxis;\n // If it is bar, calculate the position of bar\n var maxBarSize = isNil(childMaxBarSize) ? globalMaxBarSize : childMaxBarSize;\n var barBandSize = (_ref7 = (_getBandSizeOfAxis = getBandSizeOfAxis(cateAxis, cateTicks, true)) !== null && _getBandSizeOfAxis !== void 0 ? _getBandSizeOfAxis : maxBarSize) !== null && _ref7 !== void 0 ? _ref7 : 0;\n barPosition = getBarPosition({\n barGap: barGap,\n barCategoryGap: barCategoryGap,\n bandSize: barBandSize !== bandSize ? barBandSize : bandSize,\n sizeList: sizeList[cateAxisId],\n maxBarSize: maxBarSize\n });\n if (barBandSize !== bandSize) {\n barPosition = barPosition.map(function (pos) {\n return _objectSpread(_objectSpread({}, pos), {}, {\n position: _objectSpread(_objectSpread({}, pos.position), {}, {\n offset: pos.position.offset - barBandSize / 2\n })\n });\n });\n }\n }\n // @ts-expect-error we should stop reading data from ReactElements\n var composedFn = item && item.type && item.type.getComposedData;\n if (composedFn) {\n formattedItems.push({\n props: _objectSpread(_objectSpread({}, composedFn(_objectSpread(_objectSpread({}, axisObj), {}, {\n displayedData: displayedData,\n props: props,\n dataKey: dataKey,\n item: item,\n bandSize: bandSize,\n barPosition: barPosition,\n offset: offset,\n stackedData: stackedData,\n layout: layout,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n }))), {}, _defineProperty(_defineProperty(_defineProperty({\n key: item.key || \"item-\".concat(index)\n }, numericAxisName, axisObj[numericAxisName]), cateAxisName, axisObj[cateAxisName]), \"animationId\", updateId)),\n childIndex: parseChildIndex(item, props.children),\n item: item\n });\n }\n });\n return formattedItems;\n };\n\n /**\n * The AxisMaps are expensive to render on large data sets\n * so provide the ability to store them in state and only update them when necessary\n * they are dependent upon the start and end index of\n * the brush so it's important that this method is called _after_\n * the state is updated with any new start/end indices\n *\n * @param {Object} props The props object to be used for updating the axismaps\n * dataStartIndex: The start index of the data series when a brush is applied\n * dataEndIndex: The end index of the data series when a brush is applied\n * updateId: The update id\n * @param {Object} prevState Prev state\n * @return {Object} state New state to set\n */\n var updateStateOfAxisMapsOffsetAndStackGroups = function updateStateOfAxisMapsOffsetAndStackGroups(_ref8, prevState) {\n var props = _ref8.props,\n dataStartIndex = _ref8.dataStartIndex,\n dataEndIndex = _ref8.dataEndIndex,\n updateId = _ref8.updateId;\n if (!validateWidthHeight({\n props: props\n })) {\n return null;\n }\n var children = props.children,\n layout = props.layout,\n stackOffset = props.stackOffset,\n data = props.data,\n reverseStackOrder = props.reverseStackOrder;\n var _getAxisNameByLayout2 = getAxisNameByLayout(layout),\n numericAxisName = _getAxisNameByLayout2.numericAxisName,\n cateAxisName = _getAxisNameByLayout2.cateAxisName;\n var graphicalItems = findAllByType(children, GraphicalChild);\n var stackGroups = getStackGroupsByAxisId(data, graphicalItems, \"\".concat(numericAxisName, \"Id\"), \"\".concat(cateAxisName, \"Id\"), stackOffset, reverseStackOrder);\n var axisObj = axisComponents.reduce(function (result, entry) {\n var name = \"\".concat(entry.axisType, \"Map\");\n return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, name, getAxisMap(props, _objectSpread(_objectSpread({}, entry), {}, {\n graphicalItems: graphicalItems,\n stackGroups: entry.axisType === numericAxisName && stackGroups,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n }))));\n }, {});\n var offset = calculateOffset(_objectSpread(_objectSpread({}, axisObj), {}, {\n props: props,\n graphicalItems: graphicalItems\n }), prevState === null || prevState === void 0 ? void 0 : prevState.legendBBox);\n Object.keys(axisObj).forEach(function (key) {\n axisObj[key] = formatAxisMap(props, axisObj[key], offset, key.replace('Map', ''), chartName);\n });\n var cateAxisMap = axisObj[\"\".concat(cateAxisName, \"Map\")];\n var ticksObj = tooltipTicksGenerator(cateAxisMap);\n var formattedGraphicalItems = getFormatItems(props, _objectSpread(_objectSpread({}, axisObj), {}, {\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex,\n updateId: updateId,\n graphicalItems: graphicalItems,\n stackGroups: stackGroups,\n offset: offset\n }));\n return _objectSpread(_objectSpread({\n formattedGraphicalItems: formattedGraphicalItems,\n graphicalItems: graphicalItems,\n offset: offset,\n stackGroups: stackGroups\n }, ticksObj), axisObj);\n };\n var CategoricalChartWrapper = /*#__PURE__*/function (_Component) {\n function CategoricalChartWrapper(_props) {\n var _props$id, _props$throttleDelay;\n var _this;\n _classCallCheck(this, CategoricalChartWrapper);\n _this = _callSuper(this, CategoricalChartWrapper, [_props]);\n _defineProperty(_this, \"eventEmitterSymbol\", Symbol('rechartsEventEmitter'));\n _defineProperty(_this, \"accessibilityManager\", new AccessibilityManager());\n _defineProperty(_this, \"handleLegendBBoxUpdate\", function (box) {\n if (box) {\n var _this$state = _this.state,\n dataStartIndex = _this$state.dataStartIndex,\n dataEndIndex = _this$state.dataEndIndex,\n updateId = _this$state.updateId;\n _this.setState(_objectSpread({\n legendBBox: box\n }, updateStateOfAxisMapsOffsetAndStackGroups({\n props: _this.props,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex,\n updateId: updateId\n }, _objectSpread(_objectSpread({}, _this.state), {}, {\n legendBBox: box\n }))));\n }\n });\n _defineProperty(_this, \"handleReceiveSyncEvent\", function (cId, data, emitter) {\n if (_this.props.syncId === cId) {\n if (emitter === _this.eventEmitterSymbol && typeof _this.props.syncMethod !== 'function') {\n return;\n }\n _this.applySyncEvent(data);\n }\n });\n _defineProperty(_this, \"handleBrushChange\", function (_ref9) {\n var startIndex = _ref9.startIndex,\n endIndex = _ref9.endIndex;\n // Only trigger changes if the extents of the brush have actually changed\n if (startIndex !== _this.state.dataStartIndex || endIndex !== _this.state.dataEndIndex) {\n var updateId = _this.state.updateId;\n _this.setState(function () {\n return _objectSpread({\n dataStartIndex: startIndex,\n dataEndIndex: endIndex\n }, updateStateOfAxisMapsOffsetAndStackGroups({\n props: _this.props,\n dataStartIndex: startIndex,\n dataEndIndex: endIndex,\n updateId: updateId\n }, _this.state));\n });\n _this.triggerSyncEvent({\n dataStartIndex: startIndex,\n dataEndIndex: endIndex\n });\n }\n });\n /**\n * The handler of mouse entering chart\n * @param {Object} e Event object\n * @return {Null} null\n */\n _defineProperty(_this, \"handleMouseEnter\", function (e) {\n var mouse = _this.getMouseInfo(e);\n if (mouse) {\n var _nextState = _objectSpread(_objectSpread({}, mouse), {}, {\n isTooltipActive: true\n });\n _this.setState(_nextState);\n _this.triggerSyncEvent(_nextState);\n var onMouseEnter = _this.props.onMouseEnter;\n if (isFunction(onMouseEnter)) {\n onMouseEnter(_nextState, e);\n }\n }\n });\n _defineProperty(_this, \"triggeredAfterMouseMove\", function (e) {\n var mouse = _this.getMouseInfo(e);\n var nextState = mouse ? _objectSpread(_objectSpread({}, mouse), {}, {\n isTooltipActive: true\n }) : {\n isTooltipActive: false\n };\n _this.setState(nextState);\n _this.triggerSyncEvent(nextState);\n var onMouseMove = _this.props.onMouseMove;\n if (isFunction(onMouseMove)) {\n onMouseMove(nextState, e);\n }\n });\n /**\n * The handler of mouse entering a scatter\n * @param {Object} el The active scatter\n * @return {Object} no return\n */\n _defineProperty(_this, \"handleItemMouseEnter\", function (el) {\n _this.setState(function () {\n return {\n isTooltipActive: true,\n activeItem: el,\n activePayload: el.tooltipPayload,\n activeCoordinate: el.tooltipPosition || {\n x: el.cx,\n y: el.cy\n }\n };\n });\n });\n /**\n * The handler of mouse leaving a scatter\n * @return {Object} no return\n */\n _defineProperty(_this, \"handleItemMouseLeave\", function () {\n _this.setState(function () {\n return {\n isTooltipActive: false\n };\n });\n });\n /**\n * The handler of mouse moving in chart\n * @param {React.MouseEvent} e Event object\n * @return {void} no return\n */\n _defineProperty(_this, \"handleMouseMove\", function (e) {\n e.persist();\n _this.throttleTriggeredAfterMouseMove(e);\n });\n /**\n * The handler if mouse leaving chart\n * @param {Object} e Event object\n * @return {Null} no return\n */\n _defineProperty(_this, \"handleMouseLeave\", function (e) {\n _this.throttleTriggeredAfterMouseMove.cancel();\n var nextState = {\n isTooltipActive: false\n };\n _this.setState(nextState);\n _this.triggerSyncEvent(nextState);\n var onMouseLeave = _this.props.onMouseLeave;\n if (isFunction(onMouseLeave)) {\n onMouseLeave(nextState, e);\n }\n });\n _defineProperty(_this, \"handleOuterEvent\", function (e) {\n var eventName = getReactEventByType(e);\n var event = get(_this.props, \"\".concat(eventName));\n if (eventName && isFunction(event)) {\n var _mouse;\n var mouse;\n if (/.*touch.*/i.test(eventName)) {\n mouse = _this.getMouseInfo(e.changedTouches[0]);\n } else {\n mouse = _this.getMouseInfo(e);\n }\n event((_mouse = mouse) !== null && _mouse !== void 0 ? _mouse : {}, e);\n }\n });\n _defineProperty(_this, \"handleClick\", function (e) {\n var mouse = _this.getMouseInfo(e);\n if (mouse) {\n var _nextState2 = _objectSpread(_objectSpread({}, mouse), {}, {\n isTooltipActive: true\n });\n _this.setState(_nextState2);\n _this.triggerSyncEvent(_nextState2);\n var onClick = _this.props.onClick;\n if (isFunction(onClick)) {\n onClick(_nextState2, e);\n }\n }\n });\n _defineProperty(_this, \"handleMouseDown\", function (e) {\n var onMouseDown = _this.props.onMouseDown;\n if (isFunction(onMouseDown)) {\n var _nextState3 = _this.getMouseInfo(e);\n onMouseDown(_nextState3, e);\n }\n });\n _defineProperty(_this, \"handleMouseUp\", function (e) {\n var onMouseUp = _this.props.onMouseUp;\n if (isFunction(onMouseUp)) {\n var _nextState4 = _this.getMouseInfo(e);\n onMouseUp(_nextState4, e);\n }\n });\n _defineProperty(_this, \"handleTouchMove\", function (e) {\n if (e.changedTouches != null && e.changedTouches.length > 0) {\n _this.throttleTriggeredAfterMouseMove(e.changedTouches[0]);\n }\n });\n _defineProperty(_this, \"handleTouchStart\", function (e) {\n if (e.changedTouches != null && e.changedTouches.length > 0) {\n _this.handleMouseDown(e.changedTouches[0]);\n }\n });\n _defineProperty(_this, \"handleTouchEnd\", function (e) {\n if (e.changedTouches != null && e.changedTouches.length > 0) {\n _this.handleMouseUp(e.changedTouches[0]);\n }\n });\n _defineProperty(_this, \"handleDoubleClick\", function (e) {\n var onDoubleClick = _this.props.onDoubleClick;\n if (isFunction(onDoubleClick)) {\n var _nextState5 = _this.getMouseInfo(e);\n onDoubleClick(_nextState5, e);\n }\n });\n _defineProperty(_this, \"handleContextMenu\", function (e) {\n var onContextMenu = _this.props.onContextMenu;\n if (isFunction(onContextMenu)) {\n var _nextState6 = _this.getMouseInfo(e);\n onContextMenu(_nextState6, e);\n }\n });\n _defineProperty(_this, \"triggerSyncEvent\", function (data) {\n if (_this.props.syncId !== undefined) {\n eventCenter.emit(SYNC_EVENT, _this.props.syncId, data, _this.eventEmitterSymbol);\n }\n });\n _defineProperty(_this, \"applySyncEvent\", function (data) {\n var _this$props = _this.props,\n layout = _this$props.layout,\n syncMethod = _this$props.syncMethod;\n var updateId = _this.state.updateId;\n var dataStartIndex = data.dataStartIndex,\n dataEndIndex = data.dataEndIndex;\n if (data.dataStartIndex !== undefined || data.dataEndIndex !== undefined) {\n _this.setState(_objectSpread({\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex\n }, updateStateOfAxisMapsOffsetAndStackGroups({\n props: _this.props,\n dataStartIndex: dataStartIndex,\n dataEndIndex: dataEndIndex,\n updateId: updateId\n }, _this.state)));\n } else if (data.activeTooltipIndex !== undefined) {\n var chartX = data.chartX,\n chartY = data.chartY;\n var activeTooltipIndex = data.activeTooltipIndex;\n var _this$state2 = _this.state,\n offset = _this$state2.offset,\n tooltipTicks = _this$state2.tooltipTicks;\n if (!offset) {\n return;\n }\n if (typeof syncMethod === 'function') {\n // Call a callback function. If there is an application specific algorithm\n activeTooltipIndex = syncMethod(tooltipTicks, data);\n } else if (syncMethod === 'value') {\n // Set activeTooltipIndex to the index with the same value as data.activeLabel\n // For loop instead of findIndex because the latter is very slow in some browsers\n activeTooltipIndex = -1; // in case we cannot find the element\n for (var i = 0; i < tooltipTicks.length; i++) {\n if (tooltipTicks[i].value === data.activeLabel) {\n activeTooltipIndex = i;\n break;\n }\n }\n }\n var viewBox = _objectSpread(_objectSpread({}, offset), {}, {\n x: offset.left,\n y: offset.top\n });\n // When a categorical chart is combined with another chart, the value of chartX\n // and chartY may beyond the boundaries.\n var validateChartX = Math.min(chartX, viewBox.x + viewBox.width);\n var validateChartY = Math.min(chartY, viewBox.y + viewBox.height);\n var activeLabel = tooltipTicks[activeTooltipIndex] && tooltipTicks[activeTooltipIndex].value;\n var activePayload = getTooltipContent(_this.state, _this.props.data, activeTooltipIndex);\n var activeCoordinate = tooltipTicks[activeTooltipIndex] ? {\n x: layout === 'horizontal' ? tooltipTicks[activeTooltipIndex].coordinate : validateChartX,\n y: layout === 'horizontal' ? validateChartY : tooltipTicks[activeTooltipIndex].coordinate\n } : originCoordinate;\n _this.setState(_objectSpread(_objectSpread({}, data), {}, {\n activeLabel: activeLabel,\n activeCoordinate: activeCoordinate,\n activePayload: activePayload,\n activeTooltipIndex: activeTooltipIndex\n }));\n } else {\n _this.setState(data);\n }\n });\n _defineProperty(_this, \"renderCursor\", function (element) {\n var _element$props$active;\n var _this$state3 = _this.state,\n isTooltipActive = _this$state3.isTooltipActive,\n activeCoordinate = _this$state3.activeCoordinate,\n activePayload = _this$state3.activePayload,\n offset = _this$state3.offset,\n activeTooltipIndex = _this$state3.activeTooltipIndex,\n tooltipAxisBandSize = _this$state3.tooltipAxisBandSize;\n var tooltipEventType = _this.getTooltipEventType();\n // The cursor is a part of the Tooltip, and it should be shown (by default) when the Tooltip is active.\n var isActive = (_element$props$active = element.props.active) !== null && _element$props$active !== void 0 ? _element$props$active : isTooltipActive;\n var layout = _this.props.layout;\n var key = element.key || '_recharts-cursor';\n return /*#__PURE__*/React.createElement(Cursor, {\n key: key,\n activeCoordinate: activeCoordinate,\n activePayload: activePayload,\n activeTooltipIndex: activeTooltipIndex,\n chartName: chartName,\n element: element,\n isActive: isActive,\n layout: layout,\n offset: offset,\n tooltipAxisBandSize: tooltipAxisBandSize,\n tooltipEventType: tooltipEventType\n });\n });\n _defineProperty(_this, \"renderPolarAxis\", function (element, displayName, index) {\n var axisType = get(element, 'type.axisType');\n var axisMap = get(_this.state, \"\".concat(axisType, \"Map\"));\n var elementDefaultProps = element.type.defaultProps;\n var elementProps = elementDefaultProps !== undefined ? _objectSpread(_objectSpread({}, elementDefaultProps), element.props) : element.props;\n var axisOption = axisMap && axisMap[elementProps[\"\".concat(axisType, \"Id\")]];\n return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, axisOption), {}, {\n className: clsx(axisType, axisOption.className),\n key: element.key || \"\".concat(displayName, \"-\").concat(index),\n ticks: getTicksOfAxis(axisOption, true)\n }));\n });\n _defineProperty(_this, \"renderPolarGrid\", function (element) {\n var _element$props = element.props,\n radialLines = _element$props.radialLines,\n polarAngles = _element$props.polarAngles,\n polarRadius = _element$props.polarRadius;\n var _this$state4 = _this.state,\n radiusAxisMap = _this$state4.radiusAxisMap,\n angleAxisMap = _this$state4.angleAxisMap;\n var radiusAxis = getAnyElementOfObject(radiusAxisMap);\n var angleAxis = getAnyElementOfObject(angleAxisMap);\n var cx = angleAxis.cx,\n cy = angleAxis.cy,\n innerRadius = angleAxis.innerRadius,\n outerRadius = angleAxis.outerRadius;\n return /*#__PURE__*/cloneElement(element, {\n polarAngles: Array.isArray(polarAngles) ? polarAngles : getTicksOfAxis(angleAxis, true).map(function (entry) {\n return entry.coordinate;\n }),\n polarRadius: Array.isArray(polarRadius) ? polarRadius : getTicksOfAxis(radiusAxis, true).map(function (entry) {\n return entry.coordinate;\n }),\n cx: cx,\n cy: cy,\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n key: element.key || 'polar-grid',\n radialLines: radialLines\n });\n });\n /**\n * Draw legend\n * @return {ReactElement} The instance of Legend\n */\n _defineProperty(_this, \"renderLegend\", function () {\n var formattedGraphicalItems = _this.state.formattedGraphicalItems;\n var _this$props2 = _this.props,\n children = _this$props2.children,\n width = _this$props2.width,\n height = _this$props2.height;\n var margin = _this.props.margin || {};\n var legendWidth = width - (margin.left || 0) - (margin.right || 0);\n var props = getLegendProps({\n children: children,\n formattedGraphicalItems: formattedGraphicalItems,\n legendWidth: legendWidth,\n legendContent: legendContent\n });\n if (!props) {\n return null;\n }\n var item = props.item,\n otherProps = _objectWithoutProperties(props, _excluded);\n return /*#__PURE__*/cloneElement(item, _objectSpread(_objectSpread({}, otherProps), {}, {\n chartWidth: width,\n chartHeight: height,\n margin: margin,\n onBBoxUpdate: _this.handleLegendBBoxUpdate\n }));\n });\n /**\n * Draw Tooltip\n * @return {ReactElement} The instance of Tooltip\n */\n _defineProperty(_this, \"renderTooltip\", function () {\n var _tooltipItem$props$ac;\n var _this$props3 = _this.props,\n children = _this$props3.children,\n accessibilityLayer = _this$props3.accessibilityLayer;\n var tooltipItem = findChildByType(children, Tooltip);\n if (!tooltipItem) {\n return null;\n }\n var _this$state5 = _this.state,\n isTooltipActive = _this$state5.isTooltipActive,\n activeCoordinate = _this$state5.activeCoordinate,\n activePayload = _this$state5.activePayload,\n activeLabel = _this$state5.activeLabel,\n offset = _this$state5.offset;\n\n // The user can set isActive on the Tooltip,\n // and we respect the user to enable customisation.\n // The Tooltip is active if the user has set isActive, or if the tooltip is active due to a mouse event.\n var isActive = (_tooltipItem$props$ac = tooltipItem.props.active) !== null && _tooltipItem$props$ac !== void 0 ? _tooltipItem$props$ac : isTooltipActive;\n return /*#__PURE__*/cloneElement(tooltipItem, {\n viewBox: _objectSpread(_objectSpread({}, offset), {}, {\n x: offset.left,\n y: offset.top\n }),\n active: isActive,\n label: activeLabel,\n payload: isActive ? activePayload : [],\n coordinate: activeCoordinate,\n accessibilityLayer: accessibilityLayer\n });\n });\n _defineProperty(_this, \"renderBrush\", function (element) {\n var _this$props4 = _this.props,\n margin = _this$props4.margin,\n data = _this$props4.data;\n var _this$state6 = _this.state,\n offset = _this$state6.offset,\n dataStartIndex = _this$state6.dataStartIndex,\n dataEndIndex = _this$state6.dataEndIndex,\n updateId = _this$state6.updateId;\n\n // TODO: update brush when children update\n return /*#__PURE__*/cloneElement(element, {\n key: element.key || '_recharts-brush',\n onChange: combineEventHandlers(_this.handleBrushChange, element.props.onChange),\n data: data,\n x: isNumber(element.props.x) ? element.props.x : offset.left,\n y: isNumber(element.props.y) ? element.props.y : offset.top + offset.height + offset.brushBottom - (margin.bottom || 0),\n width: isNumber(element.props.width) ? element.props.width : offset.width,\n startIndex: dataStartIndex,\n endIndex: dataEndIndex,\n updateId: \"brush-\".concat(updateId)\n });\n });\n _defineProperty(_this, \"renderReferenceElement\", function (element, displayName, index) {\n if (!element) {\n return null;\n }\n var _this2 = _this,\n clipPathId = _this2.clipPathId;\n var _this$state7 = _this.state,\n xAxisMap = _this$state7.xAxisMap,\n yAxisMap = _this$state7.yAxisMap,\n offset = _this$state7.offset;\n var elementDefaultProps = element.type.defaultProps || {};\n var _element$props2 = element.props,\n _element$props2$xAxis = _element$props2.xAxisId,\n xAxisId = _element$props2$xAxis === void 0 ? elementDefaultProps.xAxisId : _element$props2$xAxis,\n _element$props2$yAxis = _element$props2.yAxisId,\n yAxisId = _element$props2$yAxis === void 0 ? elementDefaultProps.yAxisId : _element$props2$yAxis;\n return /*#__PURE__*/cloneElement(element, {\n key: element.key || \"\".concat(displayName, \"-\").concat(index),\n xAxis: xAxisMap[xAxisId],\n yAxis: yAxisMap[yAxisId],\n viewBox: {\n x: offset.left,\n y: offset.top,\n width: offset.width,\n height: offset.height\n },\n clipPathId: clipPathId\n });\n });\n _defineProperty(_this, \"renderActivePoints\", function (_ref10) {\n var item = _ref10.item,\n activePoint = _ref10.activePoint,\n basePoint = _ref10.basePoint,\n childIndex = _ref10.childIndex,\n isRange = _ref10.isRange;\n var result = [];\n // item is not a React Element so we don't need to resolve defaultProps.\n var key = item.props.key;\n var itemItemProps = item.item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.item.type.defaultProps), item.item.props) : item.item.props;\n var activeDot = itemItemProps.activeDot,\n dataKey = itemItemProps.dataKey;\n var dotProps = _objectSpread(_objectSpread({\n index: childIndex,\n dataKey: dataKey,\n cx: activePoint.x,\n cy: activePoint.y,\n r: 4,\n fill: getMainColorOfGraphicItem(item.item),\n strokeWidth: 2,\n stroke: '#fff',\n payload: activePoint.payload,\n value: activePoint.value\n }, filterProps(activeDot, false)), adaptEventHandlers(activeDot));\n result.push(CategoricalChartWrapper.renderActiveDot(activeDot, dotProps, \"\".concat(key, \"-activePoint-\").concat(childIndex)));\n if (basePoint) {\n result.push(CategoricalChartWrapper.renderActiveDot(activeDot, _objectSpread(_objectSpread({}, dotProps), {}, {\n cx: basePoint.x,\n cy: basePoint.y\n }), \"\".concat(key, \"-basePoint-\").concat(childIndex)));\n } else if (isRange) {\n result.push(null);\n }\n return result;\n });\n _defineProperty(_this, \"renderGraphicChild\", function (element, displayName, index) {\n var item = _this.filterFormatItem(element, displayName, index);\n if (!item) {\n return null;\n }\n var tooltipEventType = _this.getTooltipEventType();\n var _this$state8 = _this.state,\n isTooltipActive = _this$state8.isTooltipActive,\n tooltipAxis = _this$state8.tooltipAxis,\n activeTooltipIndex = _this$state8.activeTooltipIndex,\n activeLabel = _this$state8.activeLabel;\n var children = _this.props.children;\n var tooltipItem = findChildByType(children, Tooltip);\n // item is not a React Element so we don't need to resolve defaultProps\n var _item$props = item.props,\n points = _item$props.points,\n isRange = _item$props.isRange,\n baseLine = _item$props.baseLine;\n var itemItemProps = item.item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.item.type.defaultProps), item.item.props) : item.item.props;\n var activeDot = itemItemProps.activeDot,\n hide = itemItemProps.hide,\n activeBar = itemItemProps.activeBar,\n activeShape = itemItemProps.activeShape;\n var hasActive = Boolean(!hide && isTooltipActive && tooltipItem && (activeDot || activeBar || activeShape));\n var itemEvents = {};\n if (tooltipEventType !== 'axis' && tooltipItem && tooltipItem.props.trigger === 'click') {\n itemEvents = {\n onClick: combineEventHandlers(_this.handleItemMouseEnter, element.props.onClick)\n };\n } else if (tooltipEventType !== 'axis') {\n itemEvents = {\n onMouseLeave: combineEventHandlers(_this.handleItemMouseLeave, element.props.onMouseLeave),\n onMouseEnter: combineEventHandlers(_this.handleItemMouseEnter, element.props.onMouseEnter)\n };\n }\n var graphicalItem = /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, item.props), itemEvents));\n function findWithPayload(entry) {\n // TODO needs to verify dataKey is Function\n return typeof tooltipAxis.dataKey === 'function' ? tooltipAxis.dataKey(entry.payload) : null;\n }\n if (hasActive) {\n if (activeTooltipIndex >= 0) {\n var activePoint, basePoint;\n if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) {\n // number transform to string\n var specifiedKey = typeof tooltipAxis.dataKey === 'function' ? findWithPayload : 'payload.'.concat(tooltipAxis.dataKey.toString());\n activePoint = findEntryInArray(points, specifiedKey, activeLabel);\n basePoint = isRange && baseLine && findEntryInArray(baseLine, specifiedKey, activeLabel);\n } else {\n activePoint = points === null || points === void 0 ? void 0 : points[activeTooltipIndex];\n basePoint = isRange && baseLine && baseLine[activeTooltipIndex];\n }\n if (activeShape || activeBar) {\n var activeIndex = element.props.activeIndex !== undefined ? element.props.activeIndex : activeTooltipIndex;\n return [/*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread(_objectSpread({}, item.props), itemEvents), {}, {\n activeIndex: activeIndex\n })), null, null];\n }\n if (!isNil(activePoint)) {\n return [graphicalItem].concat(_toConsumableArray(_this.renderActivePoints({\n item: item,\n activePoint: activePoint,\n basePoint: basePoint,\n childIndex: activeTooltipIndex,\n isRange: isRange\n })));\n }\n } else {\n var _this$getItemByXY;\n /**\n * We hit this block if consumer uses a Tooltip without XAxis and/or YAxis.\n * In which case, this.state.activeTooltipIndex never gets set\n * because the mouse events that trigger that value getting set never get trigged without the axis components.\n *\n * An example usage case is a FunnelChart\n */\n var _ref11 = (_this$getItemByXY = _this.getItemByXY(_this.state.activeCoordinate)) !== null && _this$getItemByXY !== void 0 ? _this$getItemByXY : {\n graphicalItem: graphicalItem\n },\n _ref11$graphicalItem = _ref11.graphicalItem,\n _ref11$graphicalItem$ = _ref11$graphicalItem.item,\n xyItem = _ref11$graphicalItem$ === void 0 ? element : _ref11$graphicalItem$,\n childIndex = _ref11$graphicalItem.childIndex;\n var elementProps = _objectSpread(_objectSpread(_objectSpread({}, item.props), itemEvents), {}, {\n activeIndex: childIndex\n });\n return [/*#__PURE__*/cloneElement(xyItem, elementProps), null, null];\n }\n }\n if (isRange) {\n return [graphicalItem, null, null];\n }\n return [graphicalItem, null];\n });\n _defineProperty(_this, \"renderCustomized\", function (element, displayName, index) {\n return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({\n key: \"recharts-customized-\".concat(index)\n }, _this.props), _this.state));\n });\n _defineProperty(_this, \"renderMap\", {\n CartesianGrid: {\n handler: renderAsIs,\n once: true\n },\n ReferenceArea: {\n handler: _this.renderReferenceElement\n },\n ReferenceLine: {\n handler: renderAsIs\n },\n ReferenceDot: {\n handler: _this.renderReferenceElement\n },\n XAxis: {\n handler: renderAsIs\n },\n YAxis: {\n handler: renderAsIs\n },\n Brush: {\n handler: _this.renderBrush,\n once: true\n },\n Bar: {\n handler: _this.renderGraphicChild\n },\n Line: {\n handler: _this.renderGraphicChild\n },\n Area: {\n handler: _this.renderGraphicChild\n },\n Radar: {\n handler: _this.renderGraphicChild\n },\n RadialBar: {\n handler: _this.renderGraphicChild\n },\n Scatter: {\n handler: _this.renderGraphicChild\n },\n Pie: {\n handler: _this.renderGraphicChild\n },\n Funnel: {\n handler: _this.renderGraphicChild\n },\n Tooltip: {\n handler: _this.renderCursor,\n once: true\n },\n PolarGrid: {\n handler: _this.renderPolarGrid,\n once: true\n },\n PolarAngleAxis: {\n handler: _this.renderPolarAxis\n },\n PolarRadiusAxis: {\n handler: _this.renderPolarAxis\n },\n Customized: {\n handler: _this.renderCustomized\n }\n });\n _this.clipPathId = \"\".concat((_props$id = _props.id) !== null && _props$id !== void 0 ? _props$id : uniqueId('recharts'), \"-clip\");\n\n // trigger 60fps\n _this.throttleTriggeredAfterMouseMove = throttle(_this.triggeredAfterMouseMove, (_props$throttleDelay = _props.throttleDelay) !== null && _props$throttleDelay !== void 0 ? _props$throttleDelay : 1000 / 60);\n _this.state = {};\n return _this;\n }\n _inherits(CategoricalChartWrapper, _Component);\n return _createClass(CategoricalChartWrapper, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this$props$margin$le, _this$props$margin$to;\n this.addListener();\n this.accessibilityManager.setDetails({\n container: this.container,\n offset: {\n left: (_this$props$margin$le = this.props.margin.left) !== null && _this$props$margin$le !== void 0 ? _this$props$margin$le : 0,\n top: (_this$props$margin$to = this.props.margin.top) !== null && _this$props$margin$to !== void 0 ? _this$props$margin$to : 0\n },\n coordinateList: this.state.tooltipTicks,\n mouseHandlerCallback: this.triggeredAfterMouseMove,\n layout: this.props.layout\n });\n this.displayDefaultTooltip();\n }\n }, {\n key: \"displayDefaultTooltip\",\n value: function displayDefaultTooltip() {\n var _this$props5 = this.props,\n children = _this$props5.children,\n data = _this$props5.data,\n height = _this$props5.height,\n layout = _this$props5.layout;\n var tooltipElem = findChildByType(children, Tooltip);\n // If the chart doesn't include a element, there's no tooltip to display\n if (!tooltipElem) {\n return;\n }\n var defaultIndex = tooltipElem.props.defaultIndex;\n\n // Protect against runtime errors\n if (typeof defaultIndex !== 'number' || defaultIndex < 0 || defaultIndex > this.state.tooltipTicks.length - 1) {\n return;\n }\n var activeLabel = this.state.tooltipTicks[defaultIndex] && this.state.tooltipTicks[defaultIndex].value;\n var activePayload = getTooltipContent(this.state, data, defaultIndex, activeLabel);\n var independentAxisCoord = this.state.tooltipTicks[defaultIndex].coordinate;\n var dependentAxisCoord = (this.state.offset.top + height) / 2;\n var isHorizontal = layout === 'horizontal';\n var activeCoordinate = isHorizontal ? {\n x: independentAxisCoord,\n y: dependentAxisCoord\n } : {\n y: independentAxisCoord,\n x: dependentAxisCoord\n };\n\n // Unlike other chart types, scatter plot's tooltip positions rely on both X and Y coordinates. Only the scatter plot\n // element knows its own Y coordinates.\n // If there's a scatter plot, we'll want to grab that element for an interrogation.\n var scatterPlotElement = this.state.formattedGraphicalItems.find(function (_ref12) {\n var item = _ref12.item;\n return item.type.name === 'Scatter';\n });\n if (scatterPlotElement) {\n activeCoordinate = _objectSpread(_objectSpread({}, activeCoordinate), scatterPlotElement.props.points[defaultIndex].tooltipPosition);\n activePayload = scatterPlotElement.props.points[defaultIndex].tooltipPayload;\n }\n var nextState = {\n activeTooltipIndex: defaultIndex,\n isTooltipActive: true,\n activeLabel: activeLabel,\n activePayload: activePayload,\n activeCoordinate: activeCoordinate\n };\n this.setState(nextState);\n this.renderCursor(tooltipElem);\n\n // Make sure that anyone who keyboard-only users who tab to the chart will start their\n // cursors at defaultIndex\n this.accessibilityManager.setIndex(defaultIndex);\n }\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps, prevState) {\n if (!this.props.accessibilityLayer) {\n return null;\n }\n if (this.state.tooltipTicks !== prevState.tooltipTicks) {\n this.accessibilityManager.setDetails({\n coordinateList: this.state.tooltipTicks\n });\n }\n if (this.props.layout !== prevProps.layout) {\n this.accessibilityManager.setDetails({\n layout: this.props.layout\n });\n }\n if (this.props.margin !== prevProps.margin) {\n var _this$props$margin$le2, _this$props$margin$to2;\n this.accessibilityManager.setDetails({\n offset: {\n left: (_this$props$margin$le2 = this.props.margin.left) !== null && _this$props$margin$le2 !== void 0 ? _this$props$margin$le2 : 0,\n top: (_this$props$margin$to2 = this.props.margin.top) !== null && _this$props$margin$to2 !== void 0 ? _this$props$margin$to2 : 0\n }\n });\n }\n\n // Something has to be returned for getSnapshotBeforeUpdate\n return null;\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n // Check to see if the Tooltip updated. If so, re-check default tooltip position\n if (!isChildrenEqual([findChildByType(prevProps.children, Tooltip)], [findChildByType(this.props.children, Tooltip)])) {\n this.displayDefaultTooltip();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removeListener();\n this.throttleTriggeredAfterMouseMove.cancel();\n }\n }, {\n key: \"getTooltipEventType\",\n value: function getTooltipEventType() {\n var tooltipItem = findChildByType(this.props.children, Tooltip);\n if (tooltipItem && typeof tooltipItem.props.shared === 'boolean') {\n var eventType = tooltipItem.props.shared ? 'axis' : 'item';\n return validateTooltipEventTypes.indexOf(eventType) >= 0 ? eventType : defaultTooltipEventType;\n }\n return defaultTooltipEventType;\n }\n\n /**\n * Get the information of mouse in chart, return null when the mouse is not in the chart\n * @param {MousePointer} event The event object\n * @return {Object} Mouse data\n */\n }, {\n key: \"getMouseInfo\",\n value: function getMouseInfo(event) {\n if (!this.container) {\n return null;\n }\n var element = this.container;\n var boundingRect = element.getBoundingClientRect();\n var containerOffset = getOffset(boundingRect);\n var e = {\n chartX: Math.round(event.pageX - containerOffset.left),\n chartY: Math.round(event.pageY - containerOffset.top)\n };\n var scale = boundingRect.width / element.offsetWidth || 1;\n var rangeObj = this.inRange(e.chartX, e.chartY, scale);\n if (!rangeObj) {\n return null;\n }\n var _this$state9 = this.state,\n xAxisMap = _this$state9.xAxisMap,\n yAxisMap = _this$state9.yAxisMap;\n var tooltipEventType = this.getTooltipEventType();\n var toolTipData = getTooltipData(this.state, this.props.data, this.props.layout, rangeObj);\n if (tooltipEventType !== 'axis' && xAxisMap && yAxisMap) {\n var xScale = getAnyElementOfObject(xAxisMap).scale;\n var yScale = getAnyElementOfObject(yAxisMap).scale;\n var xValue = xScale && xScale.invert ? xScale.invert(e.chartX) : null;\n var yValue = yScale && yScale.invert ? yScale.invert(e.chartY) : null;\n return _objectSpread(_objectSpread({}, e), {}, {\n xValue: xValue,\n yValue: yValue\n }, toolTipData);\n }\n if (toolTipData) {\n return _objectSpread(_objectSpread({}, e), toolTipData);\n }\n return null;\n }\n }, {\n key: \"inRange\",\n value: function inRange(x, y) {\n var scale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var layout = this.props.layout;\n var scaledX = x / scale,\n scaledY = y / scale;\n if (layout === 'horizontal' || layout === 'vertical') {\n var offset = this.state.offset;\n var isInRange = scaledX >= offset.left && scaledX <= offset.left + offset.width && scaledY >= offset.top && scaledY <= offset.top + offset.height;\n return isInRange ? {\n x: scaledX,\n y: scaledY\n } : null;\n }\n var _this$state10 = this.state,\n angleAxisMap = _this$state10.angleAxisMap,\n radiusAxisMap = _this$state10.radiusAxisMap;\n if (angleAxisMap && radiusAxisMap) {\n var angleAxis = getAnyElementOfObject(angleAxisMap);\n return inRangeOfSector({\n x: scaledX,\n y: scaledY\n }, angleAxis);\n }\n return null;\n }\n }, {\n key: \"parseEventsOfWrapper\",\n value: function parseEventsOfWrapper() {\n var children = this.props.children;\n var tooltipEventType = this.getTooltipEventType();\n var tooltipItem = findChildByType(children, Tooltip);\n var tooltipEvents = {};\n if (tooltipItem && tooltipEventType === 'axis') {\n if (tooltipItem.props.trigger === 'click') {\n tooltipEvents = {\n onClick: this.handleClick\n };\n } else {\n tooltipEvents = {\n onMouseEnter: this.handleMouseEnter,\n onDoubleClick: this.handleDoubleClick,\n onMouseMove: this.handleMouseMove,\n onMouseLeave: this.handleMouseLeave,\n onTouchMove: this.handleTouchMove,\n onTouchStart: this.handleTouchStart,\n onTouchEnd: this.handleTouchEnd,\n onContextMenu: this.handleContextMenu\n };\n }\n }\n\n // @ts-expect-error adaptEventHandlers expects DOM Event but generateCategoricalChart works with React UIEvents\n var outerEvents = adaptEventHandlers(this.props, this.handleOuterEvent);\n return _objectSpread(_objectSpread({}, outerEvents), tooltipEvents);\n }\n }, {\n key: \"addListener\",\n value: function addListener() {\n eventCenter.on(SYNC_EVENT, this.handleReceiveSyncEvent);\n }\n }, {\n key: \"removeListener\",\n value: function removeListener() {\n eventCenter.removeListener(SYNC_EVENT, this.handleReceiveSyncEvent);\n }\n }, {\n key: \"filterFormatItem\",\n value: function filterFormatItem(item, displayName, childIndex) {\n var formattedGraphicalItems = this.state.formattedGraphicalItems;\n for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) {\n var entry = formattedGraphicalItems[i];\n if (entry.item === item || entry.props.key === item.key || displayName === getDisplayName(entry.item.type) && childIndex === entry.childIndex) {\n return entry;\n }\n }\n return null;\n }\n }, {\n key: \"renderClipPath\",\n value: function renderClipPath() {\n var clipPathId = this.clipPathId;\n var _this$state$offset = this.state.offset,\n left = _this$state$offset.left,\n top = _this$state$offset.top,\n height = _this$state$offset.height,\n width = _this$state$offset.width;\n return /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: clipPathId\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: left,\n y: top,\n height: height,\n width: width\n })));\n }\n }, {\n key: \"getXScales\",\n value: function getXScales() {\n var xAxisMap = this.state.xAxisMap;\n return xAxisMap ? Object.entries(xAxisMap).reduce(function (res, _ref13) {\n var _ref14 = _slicedToArray(_ref13, 2),\n axisId = _ref14[0],\n axisProps = _ref14[1];\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, axisId, axisProps.scale));\n }, {}) : null;\n }\n }, {\n key: \"getYScales\",\n value: function getYScales() {\n var yAxisMap = this.state.yAxisMap;\n return yAxisMap ? Object.entries(yAxisMap).reduce(function (res, _ref15) {\n var _ref16 = _slicedToArray(_ref15, 2),\n axisId = _ref16[0],\n axisProps = _ref16[1];\n return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, axisId, axisProps.scale));\n }, {}) : null;\n }\n }, {\n key: \"getXScaleByAxisId\",\n value: function getXScaleByAxisId(axisId) {\n var _this$state$xAxisMap;\n return (_this$state$xAxisMap = this.state.xAxisMap) === null || _this$state$xAxisMap === void 0 || (_this$state$xAxisMap = _this$state$xAxisMap[axisId]) === null || _this$state$xAxisMap === void 0 ? void 0 : _this$state$xAxisMap.scale;\n }\n }, {\n key: \"getYScaleByAxisId\",\n value: function getYScaleByAxisId(axisId) {\n var _this$state$yAxisMap;\n return (_this$state$yAxisMap = this.state.yAxisMap) === null || _this$state$yAxisMap === void 0 || (_this$state$yAxisMap = _this$state$yAxisMap[axisId]) === null || _this$state$yAxisMap === void 0 ? void 0 : _this$state$yAxisMap.scale;\n }\n }, {\n key: \"getItemByXY\",\n value: function getItemByXY(chartXY) {\n var _this$state11 = this.state,\n formattedGraphicalItems = _this$state11.formattedGraphicalItems,\n activeItem = _this$state11.activeItem;\n if (formattedGraphicalItems && formattedGraphicalItems.length) {\n for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) {\n var graphicalItem = formattedGraphicalItems[i];\n // graphicalItem is not a React Element so we don't need to resolve defaultProps\n var props = graphicalItem.props,\n item = graphicalItem.item;\n var itemProps = item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;\n var itemDisplayName = getDisplayName(item.type);\n if (itemDisplayName === 'Bar') {\n var activeBarItem = (props.data || []).find(function (entry) {\n return isInRectangle(chartXY, entry);\n });\n if (activeBarItem) {\n return {\n graphicalItem: graphicalItem,\n payload: activeBarItem\n };\n }\n } else if (itemDisplayName === 'RadialBar') {\n var _activeBarItem = (props.data || []).find(function (entry) {\n return inRangeOfSector(chartXY, entry);\n });\n if (_activeBarItem) {\n return {\n graphicalItem: graphicalItem,\n payload: _activeBarItem\n };\n }\n } else if (isFunnel(graphicalItem, activeItem) || isPie(graphicalItem, activeItem) || isScatter(graphicalItem, activeItem)) {\n var activeIndex = getActiveShapeIndexForTooltip({\n graphicalItem: graphicalItem,\n activeTooltipItem: activeItem,\n itemData: itemProps.data\n });\n var childIndex = itemProps.activeIndex === undefined ? activeIndex : itemProps.activeIndex;\n return {\n graphicalItem: _objectSpread(_objectSpread({}, graphicalItem), {}, {\n childIndex: childIndex\n }),\n payload: isScatter(graphicalItem, activeItem) ? itemProps.data[activeIndex] : graphicalItem.props.data[activeIndex]\n };\n }\n }\n }\n return null;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n if (!validateWidthHeight(this)) {\n return null;\n }\n var _this$props6 = this.props,\n children = _this$props6.children,\n className = _this$props6.className,\n width = _this$props6.width,\n height = _this$props6.height,\n style = _this$props6.style,\n compact = _this$props6.compact,\n title = _this$props6.title,\n desc = _this$props6.desc,\n others = _objectWithoutProperties(_this$props6, _excluded2);\n var attrs = filterProps(others, false);\n\n // The \"compact\" mode is mainly used as the panorama within Brush\n if (compact) {\n return /*#__PURE__*/React.createElement(ChartLayoutContextProvider, {\n state: this.state,\n width: this.props.width,\n height: this.props.height,\n clipPathId: this.clipPathId\n }, /*#__PURE__*/React.createElement(Surface, _extends({}, attrs, {\n width: width,\n height: height,\n title: title,\n desc: desc\n }), this.renderClipPath(), renderByOrder(children, this.renderMap)));\n }\n if (this.props.accessibilityLayer) {\n var _this$props$tabIndex, _this$props$role;\n // Set tabIndex to 0 by default (can be overwritten)\n attrs.tabIndex = (_this$props$tabIndex = this.props.tabIndex) !== null && _this$props$tabIndex !== void 0 ? _this$props$tabIndex : 0;\n // Set role to img by default (can be overwritten)\n attrs.role = (_this$props$role = this.props.role) !== null && _this$props$role !== void 0 ? _this$props$role : 'application';\n attrs.onKeyDown = function (e) {\n _this3.accessibilityManager.keyboardEvent(e);\n // 'onKeyDown' is not currently a supported prop that can be passed through\n // if it's added, this should be added: this.props.onKeyDown(e);\n };\n attrs.onFocus = function () {\n _this3.accessibilityManager.focus();\n // 'onFocus' is not currently a supported prop that can be passed through\n // if it's added, the focus event should be forwarded to the prop\n };\n }\n var events = this.parseEventsOfWrapper();\n return /*#__PURE__*/React.createElement(ChartLayoutContextProvider, {\n state: this.state,\n width: this.props.width,\n height: this.props.height,\n clipPathId: this.clipPathId\n }, /*#__PURE__*/React.createElement(\"div\", _extends({\n className: clsx('recharts-wrapper', className),\n style: _objectSpread({\n position: 'relative',\n cursor: 'default',\n width: width,\n height: height\n }, style)\n }, events, {\n ref: function ref(node) {\n _this3.container = node;\n }\n }), /*#__PURE__*/React.createElement(Surface, _extends({}, attrs, {\n width: width,\n height: height,\n title: title,\n desc: desc,\n style: FULL_WIDTH_AND_HEIGHT\n }), this.renderClipPath(), renderByOrder(children, this.renderMap)), this.renderLegend(), this.renderTooltip()));\n }\n }]);\n }(Component);\n _defineProperty(CategoricalChartWrapper, \"displayName\", chartName);\n // todo join specific chart propTypes\n _defineProperty(CategoricalChartWrapper, \"defaultProps\", _objectSpread({\n layout: 'horizontal',\n stackOffset: 'none',\n barCategoryGap: '10%',\n barGap: 4,\n margin: {\n top: 5,\n right: 5,\n bottom: 5,\n left: 5\n },\n reverseStackOrder: false,\n syncMethod: 'index'\n }, defaultProps));\n _defineProperty(CategoricalChartWrapper, \"getDerivedStateFromProps\", function (nextProps, prevState) {\n var dataKey = nextProps.dataKey,\n data = nextProps.data,\n children = nextProps.children,\n width = nextProps.width,\n height = nextProps.height,\n layout = nextProps.layout,\n stackOffset = nextProps.stackOffset,\n margin = nextProps.margin;\n var dataStartIndex = prevState.dataStartIndex,\n dataEndIndex = prevState.dataEndIndex;\n if (prevState.updateId === undefined) {\n var defaultState = createDefaultState(nextProps);\n return _objectSpread(_objectSpread(_objectSpread({}, defaultState), {}, {\n updateId: 0\n }, updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread(_objectSpread({\n props: nextProps\n }, defaultState), {}, {\n updateId: 0\n }), prevState)), {}, {\n prevDataKey: dataKey,\n prevData: data,\n prevWidth: width,\n prevHeight: height,\n prevLayout: layout,\n prevStackOffset: stackOffset,\n prevMargin: margin,\n prevChildren: children\n });\n }\n if (dataKey !== prevState.prevDataKey || data !== prevState.prevData || width !== prevState.prevWidth || height !== prevState.prevHeight || layout !== prevState.prevLayout || stackOffset !== prevState.prevStackOffset || !shallowEqual(margin, prevState.prevMargin)) {\n var _defaultState = createDefaultState(nextProps);\n\n // Fixes https://github.com/recharts/recharts/issues/2143\n var keepFromPrevState = {\n // (chartX, chartY) are (0,0) in default state, but we want to keep the last mouse position to avoid\n // any flickering\n chartX: prevState.chartX,\n chartY: prevState.chartY,\n // The tooltip should stay active when it was active in the previous render. If this is not\n // the case, the tooltip disappears and immediately re-appears, causing a flickering effect\n isTooltipActive: prevState.isTooltipActive\n };\n var updatesToState = _objectSpread(_objectSpread({}, getTooltipData(prevState, data, layout)), {}, {\n updateId: prevState.updateId + 1\n });\n var newState = _objectSpread(_objectSpread(_objectSpread({}, _defaultState), keepFromPrevState), updatesToState);\n return _objectSpread(_objectSpread(_objectSpread({}, newState), updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread({\n props: nextProps\n }, newState), prevState)), {}, {\n prevDataKey: dataKey,\n prevData: data,\n prevWidth: width,\n prevHeight: height,\n prevLayout: layout,\n prevStackOffset: stackOffset,\n prevMargin: margin,\n prevChildren: children\n });\n }\n if (!isChildrenEqual(children, prevState.prevChildren)) {\n var _brush$props$startInd, _brush$props, _brush$props$endIndex, _brush$props2;\n // specifically check for Brush - if it exists and the start and end indexes are different, re-render with the new ones\n var brush = findChildByType(children, Brush);\n var startIndex = brush ? (_brush$props$startInd = (_brush$props = brush.props) === null || _brush$props === void 0 ? void 0 : _brush$props.startIndex) !== null && _brush$props$startInd !== void 0 ? _brush$props$startInd : dataStartIndex : dataStartIndex;\n var endIndex = brush ? (_brush$props$endIndex = (_brush$props2 = brush.props) === null || _brush$props2 === void 0 ? void 0 : _brush$props2.endIndex) !== null && _brush$props$endIndex !== void 0 ? _brush$props$endIndex : dataEndIndex : dataEndIndex;\n var hasDifferentStartOrEndIndex = startIndex !== dataStartIndex || endIndex !== dataEndIndex;\n\n // update configuration in children\n var hasGlobalData = !isNil(data);\n var newUpdateId = hasGlobalData && !hasDifferentStartOrEndIndex ? prevState.updateId : prevState.updateId + 1;\n return _objectSpread(_objectSpread({\n updateId: newUpdateId\n }, updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread(_objectSpread({\n props: nextProps\n }, prevState), {}, {\n updateId: newUpdateId,\n dataStartIndex: startIndex,\n dataEndIndex: endIndex\n }), prevState)), {}, {\n prevChildren: children,\n dataStartIndex: startIndex,\n dataEndIndex: endIndex\n });\n }\n return null;\n });\n _defineProperty(CategoricalChartWrapper, \"renderActiveDot\", function (option, props, key) {\n var dot;\n if ( /*#__PURE__*/isValidElement(option)) {\n dot = /*#__PURE__*/cloneElement(option, props);\n } else if (isFunction(option)) {\n dot = option(props);\n } else {\n dot = /*#__PURE__*/React.createElement(Dot, props);\n }\n return /*#__PURE__*/React.createElement(Layer, {\n className: \"recharts-active-dot\",\n key: key\n }, dot);\n });\n var CategoricalChart = /*#__PURE__*/forwardRef(function CategoricalChart(props, ref) {\n return /*#__PURE__*/React.createElement(CategoricalChartWrapper, _extends({}, props, {\n ref: ref\n }));\n });\n CategoricalChart.displayName = CategoricalChartWrapper.displayName;\n return CategoricalChart;\n};","/**\n * @fileOverview Line Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Line } from '../cartesian/Line';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var LineChart = generateCategoricalChart({\n chartName: 'LineChart',\n GraphicalChild: Line,\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});","/**\n * @fileOverview Bar Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Bar } from '../cartesian/Bar';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var BarChart = generateCategoricalChart({\n chartName: 'BarChart',\n GraphicalChild: Bar,\n defaultTooltipEventType: 'axis',\n validateTooltipEventTypes: ['axis', 'item'],\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});","/**\n * @fileOverview Pie Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { PolarAngleAxis } from '../polar/PolarAngleAxis';\nimport { PolarRadiusAxis } from '../polar/PolarRadiusAxis';\nimport { formatAxisMap } from '../util/PolarUtils';\nimport { Pie } from '../polar/Pie';\nexport var PieChart = generateCategoricalChart({\n chartName: 'PieChart',\n GraphicalChild: Pie,\n validateTooltipEventTypes: ['item'],\n defaultTooltipEventType: 'item',\n legendContent: 'children',\n axisComponents: [{\n axisType: 'angleAxis',\n AxisComp: PolarAngleAxis\n }, {\n axisType: 'radiusAxis',\n AxisComp: PolarRadiusAxis\n }],\n formatAxisMap: formatAxisMap,\n defaultProps: {\n layout: 'centric',\n startAngle: 0,\n endAngle: 360,\n cx: '50%',\n cy: '50%',\n innerRadius: 0,\n outerRadius: '80%'\n }\n});","/**\n * @fileOverview Area Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Area } from '../cartesian/Area';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var AreaChart = generateCategoricalChart({\n chartName: 'AreaChart',\n GraphicalChild: Area,\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});"],"names":["isArray","isArray_1","freeGlobal","global","_freeGlobal","require$$0","freeSelf","root","_root","Symbol","_Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","getRawTag","value","isOwn","tag","unmasked","result","_getRawTag","objectToString","_objectToString","require$$1","require$$2","nullTag","undefinedTag","baseGetTag","_baseGetTag","isObjectLike","isObjectLike_1","symbolTag","isSymbol","isSymbol_1","reIsDeepProp","reIsPlainProp","isKey","object","type","_isKey","isObject","isObject_1","asyncTag","funcTag","genTag","proxyTag","isFunction","isFunction_1","coreJsData","_coreJsData","maskSrcKey","uid","isMasked","func","_isMasked","funcProto","funcToString","toSource","_toSource","require$$3","reRegExpChar","reIsHostCtor","reIsNative","baseIsNative","pattern","_baseIsNative","getValue","key","_getValue","getNative","_getNative","nativeCreate","_nativeCreate","hashClear","_hashClear","hashDelete","_hashDelete","HASH_UNDEFINED","hashGet","data","_hashGet","hashHas","_hashHas","hashSet","_hashSet","require$$4","Hash","entries","index","length","entry","_Hash","listCacheClear","_listCacheClear","eq","other","eq_1","assocIndexOf","array","_assocIndexOf","arrayProto","splice","listCacheDelete","lastIndex","_listCacheDelete","listCacheGet","_listCacheGet","listCacheHas","_listCacheHas","listCacheSet","_listCacheSet","ListCache","_ListCache","Map","_Map","mapCacheClear","_mapCacheClear","isKeyable","_isKeyable","getMapData","map","_getMapData","mapCacheDelete","_mapCacheDelete","mapCacheGet","_mapCacheGet","mapCacheHas","_mapCacheHas","mapCacheSet","size","_mapCacheSet","MapCache","_MapCache","FUNC_ERROR_TEXT","memoize","resolver","memoized","args","cache","memoize_1","MAX_MEMOIZE_SIZE","memoizeCapped","_memoizeCapped","rePropName","reEscapeChar","stringToPath","string","match","number","quote","subString","_stringToPath","arrayMap","iteratee","_arrayMap","symbolProto","symbolToString","baseToString","_baseToString","toString","toString_1","castPath","_castPath","toKey","_toKey","baseGet","path","_baseGet","get","defaultValue","get_1","isNil","isNil_1","stringTag","isString","isString_1","b","c","d","e","f","g","h","k","l","m","n","p","q","t","u","a","r","reactIs_production_min","reactIsModule","numberTag","isNumber","isNumber_1","isNaN","_isNaN","mathSign","isPercent","lodashIsNumber","isNan","isNullish","isNumOrStr","idCounter","uniqueId","prefix","id","getPercentValue","percent","totalValue","validate","getAnyElementOfObject","obj","keys","hasDuplicate","ary","len","interpolateNumber","numberA","numberB","findEntryInArray","specifiedKey","specifiedValue","compareValues","shallowEqual","_key","_typeof","o","SVGContainerPropKeys","SVGElementPropKeys","PolyElementKeys","FilteredElementKeyMap","EventKeys","adaptEventHandlers","props","newHandler","inputProps","isValidElement","out","getEventHandlerOfChild","originalHandler","adaptEventsOfChild","item","_excluded","_excluded2","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","sourceSymbolKeys","REACT_BROWSER_EVENT_MAP","getDisplayName","Comp","lastChildren","lastResult","toArray","children","Children","child","isFragment","findAllByType","types","childType","findChildByType","validateWidthHeight","el","_el$props","width","height","SVG_TAGS","isSvgElement","hasClipDot","dot","isValidSpreadableProp","property","includeEvents","svgElementType","_FilteredElementKeyMa","matchingElementTypeKeys","filterProps","_inputProps","isChildrenEqual","nextChildren","prevChildren","count","isSingleChildEqual","nextChild","prevChild","_ref","nextProps","_ref2","prevProps","renderByOrder","renderMap","elements","record","displayName","_ref3","handler","once","results","getReactEventByType","parseChildIndex","_extends","i","Surface","viewBox","className","style","title","desc","others","svgView","layerClass","clsx","React","Layer","ref","warn","condition","format","_len","baseSlice","start","end","_baseSlice","castSlice","_castSlice","rsAstralRange","rsComboMarksRange","reComboHalfMarksRange","rsComboSymbolsRange","rsComboRange","rsVarRange","rsZWJ","reHasUnicode","hasUnicode","_hasUnicode","asciiToArray","_asciiToArray","rsAstral","rsCombo","rsFitz","rsModifier","rsNonAstral","rsRegional","rsSurrPair","reOptMod","rsOptVar","rsOptJoin","rsSeq","rsSymbol","reUnicode","unicodeToArray","_unicodeToArray","stringToArray","_stringToArray","createCaseFirst","methodName","strSymbols","chr","trailing","_createCaseFirst","upperFirst","upperFirst_1","constant$1","x","cos","sin","sqrt","pi","tau","epsilon","tauEpsilon","append","strings","appendRound","digits","Path","y","x1","y1","x2","y2","x0","y0","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","l01","t01","t21","a0","a1","ccw","dx","dy","cw","da","w","withPath","shape","_","Linear","context","curveLinear","shapeLine","defined","constant","curve","output","line","pointX","pointY","defined0","buffer","shapeArea","area","j","x0z","y0z","arealine","Bump","bumpX","bumpY","symbolCircle","symbolCross","tan30","tan30_2","symbolDiamond","symbolSquare","ka","kr","kx","ky","symbolStar","s","sqrt3","symbolTriangle","symbolWye","symbol","circle","noop","point","that","Basis","curveBasis","BasisClosed","curveBasisClosed","BasisOpen","curveBasisOpen","LinearClosed","curveLinearClosed","sign","slope3","h0","h1","s0","s1","slope2","t0","t1","MonotoneX","MonotoneY","ReflectContext","monotoneX","monotoneY","Natural","px","controlPoints","py","i0","i1","curveNatural","Step","curveStep","stepBefore","stepAfter","stackOffsetNone","series","order","stackOrderNone","stackValue","stackSeries","shapeStack","orderNone","offset","offsetNone","stack","sz","oz","stackOffsetExpand","none","stackOffsetSilhouette","stackOffsetWiggle","s2","si","sij0","sij1","s3","sk","skj0","skj1","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","symbolFactories","RADIAN","getSymbolFactory","name","calculateAreaSize","sizeType","angle","registerSymbol","factory","Symbols","_ref$type","_ref$size","_ref$sizeType","rest","getPath","symbolFactory","shapeSymbol","cx","cy","filteredProps","_classCallCheck","instance","Constructor","_defineProperties","descriptor","_createClass","protoProps","staticProps","_callSuper","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","self","call","_assertThisInitialized","_inherits","subClass","superClass","_setPrototypeOf","SIZE","DefaultLegendContent","_PureComponent","inactiveColor","halfSize","sixthSize","thirdSize","color","iconProps","_this","_this$props","payload","iconSize","layout","formatter","itemStyle","svgStyle","finalFormatter","entryValue","_this$props2","align","finalStyle","PureComponent","stackClear","_stackClear","stackDelete","_stackDelete","stackGet","_stackGet","stackHas","_stackHas","LARGE_ARRAY_SIZE","stackSet","pairs","_stackSet","require$$5","Stack","_Stack","setCacheAdd","_setCacheAdd","setCacheHas","_setCacheHas","SetCache","values","_SetCache","arraySome","predicate","_arraySome","cacheHas","_cacheHas","COMPARE_PARTIAL_FLAG","COMPARE_UNORDERED_FLAG","equalArrays","bitmask","customizer","equalFunc","isPartial","arrLength","othLength","arrStacked","othStacked","seen","arrValue","othValue","compared","othIndex","_equalArrays","Uint8Array","_Uint8Array","mapToArray","_mapToArray","setToArray","set","_setToArray","boolTag","dateTag","errorTag","mapTag","regexpTag","setTag","arrayBufferTag","dataViewTag","symbolValueOf","equalByTag","convert","stacked","_equalByTag","arrayPush","_arrayPush","baseGetAllKeys","keysFunc","symbolsFunc","_baseGetAllKeys","arrayFilter","resIndex","_arrayFilter","stubArray","stubArray_1","propertyIsEnumerable","nativeGetSymbols","getSymbols","_getSymbols","baseTimes","_baseTimes","argsTag","baseIsArguments","_baseIsArguments","isArguments","isArguments_1","stubFalse","stubFalse_1","freeExports","exports","freeModule","module","moduleExports","Buffer","nativeIsBuffer","isBuffer","MAX_SAFE_INTEGER","reIsUint","isIndex","_isIndex","isLength","isLength_1","arrayTag","objectTag","weakMapTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","typedArrayTags","baseIsTypedArray","_baseIsTypedArray","baseUnary","_baseUnary","freeProcess","nodeUtil","nodeIsTypedArray","isTypedArray","isTypedArray_1","arrayLikeKeys","inherited","isArr","isArg","isBuff","isType","skipIndexes","_arrayLikeKeys","isPrototype","Ctor","proto","_isPrototype","overArg","transform","arg","_overArg","nativeKeys","_nativeKeys","baseKeys","_baseKeys","isArrayLike","isArrayLike_1","keys_1","getAllKeys","_getAllKeys","equalObjects","objProps","objLength","othProps","objStacked","skipCtor","objValue","objCtor","othCtor","_equalObjects","DataView","_DataView","Promise","_Promise","Set","_Set","WeakMap","_WeakMap","require$$6","promiseTag","dataViewCtorString","mapCtorString","promiseCtorString","setCtorString","weakMapCtorString","getTag","ctorString","_getTag","require$$7","baseIsEqualDeep","objIsArr","othIsArr","objTag","othTag","objIsObj","othIsObj","isSameTag","objIsWrapped","othIsWrapped","objUnwrapped","othUnwrapped","_baseIsEqualDeep","baseIsEqual","_baseIsEqual","baseIsMatch","matchData","noCustomizer","srcValue","_baseIsMatch","isStrictComparable","_isStrictComparable","getMatchData","_getMatchData","matchesStrictComparable","_matchesStrictComparable","baseMatches","_baseMatches","baseHasIn","_baseHasIn","hasPath","hasFunc","_hasPath","hasIn","hasIn_1","baseMatchesProperty","_baseMatchesProperty","identity","identity_1","baseProperty","_baseProperty","basePropertyDeep","_basePropertyDeep","property_1","baseIteratee","_baseIteratee","baseFindIndex","fromIndex","fromRight","_baseFindIndex","baseIsNaN","_baseIsNaN","strictIndexOf","_strictIndexOf","baseIndexOf","_baseIndexOf","arrayIncludes","_arrayIncludes","arrayIncludesWith","comparator","_arrayIncludesWith","noop_1","INFINITY","createSet","_createSet","baseUniq","includes","isCommon","outer","computed","seenIndex","_baseUniq","uniqBy","uniqBy_1","getUniqPayload","option","defaultUniqBy","renderContent","content","otherProps","EPS","Legend","box","onBBoxUpdate","verticalAlign","margin","chartWidth","chartHeight","hPos","vPos","_box","_this2","wrapperStyle","payloadUniqBy","outerStyle","node","_this$defaultProps$it","spreadableSymbol","isFlattenable","_isFlattenable","baseFlatten","depth","isStrict","_baseFlatten","createBaseFor","iterable","_createBaseFor","baseFor","_baseFor","baseForOwn","_baseForOwn","createBaseEach","eachFunc","collection","_createBaseEach","baseEach","_baseEach","baseMap","_baseMap","baseSortBy","comparer","_baseSortBy","compareAscending","valIsDefined","valIsNull","valIsReflexive","valIsSymbol","othIsDefined","othIsNull","othIsReflexive","othIsSymbol","_compareAscending","compareMultiple","orders","objCriteria","othCriteria","ordersLength","_compareMultiple","require$$8","baseOrderBy","iteratees","criteria","_baseOrderBy","apply","thisArg","_apply","nativeMax","overRest","otherArgs","_overRest","constant_1","defineProperty","baseSetToString","_baseSetToString","HOT_COUNT","HOT_SPAN","nativeNow","shortOut","lastCalled","stamp","remaining","_shortOut","setToString","_setToString","baseRest","_baseRest","isIterateeCall","_isIterateeCall","sortBy","sortBy_1","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","minLen","_arrayLikeToArray","arr2","defaultFormatter","DefaultTooltipContent","_props$separator","separator","_props$contentStyle","contentStyle","_props$itemStyle","_props$labelStyle","labelStyle","itemSorter","wrapperClassName","labelClassName","label","labelFormatter","_props$accessibilityL","accessibilityLayer","listStyle","items","finalItemStyle","finalValue","finalName","formatted","_formatted","finalLabelStyle","hasLabel","finalLabel","wrapperCN","labelCN","accessibilityAttributes","CSS_CLASS_PREFIX","TOOLTIP_HIDDEN","getTooltipCSSClassName","coordinate","translateX","translateY","getTooltipTranslateXY","allowEscapeViewBox","offsetTopLeft","position","reverseDirection","tooltipDimension","viewBoxDimension","negative","positive","_tooltipBoundary","_viewBoxBoundary","tooltipBoundary","viewBoxBoundary","getTransformStyle","useTranslate3d","getTooltipTranslate","_ref4","tooltipBox","cssProperties","EPSILON","TooltipBoundingBox","event","_this$props$coordinat","_this$props$coordinat2","_this$props$coordinat3","_this$props$coordinat4","_this$props$coordinat5","_this$props$coordinat6","active","animationDuration","animationEasing","hasPayload","isAnimationActive","_getTooltipTranslate","cssClasses","parseIsSsrByDefault","Global","Tooltip","filterNull","finalPayload","now","now_1","reWhitespace","trimmedEndIndex","_trimmedEndIndex","reTrimStart","baseTrim","_baseTrim","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","isBinary","toNumber_1","nativeMin","debounce","wait","options","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","invokeFunc","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","debounce_1","throttle","throttle_1","ResponsiveContainer","forwardRef","aspect","_ref$initialDimension","initialDimension","_ref$width","_ref$height","_ref$minWidth","minWidth","minHeight","maxHeight","_ref$debounce","onResize","_ref$style","containerRef","useRef","onResizeRef","useImperativeHandle","_useState","useState","_useState2","sizes","setSizes","setContainerSize","useCallback","newWidth","newHeight","prevState","roundedWidth","roundedHeight","useEffect","callback","_onResizeRef$current","_entries$0$contentRec","containerWidth","containerHeight","observer","_containerRef$current","chartContent","useMemo","calculatedWidth","calculatedHeight","isCharts","cloneElement","Cell","_props","stringCache","MAX_CACHE_NUM","SPAN_STYLE","MEASUREMENT_SPAN_ID","removeInvalidKeys","copyObj","getStringSize","text","copyStyle","cacheKey","measurementSpan","measurementSpanStyle","rect","getOffset","MULTIPLY_OR_DIVIDE_REGEX","ADD_OR_SUBTRACT_REGEX","CSS_LENGTH_UNIT_REGEX","NUM_SPLIT_REGEX","CONVERSION_RATES","FIXED_CSS_LENGTH_UNITS","STR_NAN","convertToPx","unit","DecimalCSS","num","str","_NUM_SPLIT_REGEX$exec","numStr","calculateArithmetic","expr","newExpr","_MULTIPLY_OR_DIVIDE_R","leftOperand","operator","rightOperand","lTs","rTs","_ADD_OR_SUBTRACT_REGE","_ref5","_ref6","_leftOperand","_operator","_rightOperand","_lTs","_rTs","_result","PARENTHESES_REGEX","calculateParentheses","_PARENTHESES_REGEX$ex","_PARENTHESES_REGEX$ex2","parentheticalExpression","evaluateExpression","expression","safeEvaluateExpression","reduceCSSCalc","BREAKING_SPACES","calculateWordWidths","breakAll","words","wordsWithComputedWidth","word","spaceWidth","calculateWordsByLines","initialWordsWithComputedWith","lineWidth","scaleToFit","maxLines","shouldLimitLines","calculate","currentLine","newLine","originalResult","findLongestLine","suffix","checkOverflow","tempText","doesOverflow","iterations","trimmedResult","middle","prev","_checkOverflow","_checkOverflow2","doesPrevOverflow","_checkOverflow3","_checkOverflow4","doesMiddleOverflow","getWordsWithoutCalculate","getWordsByLines","wordWidths","wcw","sw","DEFAULT_FILL","Text","_ref5$x","propsX","_ref5$y","propsY","_ref5$lineHeight","lineHeight","_ref5$capHeight","capHeight","_ref5$scaleToFit","_ref5$textAnchor","textAnchor","_ref5$verticalAnchor","verticalAnchor","_ref5$fill","fill","wordsByLines","textProps","startDy","transforms","ascending","descending","bisector","compare1","compare2","delta","zero","left","lo","hi","mid","right","center","numbers","valueof","ascendingBisect","bisectRight","InternMap","keyof","intern_get","intern_set","intern_delete","_intern","compareDefined","compare","ascendingDefined","e10","e5","e2","tickSpec","stop","step","power","error","factor","i2","inc","ticks","reverse","tickIncrement","tickStep","max","min","quickselect","z","sd","newLeft","newRight","swap","quantile","value0","value1","quantileSorted","range","initRange","domain","initInterpolator","interpolator","implicit","ordinal","unknown","scale","band","ordinalRange","r0","r1","bandwidth","round","paddingInner","paddingOuter","rescale","sequence","pointish","copy","define","constructor","prototype","extend","parent","definition","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","channels","color_formatHex","color_formatHex8","color_formatHsl","color_formatRgb","hslConvert","rgbn","Rgb","rgba","hsla","rgbConvert","rgb","opacity","clampi","clampa","rgb_formatHex","rgb_formatHex8","rgb_formatRgb","hex","Hsl","hsl","m2","m1","hsl2rgb","clamph","clampt","linear","exponential","gamma","nogamma","rgbGamma","colorRgb","numberArray","isNumberArray","genericArray","nb","na","date$1","interpolateNumber$1","reA","reB","one","bi","am","bm","bs","interpolate","date","interpolateRound","piecewise","v","I","constants","normalize","clamper","bimap","d0","d1","polymap","bisect","transformer","interpolateValue","untransform","clamp","input","continuous","formatDecimal","formatDecimalParts","coefficient","exponent","formatGroup","grouping","thousands","formatNumerals","numerals","re","formatSpecifier","specifier","FormatSpecifier","formatTrim","prefixExponent","formatPrefixAuto","formatRounded","formatTypes","identity$3","prefixes","formatLocale$1","locale","group","currencyPrefix","currencySuffix","decimal","minus","nan","newFormat","comma","precision","trim","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","padding","formatPrefix","defaultLocale","formatLocale","precisionFixed","precisionPrefix","precisionRound","tickFormat","linearish","prestep","maxIter","nice","interval","transformLog","transformExp","transformLogn","transformExpn","pow10","powp","base","logp","reflect","loggish","logs","pows","log","transformSymlog","transformSymexp","symlogish","symlog","transformPow","transformSqrt","transformSquare","powish","pow","square","unsquare","radial","squared","thresholds","threshold","quantize","timeInterval","floori","offseti","field","previous","test","millisecond","durationSecond","durationMinute","durationHour","durationDay","durationWeek","durationMonth","durationYear","second","timeMinute","utcMinute","timeHour","utcHour","timeDay","utcDay","unixDay","timeWeekday","timeSunday","timeMonday","timeTuesday","timeWednesday","timeThursday","timeFriday","timeSaturday","utcWeekday","utcSunday","utcMonday","utcTuesday","utcWednesday","utcThursday","utcFriday","utcSaturday","timeMonth","utcMonth","timeYear","utcYear","ticker","year","month","week","day","hour","minute","tickIntervals","tickInterval","utcTicks","utcTickInterval","timeTicks","timeTickInterval","localDate","utcDate","newDate","locale_dateTime","locale_date","locale_time","locale_periods","locale_weekdays","locale_shortWeekdays","locale_months","locale_shortMonths","periodRe","formatRe","periodLookup","formatLookup","weekdayRe","weekdayLookup","shortWeekdayRe","shortWeekdayLookup","monthRe","monthLookup","shortMonthRe","shortMonthLookup","formats","formatShortWeekday","formatWeekday","formatShortMonth","formatMonth","formatDayOfMonth","formatMicroseconds","formatYearISO","formatFullYearISO","formatHour24","formatHour12","formatDayOfYear","formatMilliseconds","formatMonthNumber","formatMinutes","formatPeriod","formatQuarter","formatUnixTimestamp","formatUnixTimestampSeconds","formatSeconds","formatWeekdayNumberMonday","formatWeekNumberSunday","formatWeekNumberISO","formatWeekdayNumberSunday","formatWeekNumberMonday","formatYear","formatFullYear","formatZone","formatLiteralPercent","utcFormats","formatUTCShortWeekday","formatUTCWeekday","formatUTCShortMonth","formatUTCMonth","formatUTCDayOfMonth","formatUTCMicroseconds","formatUTCYearISO","formatUTCFullYearISO","formatUTCHour24","formatUTCHour12","formatUTCDayOfYear","formatUTCMilliseconds","formatUTCMonthNumber","formatUTCMinutes","formatUTCPeriod","formatUTCQuarter","formatUTCSeconds","formatUTCWeekdayNumberMonday","formatUTCWeekNumberSunday","formatUTCWeekNumberISO","formatUTCWeekdayNumberSunday","formatUTCWeekNumberMonday","formatUTCYear","formatUTCFullYear","formatUTCZone","parses","parseShortWeekday","parseWeekday","parseShortMonth","parseMonth","parseLocaleDateTime","parseDayOfMonth","parseMicroseconds","parseYear","parseFullYear","parseHour24","parseDayOfYear","parseMilliseconds","parseMonthNumber","parseMinutes","parsePeriod","parseQuarter","parseUnixTimestamp","parseUnixTimestampSeconds","parseSeconds","parseWeekdayNumberMonday","parseWeekNumberSunday","parseWeekNumberISO","parseWeekdayNumberSunday","parseWeekNumberMonday","parseLocaleDate","parseLocaleTime","parseZone","parseLiteralPercent","pad","pads","newParse","Z","parseSpecifier","parse","numberRe","percentRe","requoteRe","requote","names","dISO","dow","UTCdISO","timeFormat","utcFormat","calendar","invert","formatMillisecond","formatSecond","formatMinute","formatHour","formatDay","formatWeek","timeWeek","timeSecond","utcTime","utcWeek","utcSecond","k10","sequential","sequentialLog","sequentialSymlog","sequentialPow","sequentialSqrt","sequentialQuantile","t2","k21","r2","diverging","divergingLog","divergingSymlog","divergingPow","divergingSqrt","baseExtremum","current","_baseExtremum","baseGt","_baseGt","max_1","baseLt","_baseLt","min_1","map_1","flatMap","flatMap_1","isEqual","isEqual_1","MAX_DIGITS","defaults","Decimal","external","decimalError","invalidArgument","exponentOutOfRange","mathfloor","mathpow","isDecimal","ONE","BASE","LOG_BASE","MAX_E","P","xdL","ydL","dp","divide","getBase10Exponent","pr","wpr","ln","subtract","add","exp","digitsToString","carry","rL","xd","yd","rm","checkInt32","yIsInt","guard","yn","truncate","ws","indexOfLastWord","getZeroString","multiplyInteger","temp","aL","bL","cmp","prod","prodL","qd","rem","remL","rem0","xi","xL","yd0","yL","yz","denominator","sum","getLn10","zs","c0","numerator","parseDecimal","rd","doRound","xdi","xe","xLTy","isExp","clone","ps","config","Decimal$1","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","iter","PLACE_HOLDER","isPlaceHolder","val","curry0","fn","_curried","curryN","argsLength","_len2","restArgs","_key2","newArgs","curry","begin","compose","_len3","_key3","fns","firstFn","tailsFn","res","_len4","_key4","getDigitCount","rangeStep","newA","newB","uninterpolateNumber","diff","uninterpolateTruncation","Arithmetic","_arr","_n","_d","_e","_i","_s","err","getValidInterval","validMin","validMax","getFormatStep","roughStep","allowDecimals","correctionFactor","digitCount","digitCountValue","stepRatio","stepRatioScale","amendStepRatio","formatStep","getTickOfSingleValue","tickCount","absVal","middleIndex","calculateStep","belowCount","upCount","scaleCount","getNiceTickValuesFn","_getValidInterval","_getValidInterval2","cormin","cormax","_values","_calculateStep","tickMin","tickMax","getTickValuesFixedDomainFn","_ref7","_ref8","_getValidInterval5","_getValidInterval6","getNiceTickValues","getTickValuesFixedDomain","invariant","message","ErrorBar","_React$Component","dataKey","dataPointFormatter","xAxis","yAxis","svgProps","errorBars","_dataPointFormatter","errorVal","lineCoordinates","lowBound","highBound","_errorVal","yMid","yMin","yMax","xMin","xMax","_scale","xMid","_xMin","_xMax","_yMin","_yMax","coordinates","getLegendProps","formattedGraphicalItems","legendWidth","legendContent","legendItem","legendDefaultProps","legendProps","legendData","itemDefaultProps","itemProps","legendType","hide","getMainColorOfGraphicItem","getValueByDataKey","getDomainOfDataByKey","filterNil","flattenData","validateData","calculateActiveTickIndex","_ticks$length","unsortedTicks","axis","before","cur","after","sameDirectionCoord","diffInterval","curInRange","afterInRange","sameInterval","minValue","maxValue","_item$type","defaultedProps","stroke","getBarSizeList","globalSize","totalSize","_ref2$stackGroups","stackGroups","numericAxisIds","sgs","stackIds","sLen","_sgs$stackIds$j","cateAxisId","barItems","barItemDefaultProps","barItemProps","selfSize","cateId","barSize","getBarPosition","barGap","barCategoryGap","bandSize","_ref3$sizeList","sizeList","maxBarSize","realBarGap","initialValue","useFull","fullBarSize","newPosition","newRes","_offset","originalSize","appendOffsetOfLegend","_unused","legendBox","boxWidth","boxHeight","isErrorBarRelevantForAxis","axisType","direction","getDomainOfErrorBars","errorBarChild","mainValue","errorDomain","prevErrorArr","errorValue","lowerValue","upperValue","parseErrorBarsOfAxis","domains","getDomainOfItemsWithSameAxis","isCategoricalAxis","getCoordinatesOfGrid","syncWithTicks","hasMin","hasMax","getTicksOfAxis","isGrid","isAll","duplicateDomain","offsetForBand","scaleContent","row","handlerWeakMap","combineEventHandlers","defaultHandler","childHandler","childWeakMap","combineHandler","parseScale","chartType","hasBar","d3Scales.scaleBand","d3Scales.scaleLinear","d3Scales.scalePoint","d3Scales","checkDomainOfScale","first","last","findPositionOfBar","barPosition","truncateByDomain","offsetSign","offsetPositive","STACK_OFFSET_MAP","getStackedData","stackItems","offsetType","dataKeys","offsetAccessor","getStackGroupsByAxisId","_items","numericAxisId","reverseStackOrder","parentStackGroupsInitialValue","_item$type2","stackId","axisId","parentGroup","childGroup","axisStackGroupsInitialValue","stackGroupsInitialValue","getTicksOfScale","opts","realScaleType","originalDomain","scaleType","tickValues","_domain","_tickValues","getCateCoordinateOfLine","matchedTick","getCateCoordinateOfBar","getBaseValueOfBar","numericAxis","getStackedDataOfItem","_item$type3","itemIndex","getDomainOfSingle","getDomainOfStackGroups","startIndex","endIndex","stackedData","MIN_VALUE_REG","MAX_VALUE_REG","parseSpecifiedDomain","specifiedDomain","dataDomain","allowDataOverflow","_value","getBandSizeOfAxis","isBar","bandWidth","orderedTicks","parseDomainOfCategoryAxis","calculatedDomain","axisChild","getTooltipItem","graphicalItem","tooltipType","radianToDegree","angleInRadian","polarToCartesian","radius","getMaxRadius","formatAxisMap","axisMap","chartName","startAngle","endAngle","maxRadius","innerRadius","outerRadius","ids","reversed","_range","_range2","_parseScale","finalAxis","distanceBetweenPoints","anotherPoint","getAngleOfPoint","formatAngleOfSector","startCnt","endCnt","reverseFormatAngleOfSetor","inRangeOfSector","sector","_getAngleOfPoint","_formatAngleOfSector","formatAngle","inRange","getTickClassName","tick","getLabel","getDeltaAngle","deltaAngle","renderRadialLabel","labelProps","attrs","clockWise","labelAngle","startPoint","endPoint","getAttrsOfPolarLabel","midAngle","_polarToCartesian","_x","_y","_polarToCartesian2","getAttrsOfCartesianLabel","parentViewBox","verticalSign","verticalOffset","verticalEnd","verticalStart","horizontalSign","horizontalOffset","horizontalEnd","horizontalStart","_attrs","_attrs2","_attrs3","sizeAttrs","isPolar","Label","_ref4$offset","restProps","_props$className","textBreakAll","createElement","isPolarLabel","positionAttrs","parseViewBox","top","labelViewBox","parseLabel","renderCallByParent","parentProps","checkPropsLabel","explicitChildren","implicitLabel","last_1","defaultAccessor","LabelList","_ref$valueAccessor","valueAccessor","idProps","parseLabelList","implicitLabelList","getTangentCircle","isExternal","cornerRadius","cornerIsExternal","centerRadius","theta","centerAngle","circleTangency","lineTangencyAngle","lineTangency","getSectorPath","tempEndAngle","outerStartPoint","outerEndPoint","innerStartPoint","innerEndPoint","getSectorWithCorner","forceCornerRadius","_getTangentCircle","soct","solt","sot","_getTangentCircle2","eoct","eolt","eot","outerArcAngle","_getTangentCircle3","sict","silt","sit","_getTangentCircle4","eict","eilt","eit","innerArcAngle","defaultProps","Sector","sectorProps","deltaRadius","cr","CURVE_FACTORIES","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveStepAfter","curveStepBefore","getX","getY","getCurveFactory","_ref$points","points","baseLine","_ref$connectNulls","connectNulls","curveFactory","formatPoints","lineFunction","formatBaseLine","areaPoints","Curve","pathRef","realPath","React.createElement","ReactPropTypesSecret","ReactPropTypesSecret_1","emptyFunction","emptyFunctionWithReset","factoryWithThrowingShims","shim","propName","componentName","location","propFullName","secret","getShim","ReactPropTypes","propTypesModule","getOwnPropertyNames","getOwnPropertySymbols","combineComparators","comparatorA","comparatorB","state","createIsCircular","areItemsEqual","cachedA","cachedB","getShortTag","getStrictProperties","hasOwn","sameValueZeroEqual","PREACT_VNODE","PREACT_OWNER","REACT_OWNER","getOwnPropertyDescriptor","areArrayBuffersEqual","areTypedArraysEqual","areArraysEqual","areDataViewsEqual","areDatesEqual","areErrorsEqual","areFunctionsEqual","areMapsEqual","matchedIndices","aIterable","aResult","bResult","bIterable","hasMatch","matchIndex","aEntry","bEntry","areNumbersEqual","areObjectsEqual","properties","isPropertyEqual","areObjectsEqualStrict","descriptorA","descriptorB","arePrimitiveWrappersEqual","areRegExpsEqual","areSetsEqual","areUrlsEqual","ARRAY_BUFFER_TAG","ARGUMENTS_TAG","BOOLEAN_TAG","DATA_VIEW_TAG","DATE_TAG","ERROR_TAG","MAP_TAG","NUMBER_TAG","OBJECT_TAG","REG_EXP_TAG","SET_TAG","STRING_TAG","TYPED_ARRAY_TAGS","URL_TAG","createEqualityComparator","unknownTagComparators","unknownTagComparator","shortTag","createEqualityComparatorConfig","circular","createCustomConfig","strict","createInternalEqualityComparator","_indexOrKeyA","_indexOrKeyB","_parentA","_parentB","createIsEqual","createState","equals","meta","deepEqual","createCustomEqual","createCustomInternalComparator","safeRequestAnimationFrame","setRafTimeout","timeout","currTime","shouldUpdate","_toArray","createAnimateManager","currStyle","handleChange","shouldStop","setStyle","_style","styles","_styles","curr","restStyles","_handleChange","hint","prim","getIntersectionKeys","preObj","nextObj","param","getDashCase","mapObject","getTransitionVal","duration","easing","prop","ACCURACY","cubicBezierFactor","c1","c2","multyTime","params","pre","cubicBezier","derivativeCubicBezier","newParams","configBezier","_easing$1$split$0$spl","_easing$1$split$0$spl2","curveX","curveY","derCurveX","rangeValue","bezier","_t","evalT","derVal","configSpring","_config$stiff","stiff","_config$damping","damping","_config$dt","dt","stepper","currX","destX","currV","FSpring","FDamping","newV","newX","configEasing","alpha","needContinue","from","to","calStepperVals","preVals","steps","nextStepVals","_easing","_easing2","configUpdate","render","interKeys","timingStyle","stepperStyle","cafId","preTime","beginTime","update","getCurrStyle","shouldStopAnimation","stepperUpdate","deltaTime","timingUpdate","sourceKeys","_createSuper","Derived","hasNativeReflectConstruct","Super","NewTarget","Animate","_super","isActive","attributeName","canBegin","_this$props3","shouldReAnimate","currentFrom","newState","isTriggered","_newState","onAnimationEnd","onAnimationStart","startAnimation","finalStartAnimation","_this3","_steps$","initialStyle","_steps$$duration","initialTime","addStyle","nextItem","_nextItem$easing","nextProperties","preItem","transition","newStyle","propsTo","manager","_this$props4","stateStyle","cloneContainer","container","_container$props","_container$props$styl","PropTypes","getRectanglePath","ySign","xSign","newRadius","_newRadius","isInRectangle","minX","maxX","minY","maxY","Rectangle","rectangleProps","totalLength","setTotalLength","pathTotalLength","animationBegin","isUpdateAnimationActive","currWidth","currHeight","currY","isValidatePoint","getParsedPoints","segmentPoints","getSinglePolygonPath","segPoints","polygonPath","getRanglePath","baseLinePoints","outerPath","Polygon","hasStroke","rangePath","singlePath","Dot","Cross","_ref$x","_ref$y","_ref$top","_ref$left","maxBy","maxBy_1","minBy","minBy_1","PolarRadiusAxis","orientation","maxRadiusTick","minRadiusTick","axisLine","extent","point0","point1","tickFormatter","axisProps","customTickProps","coord","tickProps","_this$props5","tickItem","eps","PolarAngleAxis","tickSize","tickLineSize","p1","p2","axisLineType","tickLine","tickLineProps","lineCoord","getPrototype","_getPrototype","objectCtorString","isPlainObject","isPlainObject_1","isBoolean","isBoolean_1","getTrapezoidPath","upperWidth","lowerWidth","widthGap","Trapezoid","trapezoidProps","currUpperWidth","currLowerWidth","defaultPropTransformer","isSymbolsProps","shapeType","_elementProps","ShapeSelector","elementProps","getPropsFromShapeOption","Shape","_ref2$propTransformer","propTransformer","_ref2$activeClassName","activeClassName","isFunnel","_item","isPie","isScatter","compareFunnel","shapeData","activeTooltipItem","_activeTooltipItem$la","_activeTooltipItem$la2","xMatches","yMatches","comparePie","startAngleMatches","endAngleMatches","compareScatter","zMatches","getComparisonFn","activeItem","comparison","getShapeDataKey","shapeKey","getActiveShapeTooltipPayload","_activeItem$tooltipPa","_activeItem$tooltipPa2","getActiveShapeIndexForTooltip","itemData","tooltipPayload","activeItemMatches","datum","dataIndex","valuesMatch","mouseCoordinateMatches","indexOfMouseCoordinates","coordinatesMatch","activeIndex","_Pie","Pie","sectors","labelLine","valueKey","pieProps","customLabelProps","customLabelLineProps","offsetRadius","labels","lineProps","realDataKey","activeShape","blendStroke","inactiveShapeProp","inactiveShape","sectorOptions","animationId","_this$state","prevSectors","prevIsAnimationActive","stepData","curAngle","paddingAngle","angleIp","latest","interpolatorAngle","_latest","pieRef","_this4","next","_next","_this5","isAnimationFinished","presentationProps","cells","cell","maxPieRadius","pieData","nameKey","minAngle","absDeltaAngle","notZeroItemCount","totalPadingAngle","realTotalAngle","tempStartAngle","middleRadius","tooltipPosition","nativeCeil","baseRange","_baseRange","MAX_INTEGER","toFinite","toFinite_1","createRange","_createRange","range_1","PREFIX_LIST","generatePrefixStyle","camelName","createScale","travellerWidth","scalePoint","scaleValues","isTouch","Brush","onDragEnd","startX","endX","gap","minIndex","maxIndex","slideMoveStartX","onChange","newIndex","_this$state2","brushMoveStartX","movingTravellerId","prevValue","isFullGap","_this$state3","currentScaleValue","currentIndex","newScaleValue","_this$props6","_this$props7","chartElement","travellerX","_data$startIndex","_data$endIndex","_this$props8","traveller","ariaLabel","travellerProps","ariaLabelBrush","_this$props9","_this$props10","_this$state4","_this$props11","alwaysShowText","_this$state5","isTextActive","isSlideMoving","isTravellerMoving","isTravellerFocused","isPanoramic","lineY","rectangle","updateId","valueRange","baseSome","_baseSome","some","some_1","ifOverflowMatches","alwaysShow","ifOverflow","baseAssignValue","_baseAssignValue","mapValues","mapValues_1","arrayEvery","_arrayEvery","baseEvery","_baseEvery","every","every_1","typeguardBarRectangleProps","xProp","yProp","xValue","yValue","heightValue","widthValue","BarRectangle","minPointSizeCallback","minPointSize","isValueNumberOrNil","_Bar","Bar","activeBar","baseProps","prevData","interpolatorX","interpolatorY","interpolatorWidth","interpolatorHeight","_interpolatorHeight","backgroundProps","background","needClip","clipPathId","errorBarItems","dataPoint","errorBarProps","needClipX","needClipY","xAxisTicks","yAxisTicks","dataStartIndex","displayedData","pos","minPointSizeProp","stackedDomain","baseValue","rects","baseValueScale","currentValueScale","computedHeight","_baseValueScale","_currentValueScale","_delta","_axis$padding","mirror","offsetKey","calculatedPadding","needSpace","smallestDistanceBetweenValues","sortedValues","smallestDistanceInPercent","rangeWidth","halfBand","rectWithPoints","rectWithCoords","ScaleHelper","bandAware","_offset2","createLabeledScales","scales","normalizeAngle","getAngledRectangleWidth","normalizedAngle","angleRadians","angleThreshold","angledWidth","createFind","findIndexFunc","_createFind","toInteger","remainder","toInteger_1","findIndex","findIndex_1","find","find_1","calculateViewBox","XAxisContext","YAxisContext","ViewBoxContext","OffsetContext","createContext","ClipPathIdContext","ChartHeightContext","ChartWidthContext","ChartLayoutContextProvider","_props$state","xAxisMap","yAxisMap","useClipPathId","useContext","useXAxisOrThrow","xAxisId","useArbitraryXAxis","useYAxisWithFiniteDomainOrRandom","yAxisWithFiniteDomain","useYAxisOrThrow","yAxisId","useViewBox","useOffset","useChartWidth","useChartHeight","renderLine","getEndPoints","isFixedX","isFixedY","isSegment","xAxisOrientation","yAxisOrientation","yCoord","xCoord","_coord","_points","segment","_points2","ReferenceLineImpl","fixedX","fixedY","isX","isY","endPoints","_endPoints","_endPoints$","_endPoints$2","clipPath","ReferenceLine","getCoordinate","ReferenceDot","dotProps","getRect","hasX1","hasX2","hasY1","hasY2","xValue1","xValue2","yValue1","yValue2","ReferenceArea","getEveryNthWithCondition","isValid","getAngledTickWidth","contentSize","unitSize","getTickBoundaries","sizeKey","isWidth","isVisible","tickPosition","getSize","getNumberIntervalTicks","getEquidistantTicks","boundaries","getTickSize","minTickGap","initialStart","stepsize","_loop","tickCoord","isShow","_ret","getTicksEnd","getTicksStart","preserveEnd","tail","tailSize","tailGap","isTailShow","_loop2","getTicks","fontSize","letterSpacing","candidates","_excluded3","CartesianAxis","_Component","nextState","viewBoxOld","restPropsOld","htmlLayer","tickMargin","tx","ty","finalTickSize","needHeight","needWidth","finalTicks","_this2$getTickLineCoo","ticksGenerator","noTicksProps","combinedClassName","Component","Background","fillOpacity","ry","renderLineItem","lineItem","_filterProps","restOfFilteredProps","HorizontalGridLines","_props$horizontal","horizontal","horizontalPoints","lineItemProps","VerticalGridLines","_props$vertical","vertical","verticalPoints","HorizontalStripes","horizontalFill","_props$horizontal2","roundedSortedHorizontalPoints","lastStripe","colorIndex","VerticalStripes","_props$vertical2","verticalFill","roundedSortedVerticalPoints","defaultVerticalCoordinatesGenerator","defaultHorizontalCoordinatesGenerator","CartesianGrid","_props$stroke","_props$fill","_props$horizontal3","_props$horizontalFill","_props$vertical3","_props$verticalFill","propsIncludingDefaults","horizontalValues","verticalValues","verticalCoordinatesGenerator","horizontalCoordinatesGenerator","isHorizontalValues","generatorResult","isVerticalValues","_generatorResult","Line","lines","lineLength","remainLength","restLength","remainLines","emptyLines","curveDom","clipDot","customDotProps","dots","dotsProps","curveProps","strokeDasharray","animateNewValues","prevPoints","prevPointsDiffFactor","prevPointIndex","_interpolatorX","_interpolatorY","curLength","currentStrokeDasharray","hasSinglePoint","_ref2$r","_ref2$strokeWidth","strokeWidth","_ref3$clipDot","dotSize","linesUnit","dotItem","_Area","Area","areaProps","startY","endY","isRange","prevBaseLine","stepPoints","stepBaseLine","_interpolator","chartBaseValue","itemBaseValue","domainMax","domainMin","hasStack","isHorizontalLayout","isBreakPoint","XAxisImpl","axisOptions","XAxis","React.Component","YAxisImpl","YAxis","detectReferenceElementsDomain","specifiedTicks","areas","idKey","finalDomain","key1","key2","value2","has","Events","EE","addListener","emitter","listener","evt","clearEvent","EventEmitter","events","handlers","ee","listeners","a2","a3","a4","a5","eventCenter","SYNC_EVENT","AccessibilityManager","_ref$coordinateList","coordinateList","_ref$container","_ref$layout","_ref$offset","_ref$mouseHandlerCall","mouseHandlerCallback","_window","_window2","_this$container$getBo","scrollOffsetX","scrollOffsetY","pageX","pageY","isDomainSpecifiedByUser","domainStart","domainEnd","getCursorRectangle","activeCoordinate","tooltipAxisBandSize","getRadialCursorPoints","getCursorPoints","innerPoint","outerPoint","Cursor","_element$props$cursor","_defaultProps","element","tooltipEventType","activePayload","activeTooltipIndex","elementPropsCursor","cursorComp","_getRadialCursorPoint","cursorProps","ORIENT_MAP","FULL_WIDTH_AND_HEIGHT","originCoordinate","renderAsIs","calculateTooltipPos","rangeObj","getActiveCoordinate","tooltipTicks","_angle","_radius","getDisplayedData","graphicalItems","dataEndIndex","itemsData","getDefaultDomainByAxisType","getTooltipContent","chartData","activeLabel","tooltipAxis","_child$props$data","getTooltipData","rangeData","getAxisMapByAxes","axes","axisIdKey","stackOffset","isCategorical","_childProps$domain2","childProps","allowDuplicatedCategory","includeHidden","itemAxisId","categoricalDomain","defaultDomain","_childProps$domain","childDomain","duplicate","errorBarsDomain","_defaultProps2","_defaultProps3","itemHide","axisDomain","isDomainValid","getAxisMapByItems","Axis","_defaultProps4","_defaultProps5","getAxisMap","_ref4$axisType","AxisComp","tooltipTicksGenerator","createDefaultState","defaultShowTooltip","brushItem","hasGraphicalBarItem","getAxisNameByLayout","calculateOffset","prevLegendBBox","_ref5$xAxisMap","_ref5$yAxisMap","offsetH","offsetV","brushBottom","offsetWidth","offsetHeight","getCartesianAxisSize","axisObj","axisName","generateCategoricalChart","GraphicalChild","_ref6$defaultTooltipE","defaultTooltipEventType","_ref6$validateTooltip","validateTooltipEventTypes","axisComponents","getFormatItems","currentState","globalMaxBarSize","_getAxisNameByLayout","numericAxisName","cateAxisName","formattedItems","childMaxBarSize","axisObjInitialValue","cateAxis","cateTicks","itemIsBar","_getBandSizeOfAxis","barBandSize","composedFn","updateStateOfAxisMapsOffsetAndStackGroups","_getAxisNameByLayout2","cateAxisMap","ticksObj","CategoricalChartWrapper","_props$id","_props$throttleDelay","cId","_ref9","mouse","_nextState","onMouseEnter","onMouseMove","onMouseLeave","eventName","_mouse","_nextState2","onClick","onMouseDown","_nextState3","onMouseUp","_nextState4","onDoubleClick","_nextState5","onContextMenu","_nextState6","syncMethod","chartX","chartY","validateChartX","validateChartY","_element$props$active","isTooltipActive","elementDefaultProps","axisOption","_element$props","radialLines","polarAngles","polarRadius","radiusAxisMap","angleAxisMap","radiusAxis","angleAxis","_tooltipItem$props$ac","tooltipItem","_this$state6","_this$state7","_element$props2","_element$props2$xAxis","_element$props2$yAxis","_ref10","activePoint","basePoint","childIndex","itemItemProps","activeDot","_this$state8","_item$props","hasActive","itemEvents","findWithPayload","_this$getItemByXY","_ref11","_ref11$graphicalItem","_ref11$graphicalItem$","xyItem","_this$props$margin$le","_this$props$margin$to","tooltipElem","defaultIndex","independentAxisCoord","dependentAxisCoord","isHorizontal","scatterPlotElement","_ref12","_this$props$margin$le2","_this$props$margin$to2","eventType","boundingRect","containerOffset","_this$state9","toolTipData","xScale","yScale","scaledX","scaledY","isInRange","_this$state10","tooltipEvents","outerEvents","_this$state$offset","_ref13","_ref14","_ref15","_ref16","_this$state$xAxisMap","_this$state$yAxisMap","chartXY","_this$state11","itemDisplayName","activeBarItem","_activeBarItem","compact","_this$props$tabIndex","_this$props$role","defaultState","_defaultState","keepFromPrevState","updatesToState","_brush$props$startInd","_brush$props","_brush$props$endIndex","_brush$props2","brush","hasDifferentStartOrEndIndex","hasGlobalData","newUpdateId","CategoricalChart","LineChart","BarChart","PieChart","AreaChart"],"mappings":"+JAuBA,IAAIA,EAAU,MAAM,QAEpB,OAAAC,GAAiBD,kDCxBjB,IAAIE,EA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I,GAAyB,CAC9C,UAAW,YACX,eAAgBxL,GAChB,eAAgB,CAAC,CACf,SAAU,QACV,SAAUiD,EACd,EAAK,CACD,SAAU,QACV,SAAUG,EACd,CAAG,EACD,cAAe35B,EACjB,CAAC,ECXU4qC,GAAW7I,GAAyB,CAC7C,UAAW,WACX,eAAgB1Z,GAChB,wBAAyB,OACzB,0BAA2B,CAAC,OAAQ,MAAM,EAC1C,eAAgB,CAAC,CACf,SAAU,QACV,SAAUmR,EACd,EAAK,CACD,SAAU,QACV,SAAUG,EACd,CAAG,EACD,cAAe35B,EACjB,CAAC,ECbU6qC,GAAW9I,GAAyB,CAC7C,UAAW,WACX,eAAgBpiB,GAChB,0BAA2B,CAAC,MAAM,EAClC,wBAAyB,OACzB,cAAe,WACf,eAAgB,CAAC,CACf,SAAU,YACV,SAAUxE,EACd,EAAK,CACD,SAAU,aACV,SAAUhB,EACd,CAAG,EACD,cAAena,GACf,aAAc,CACZ,OAAQ,UACR,WAAY,EACZ,SAAU,IACV,GAAI,MACJ,GAAI,MACJ,YAAa,EACb,YAAa,KACjB,CACA,CAAC,ECvBU8qC,GAAY/I,GAAyB,CAC9C,UAAW,YACX,eAAgBzJ,GAChB,eAAgB,CAAC,CACf,SAAU,QACV,SAAUkB,EACd,EAAK,CACD,SAAU,QACV,SAAUG,EACd,CAAG,EACD,cAAe35B,EACjB,CAAC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391]} \ No newline at end of file diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-BY0QR2-n.css b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-BY0QR2-n.css new file mode 100644 index 0000000..08ee66e --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-BY0QR2-n.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&family=JetBrains+Mono:wght@400;500&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:Manrope,sans-serif}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[20px\]{left:20px}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-\[20\%\]{top:20%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.-mb-px{margin-bottom:-1px}.-mr-16{margin-right:-4rem}.-mt-16{margin-top:-4rem}.-mt-5{margin-top:-1.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-7{margin-left:1.75rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.size-1\.5{width:.375rem;height:.375rem}.size-10{width:2.5rem;height:2.5rem}.size-2{width:.5rem;height:.5rem}.size-4{width:1rem;height:1rem}.size-8{width:2rem;height:2rem}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-\[150px\]{height:150px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[24px\]{height:24px}.h-\[28px\]{height:28px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-\[70vh\]{max-height:70vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[120px\]{min-height:120px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-96{width:24rem}.w-\[24px\]{width:24px}.w-\[48px\]{width:48px}.w-\[50px\]{width:50px}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[100px\]{min-width:100px}.min-w-\[48px\]{min-width:48px}.min-w-full{min-width:100%}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[1200px\]{max-width:1200px}.max-w-\[1400px\]{max-width:1400px}.max-w-\[1440px\]{max-width:1440px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[shimmer_3s_infinite\]{animation:shimmer 3s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.-space-y-px>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(-1px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(-1px * var(--tw-space-y-reverse))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border-dark>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(35 54 72 / var(--tw-divide-opacity, 1))}.divide-border-dark\/50>:not([hidden])~:not([hidden]){border-color:#23364880}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.divide-slate-100>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(241 245 249 / var(--tw-divide-opacity, 1))}.divide-slate-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(226 232 240 / var(--tw-divide-opacity, 1))}.divide-white\/5>:not([hidden])~:not([hidden]){border-color:#ffffff0d}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.scroll-smooth{scroll-behavior:smooth}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-b-md{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.rounded-l-lg{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.rounded-t-full{border-top-left-radius:9999px;border-top-right-radius:9999px}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-b-\[3px\]{border-bottom-width:3px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[\#1f5c9c\]\/30{border-color:#1f5c9c4d}.border-\[\#233648\]{--tw-border-opacity: 1;border-color:rgb(35 54 72 / var(--tw-border-opacity, 1))}.border-\[\#2a3b4d\]{--tw-border-opacity: 1;border-color:rgb(42 59 77 / var(--tw-border-opacity, 1))}.border-\[\#324d67\]{--tw-border-opacity: 1;border-color:rgb(50 77 103 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-background-dark{--tw-border-opacity: 1;border-color:rgb(16 25 34 / var(--tw-border-opacity, 1))}.border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-border-dark{--tw-border-opacity: 1;border-color:rgb(35 54 72 / var(--tw-border-opacity, 1))}.border-border-dark\/50{border-color:#23364880}.border-emerald-100{--tw-border-opacity: 1;border-color:rgb(209 250 229 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-800{--tw-border-opacity: 1;border-color:rgb(6 95 70 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-500\/20{border-color:#6b728033}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-orange-500\/20{border-color:#f9731633}.border-orange-500\/30{border-color:#f973164d}.border-primary{--tw-border-opacity: 1;border-color:rgb(19 127 236 / var(--tw-border-opacity, 1))}.border-primary\/20{border-color:#137fec33}.border-primary\/30{border-color:#137fec4d}.border-primary\/50{border-color:#137fec80}.border-purple-500\/20{border-color:#a855f733}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-teal-500\/20{border-color:#14b8a633}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-white\/5{border-color:#ffffff0d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700\/50{border-color:#a1620780}.border-l-primary{--tw-border-opacity: 1;border-left-color:rgb(19 127 236 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.bg-\[\#0a0f14\]{--tw-bg-opacity: 1;background-color:rgb(10 15 20 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1419\]{--tw-bg-opacity: 1;background-color:rgb(13 20 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0f161d\]{--tw-bg-opacity: 1;background-color:rgb(15 22 29 / var(--tw-bg-opacity, 1))}.bg-\[\#0f1720\]{--tw-bg-opacity: 1;background-color:rgb(15 23 32 / var(--tw-bg-opacity, 1))}.bg-\[\#111a22\]{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.bg-\[\#111a22\]\/95{background-color:#111a22f2}.bg-\[\#121416\]\/50{background-color:#12141680}.bg-\[\#121416\]\/80{background-color:#121416cc}.bg-\[\#141d26\]{--tw-bg-opacity: 1;background-color:rgb(20 29 38 / var(--tw-bg-opacity, 1))}.bg-\[\#151d26\]{--tw-bg-opacity: 1;background-color:rgb(21 29 38 / var(--tw-bg-opacity, 1))}.bg-\[\#151e29\]{--tw-bg-opacity: 1;background-color:rgb(21 30 41 / var(--tw-bg-opacity, 1))}.bg-\[\#151f29\]{--tw-bg-opacity: 1;background-color:rgb(21 31 41 / var(--tw-bg-opacity, 1))}.bg-\[\#161d27\]{--tw-bg-opacity: 1;background-color:rgb(22 29 39 / var(--tw-bg-opacity, 1))}.bg-\[\#161f29\]{--tw-bg-opacity: 1;background-color:rgb(22 31 41 / var(--tw-bg-opacity, 1))}.bg-\[\#16202a\]{--tw-bg-opacity: 1;background-color:rgb(22 32 42 / var(--tw-bg-opacity, 1))}.bg-\[\#18232e\]{--tw-bg-opacity: 1;background-color:rgb(24 35 46 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1d21\]{--tw-bg-opacity: 1;background-color:rgb(26 29 33 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2632\]{--tw-bg-opacity: 1;background-color:rgb(26 38 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2e22\]{--tw-bg-opacity: 1;background-color:rgb(26 46 34 / var(--tw-bg-opacity, 1))}.bg-\[\#1c2834\]{--tw-bg-opacity: 1;background-color:rgb(28 40 52 / var(--tw-bg-opacity, 1))}.bg-\[\#1c2936\]{--tw-bg-opacity: 1;background-color:rgb(28 41 54 / var(--tw-bg-opacity, 1))}.bg-\[\#1c2a39\]{--tw-bg-opacity: 1;background-color:rgb(28 42 57 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2832\]{--tw-bg-opacity: 1;background-color:rgb(30 40 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2936\]{--tw-bg-opacity: 1;background-color:rgb(30 41 54 / var(--tw-bg-opacity, 1))}.bg-\[\#22252a\]{--tw-bg-opacity: 1;background-color:rgb(34 37 42 / var(--tw-bg-opacity, 1))}.bg-\[\#22252a\]\/20{background-color:#22252a33}.bg-\[\#22252a\]\/50{background-color:#22252a80}.bg-\[\#233648\]{--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.bg-\[\#2a3b4d\]{--tw-bg-opacity: 1;background-color:rgb(42 59 77 / var(--tw-bg-opacity, 1))}.bg-\[\#2a3c50\]{--tw-bg-opacity: 1;background-color:rgb(42 60 80 / var(--tw-bg-opacity, 1))}.bg-\[\#332a18\]{--tw-bg-opacity: 1;background-color:rgb(51 42 24 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/80{background-color:#f59e0bcc}.bg-background-dark{--tw-bg-opacity: 1;background-color:rgb(16 25 34 / var(--tw-bg-opacity, 1))}.bg-background-dark\/95{background-color:#101922f2}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/90{background-color:#000000e6}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-900\/30{background-color:#1e3a8a4d}.bg-border-dark{--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.bg-border-dark\/50{background-color:#23364880}.bg-card-dark{--tw-bg-opacity: 1;background-color:rgb(25 38 51 / var(--tw-bg-opacity, 1))}.bg-card-dark\/50{background-color:#19263380}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/90{background-color:hsl(var(--destructive) / .9)}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/30{background-color:#10b9814d}.bg-emerald-500\/80{background-color:#10b981cc}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-500\/10{background-color:#6b72801a}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-700\/30{background-color:#3741514d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-indigo-500\/10{background-color:#6366f11a}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(19 127 236 / var(--tw-bg-opacity, 1))}.bg-primary\/10{background-color:#137fec1a}.bg-primary\/20{background-color:#137fec33}.bg-primary\/5{background-color:#137fec0d}.bg-primary\/90{background-color:#137fece6}.bg-primary\/\[0\.03\]{background-color:#137fec08}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/80{background-color:#ef4444cc}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/10{background-color:#7f1d1d1a}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/80{background-color:hsl(var(--secondary) / .8)}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-slate-50\/50{background-color:#f8fafc80}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-surface-dark{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.bg-surface-dark\/40{background-color:#111a2266}.bg-surface-dark\/50{background-color:#111a2280}.bg-surface-highlight{--tw-bg-opacity: 1;background-color:rgb(28 41 54 / var(--tw-bg-opacity, 1))}.bg-teal-500\/10{background-color:#14b8a61a}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-white\/5{background-color:#ffffff0d}.bg-white\/\[0\.02\]{background-color:#ffffff05}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: #137fec var(--tw-gradient-from-position);--tw-gradient-to: rgb(19 127 236 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/0{--tw-gradient-from: rgb(19 127 236 / 0) var(--tw-gradient-from-position);--tw-gradient-to: rgb(19 127 236 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/20{--tw-gradient-from: rgb(19 127 236 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(19 127 236 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-primary\/15{--tw-gradient-to: rgb(19 127 236 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(19 127 236 / .15) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/5{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .05) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-400{--tw-gradient-to: #60a5fa var(--tw-gradient-to-position)}.to-blue-600\/20{--tw-gradient-to: rgb(37 99 235 / .2) var(--tw-gradient-to-position)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-primary{--tw-gradient-to: #137fec var(--tw-gradient-to-position)}.to-primary\/0{--tw-gradient-to: rgb(19 127 236 / 0) var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-16{padding-left:4rem;padding-right:4rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-10{padding-bottom:2.5rem}.pb-2{padding-bottom:.5rem}.pb-20{padding-bottom:5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-10{padding-left:2.5rem}.pl-12{padding-left:3rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-display{font-family:Manrope,sans-serif}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-6xl{font-size:3.75rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[16px\]{font-size:16px}.text-\[18px\]{font-size:18px}.text-\[20px\]{font-size:20px}.text-\[24px\]{font-size:24px}.text-\[32px\]{font-size:32px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[-0\.033em\]{letter-spacing:-.033em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#0bda5b\]{--tw-text-opacity: 1;color:rgb(11 218 91 / var(--tw-text-opacity, 1))}.text-\[\#536b85\]{--tw-text-opacity: 1;color:rgb(83 107 133 / var(--tw-text-opacity, 1))}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(19 127 236 / var(--tw-text-opacity, 1))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:#137fecb3}.text-primary\/80{color:#137feccc}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-teal-500{--tw-text-opacity: 1;color:rgb(20 184 166 / var(--tw-text-opacity, 1))}.text-text-secondary{--tw-text-opacity: 1;color:rgb(146 173 201 / var(--tw-text-opacity, 1))}.text-text-secondary\/50{color:#92adc980}.text-text-secondary\/80{color:#92adc9cc}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-white\/60{color:#fff9}.text-white\/70{color:#ffffffb3}.text-white\/80{color:#fffc}.text-white\/90{color:#ffffffe6}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-\[\#536b85\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(83 107 133 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#536b85\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(83 107 133 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-text-secondary::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(146 173 201 / var(--tw-placeholder-opacity, 1))}.placeholder-text-secondary::placeholder{--tw-placeholder-opacity: 1;color:rgb(146 173 201 / var(--tw-placeholder-opacity, 1))}.placeholder-text-secondary\/50::-moz-placeholder{color:#92adc980}.placeholder-text-secondary\/50::placeholder{color:#92adc980}.placeholder-white\/50::-moz-placeholder{color:#ffffff80}.placeholder-white\/50::placeholder{color:#ffffff80}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(16\,185\,129\,0\.5\)\]{--tw-shadow: 0 0 8px rgba(16,185,129,.5);--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_4px_12px_rgba\(19\,127\,236\,0\.3\)\]{--tw-shadow: 0 4px 12px rgba(19,127,236,.3);--tw-shadow-colored: 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black{--tw-shadow-color: #000;--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-900\/20{--tw-shadow-color: rgb(30 58 138 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/10{--tw-shadow-color: rgb(34 197 94 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-primary\/20{--tw-shadow-color: rgb(19 127 236 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:#111a22;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:#324d67;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#476685}.custom-scrollbar{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scroll-behavior:smooth}.custom-scrollbar,.custom-scrollbar *{touch-action:pan-y}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#324d67 #111a22}@keyframes electric-glow{0%,to{box-shadow:0 0 8px #137fec66,0 0 16px #137fec4d,0 0 24px #137fec33,inset 0 0 8px #137fec1a}50%{box-shadow:0 0 12px #137fec99,0 0 24px #137fec66,0 0 36px #137fec4d,inset 0 0 12px #137fec26}}@keyframes electric-border{0%,to{border-color:#137fec4d}50%{border-color:#137fec99}}.electric-glow{animation:electric-glow 2.5s ease-in-out infinite}.electric-glow-border{animation:electric-border 2.5s ease-in-out infinite}@keyframes shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}.toggle-checkbox:checked{right:0;border-color:#137fec}.toggle-checkbox:checked+.toggle-label{background-color:#137fec}.toggle-checkbox{right:0;left:auto}.toggle-checkbox:checked{right:0;left:auto}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-text-secondary::-moz-placeholder{--tw-text-opacity: 1;color:rgb(146 173 201 / var(--tw-text-opacity, 1))}.placeholder\:text-text-secondary::placeholder{--tw-text-opacity: 1;color:rgb(146 173 201 / var(--tw-text-opacity, 1))}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:-left-4:before{content:var(--tw-content);left:-1rem}.before\:top-1\/2:before{content:var(--tw-content);top:50%}.before\:h-px:before{content:var(--tw-content);height:1px}.before\:w-3:before{content:var(--tw-content);width:.75rem}.before\:-translate-y-1\/2:before{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.before\:bg-border-dark:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.before\:opacity-50:before{content:var(--tw-content);opacity:.5}.before\:content-\[\'\'\]:before{--tw-content: "";content:var(--tw-content)}.first\:rounded-t-lg:first-child{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.last\:rounded-b-lg:last-child{border-bottom-right-radius:.5rem;border-bottom-left-radius:.5rem}.last\:border-b-0:last-child{border-bottom-width:0px}.autofill\:bg-\[\#111a22\]:-webkit-autofill{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.autofill\:bg-\[\#111a22\]:autofill{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.autofill\:text-white:-webkit-autofill{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.autofill\:text-white:autofill{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:border-\[\#536b85\]:hover{--tw-border-opacity: 1;border-color:rgb(83 107 133 / var(--tw-border-opacity, 1))}.hover\:border-border-dark:hover{--tw-border-opacity: 1;border-color:rgb(35 54 72 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-primary:hover{--tw-border-opacity: 1;border-color:rgb(19 127 236 / var(--tw-border-opacity, 1))}.hover\:border-primary\/50:hover{border-color:#137fec80}.hover\:border-red-400\/20:hover{border-color:#f8717133}.hover\:border-red-500:hover{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.hover\:border-slate-500:hover{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#111a22\]:hover{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#18232e\]:hover{--tw-bg-opacity: 1;background-color:rgb(24 35 46 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1a242f\]:hover{--tw-bg-opacity: 1;background-color:rgb(26 36 47 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1a2632\]:hover{--tw-bg-opacity: 1;background-color:rgb(26 38 50 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1c2936\]:hover{--tw-bg-opacity: 1;background-color:rgb(28 41 54 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1c2a39\]:hover{--tw-bg-opacity: 1;background-color:rgb(28 42 57 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2832\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 40 50 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2936\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 54 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#22252a\]\/80:hover{background-color:#22252acc}.hover\:bg-\[\#233342\]:hover{--tw-bg-opacity: 1;background-color:rgb(35 51 66 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#233648\]:hover{--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#233648\]\/30:hover{background-color:#2336484d}.hover\:bg-\[\#2a3b4d\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 59 77 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a3c50\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 60 80 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a3e50\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 62 80 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2b4055\]:hover{--tw-bg-opacity: 1;background-color:rgb(43 64 85 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2c445a\]:hover{--tw-bg-opacity: 1;background-color:rgb(44 68 90 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2f455a\]:hover{--tw-bg-opacity: 1;background-color:rgb(47 69 90 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#324d67\]:hover{--tw-bg-opacity: 1;background-color:rgb(50 77 103 / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-border-dark:hover{--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.hover\:bg-border-dark\/50:hover{background-color:#23364880}.hover\:bg-card-dark:hover{--tw-bg-opacity: 1;background-color:rgb(25 38 51 / var(--tw-bg-opacity, 1))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-400\/10:hover{background-color:#34d3991a}.hover\:bg-emerald-500\/30:hover{background-color:#10b9814d}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-500\/30:hover{background-color:#6b72804d}.hover\:bg-green-500\/30:hover{background-color:#22c55e4d}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary:hover{--tw-bg-opacity: 1;background-color:rgb(19 127 236 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:#137fec1a}.hover\:bg-primary\/20:hover{background-color:#137fec33}.hover\:bg-primary\/30:hover{background-color:#137fec4d}.hover\:bg-primary\/90:hover{background-color:#137fece6}.hover\:bg-primary\/\[0\.05\]:hover{background-color:#137fec0d}.hover\:bg-red-400\/10:hover{background-color:#f871711a}.hover\:bg-red-400\/20:hover{background-color:#f8717133}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-300:hover{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50:hover{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50\/50:hover{background-color:#f8fafc80}.hover\:bg-surface-dark:hover{--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.hover\:bg-surface-dark\/50:hover{background-color:#111a2280}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-white\/\[0\.02\]:hover{background-color:#ffffff05}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-green-400:hover{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{--tw-text-opacity: 1;color:rgb(19 127 236 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-slate-600:hover{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:text-slate-700:hover{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-primary\/10:hover{--tw-shadow-color: rgb(19 127 236 / .1);--tw-shadow: var(--tw-shadow-colored)}.focus\:z-10:focus{z-index:10}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-primary:focus{--tw-border-opacity: 1;border-color:rgb(19 127 236 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-primary:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(19 127 236 / var(--tw-ring-opacity, 1))}.focus\:ring-primary\/50:focus{--tw-ring-color: rgb(19 127 236 / .5)}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-\[\#111a22\]:focus{--tw-ring-offset-color: #111a22}.focus\:ring-offset-background-dark:focus{--tw-ring-offset-color: #101922}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group:focus-within .group-focus-within\:text-primary{--tw-text-opacity: 1;color:rgb(19 127 236 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:flex{display:flex}.group:hover .group-hover\:bg-blue-500\/20{background-color:#3b82f633}.group:hover .group-hover\:bg-indigo-500\/20{background-color:#6366f133}.group:hover .group-hover\:bg-purple-500\/20{background-color:#a855f733}.group\/copy:hover .group-hover\/copy\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-primary{--tw-text-opacity: 1;color:rgb(19 127 236 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group\/copy:hover .group-hover\/copy\:opacity-100,.group\/iqn:hover .group-hover\/iqn\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:opacity-20{opacity:.2}.peer:checked~.peer-checked\:translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:bg-primary\/20{background-color:#137fec33}.has-\[\:checked\]\:justify-end:has(:checked){justify-content:flex-end}.has-\[\:checked\]\:bg-primary:has(:checked){--tw-bg-opacity: 1;background-color:rgb(19 127 236 / var(--tw-bg-opacity, 1))}.dark\:divide-\[\#233648\]:is(.dark *)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(35 54 72 / var(--tw-divide-opacity, 1))}.dark\:divide-slate-800:is(.dark *)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.dark\:border-\[\#111a22\]:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 26 34 / var(--tw-border-opacity, 1))}.dark\:border-\[\#233648\]:is(.dark *){--tw-border-opacity: 1;border-color:rgb(35 54 72 / var(--tw-border-opacity, 1))}.dark\:border-\[\#2d3748\]:is(.dark *){--tw-border-opacity: 1;border-color:rgb(45 55 72 / var(--tw-border-opacity, 1))}.dark\:border-\[\#324d67\]:is(.dark *){--tw-border-opacity: 1;border-color:rgb(50 77 103 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-emerald-800\/30:is(.dark *){border-color:#065f464d}.dark\:border-primary\/40:is(.dark *){border-color:#137fec66}.dark\:border-slate-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.dark\:border-slate-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.dark\:border-slate-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.dark\:bg-\[\#080c11\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(8 12 17 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#0d141c\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(13 20 28 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#101922\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(16 25 34 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#111a22\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 26 34 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#161d27\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(22 29 39 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#16232e\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(22 35 46 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#1a1d21\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(26 29 33 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#1e293b\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#22252a\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(34 37 42 / var(--tw-bg-opacity, 1))}.dark\:bg-\[\#233648\]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900\/20:is(.dark *){background-color:#1e3a8a33}.dark\:bg-card-dark:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(25 38 51 / var(--tw-bg-opacity, 1))}.dark\:bg-emerald-900\/20:is(.dark *){background-color:#064e3b33}.dark\:bg-emerald-900\/30:is(.dark *){background-color:#064e3b4d}.dark\:bg-indigo-500\/20:is(.dark *){background-color:#6366f133}.dark\:bg-primary\/20:is(.dark *){background-color:#137fec33}.dark\:bg-purple-500\/20:is(.dark *){background-color:#a855f733}.dark\:bg-red-900\/20:is(.dark *){background-color:#7f1d1d33}.dark\:bg-slate-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-slate-800\/20:is(.dark *){background-color:#1e293b33}.dark\:bg-slate-800\/50:is(.dark *){background-color:#1e293b80}.dark\:bg-slate-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.dark\:bg-slate-900\/20:is(.dark *){background-color:#0f172a33}.dark\:bg-slate-900\/30:is(.dark *){background-color:#0f172a4d}.dark\:bg-slate-900\/50:is(.dark *){background-color:#0f172a80}.dark\:bg-slate-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.dark\:text-\[\#92adc9\]:is(.dark *){--tw-text-opacity: 1;color:rgb(146 173 201 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-emerald-400:is(.dark *){--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.dark\:text-slate-100:is(.dark *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.dark\:text-slate-300:is(.dark *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.dark\:text-slate-400:is(.dark *){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.dark\:text-slate-500:is(.dark *){--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-\[\#16232e\]:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(22 35 46 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-\[\#233648\]:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(35 54 72 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-slate-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-slate-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-slate-800\/30:hover:is(.dark *){background-color:#1e293b4d}.dark\:hover\:text-slate-100:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.dark\:hover\:text-slate-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.dark\:hover\:text-white:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media(min-width:640px){.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:w-96{width:24rem}.sm\:w-auto{width:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:ml-auto{margin-left:auto}.md\:flex{display:flex}.md\:w-64{width:16rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-end{align-items:flex-end}.md\:items-center{align-items:center}.md\:p-8{padding:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-4{grid-column:span 4 / span 4}.lg\:col-span-8{grid-column:span 8 / span 8}.lg\:ml-0{margin-left:0}.lg\:ml-64{margin-left:16rem}.lg\:hidden{display:none}.lg\:w-80{width:20rem}.lg\:w-\[400px\]{width:400px}.lg\:w-auto{width:auto}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:p-12{padding:3rem}.lg\:px-10{padding-left:2.5rem;padding-right:2.5rem}.lg\:px-12{padding-left:3rem;padding-right:3rem}.lg\:text-base{font-size:1rem;line-height:1.5rem}}@media(min-width:1280px){.xl\:col-span-1{grid-column:span 1 / span 1}.xl\:col-span-2{grid-column:span 2 / span 2}.xl\:h-auto{height:auto}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\>option\]\:bg-\[\#161d27\]>option{--tw-bg-opacity: 1;background-color:rgb(22 29 39 / var(--tw-bg-opacity, 1))}.\[\&\>option\]\:text-white>option{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))} diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-ChZMKDzx.js b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-ChZMKDzx.js new file mode 100644 index 0000000..0f264b8 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/assets/index-ChZMKDzx.js @@ -0,0 +1,207 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-BqkUSV0N.js","assets/react-vendor-Dvs2KPqW.js","assets/utils-vendor-CJpcXyE0.js"])))=>i.map(i=>d[i]); +import{u as ft,j as e,a as dt,b as Nr,Q as A6,c as c6}from"./query-vendor-BeRQtQod.js";import{a as d6,b as u6,g as h6,u as Ph,r as Ce,L as ba,R as $B,d as jy,e as Cy,O as f6,B as m6,f as p6,h as Fs,N as x6}from"./react-vendor-Dvs2KPqW.js";import{c as g6,a as b6,_ as y6,b as Yr}from"./utils-vendor-CJpcXyE0.js";import{R as Cn,C as e4,T as t4,M as r4,a as su,b as Ec,A as Wm,d as Eh,t as w6,c as v6,B as Lb,e as s4,I as a4,f as n4,g as wc,h as es,P as Ks,i as i4,j as Ka,S as vc,N as ya,k as N6,l as B6,m as io,n as Sy,o as so,H as Ul,p as j6,q as wh,r as Uh,s as up,X as Zs,U as Vd,u as C6,G as S6,v as Tb,F as au,w as hp,x as Ib,y as _6,L as Xm,z as zf,D as k6,E as Bn,J as fp,K as mp,O as pp,Q as Wd,V as o4,W as xv,Y as Db,Z as F6,_ as E6,$ as gv,a0 as U6,a1 as l4,a2 as _l,a3 as Wx,a4 as Q6,a5 as bv,a6 as A4,a7 as _y,a8 as c4,a9 as d4,aa as u4,ab as h4,ac as L6,ad as Tm,ae as T6,af as Xx,ag as Im,ah as I6,ai as D6,aj as R6,ak as yv,al as wv,am as O6,an as vv,ao as H6,ap as M6,aq as P6}from"./ui-vendor-C4xvlrdo.js";import{R as Cl,L as ky,C as Nc,X as Bc,Y as jc,T as Sl,a as Qh,b as Lh,A as f4,c as vh,P as Nv,d as Bv,e as Yx,B as jv,f as Jx}from"./chart-vendor-CnBPFalK.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();var Zx={exports:{}},Zu={},$x={exports:{}},eg={};var Cv;function K6(){return Cv||(Cv=1,(function(r){function t(ae,se){var fe=ae.length;ae.push(se);e:for(;0>>1,_e=ae[ye];if(0>>1;yeo($,fe))X<_e&&0>o(te,$)?(ae[ye]=te,ae[X]=fe,ye=X):(ae[ye]=$,ae[D]=fe,ye=D);else if(X<_e&&0>o(te,fe))ae[ye]=te,ae[X]=fe,ye=X;else break e}}return se}function o(ae,se){var fe=ae.sortIndex-se.sortIndex;return fe!==0?fe:ae.id-se.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;r.unstable_now=function(){return l.now()}}else{var d=Date,c=d.now();r.unstable_now=function(){return d.now()-c}}var u=[],h=[],m=1,x=null,y=3,p=!1,v=!1,N=!1,B=!1,g=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function w(ae){for(var se=s(h);se!==null;){if(se.callback===null)n(h);else if(se.startTime<=ae)n(h),se.sortIndex=se.expirationTime,t(u,se);else break;se=s(h)}}function L(ae){if(N=!1,w(ae),!v)if(s(u)!==null)v=!0,K||(K=!0,U());else{var se=s(h);se!==null&&le(L,se.startTime-ae)}}var K=!1,M=-1,V=5,T=-1;function ne(){return B?!0:!(r.unstable_now()-Tae&&ne());){var ye=x.callback;if(typeof ye=="function"){x.callback=null,y=x.priorityLevel;var _e=ye(x.expirationTime<=ae);if(ae=r.unstable_now(),typeof _e=="function"){x.callback=_e,w(ae),se=!0;break t}x===s(u)&&n(u),w(ae)}else n(u);x=s(u)}if(x!==null)se=!0;else{var xe=s(h);xe!==null&&le(L,xe.startTime-ae),se=!1}}break e}finally{x=null,y=fe,p=!1}se=void 0}}finally{se?U():K=!1}}}var U;if(typeof _=="function")U=function(){_(Z)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,F=q.port2;q.port1.onmessage=Z,U=function(){F.postMessage(null)}}else U=function(){g(Z,0)};function le(ae,se){M=g(function(){ae(r.unstable_now())},se)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(ae){ae.callback=null},r.unstable_forceFrameRate=function(ae){0>ae||125ye?(ae.sortIndex=fe,t(h,ae),s(u)===null&&ae===s(h)&&(N?(j(M),M=-1):N=!0,le(L,fe-ye))):(ae.sortIndex=_e,t(u,ae),v||p||(v=!0,K||(K=!0,U()))),ae},r.unstable_shouldYield=ne,r.unstable_wrapCallback=function(ae){var se=y;return function(){var fe=y;y=se;try{return ae.apply(this,arguments)}finally{y=fe}}}})(eg)),eg}var Sv;function z6(){return Sv||(Sv=1,$x.exports=K6()),$x.exports}var _v;function q6(){if(_v)return Zu;_v=1;var r=z6(),t=d6(),s=u6();function n(a){var i="https://react.dev/errors/"+a;if(1_e||(a.current=ye[_e],ye[_e]=null,_e--)}function $(a,i){_e++,ye[_e]=a.current,a.current=i}var X=xe(null),te=xe(null),J=xe(null),O=xe(null);function H(a,i){switch($(J,i),$(te,a),$(X,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?Hw(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=Hw(i),a=Mw(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}D(X),$(X,a)}function re(){D(X),D(te),D(J)}function Ae(a){a.memoizedState!==null&&$(O,a);var i=X.current,A=Mw(i,a.type);i!==A&&($(te,a),$(X,A))}function oe(a){te.current===a&&(D(X),D(te)),O.current===a&&(D(O),Wu._currentValue=fe)}var ce,Se;function z(a){if(ce===void 0)try{throw Error()}catch(A){var i=A.stack.trim().match(/\n( *(at )?)/);ce=i&&i[1]||"",Se=-1)":-1C||ke[f]!==Ke[C]){var Ye=` +`+ke[f].replace(" at new "," at ");return a.displayName&&Ye.includes("")&&(Ye=Ye.replace("",a.displayName)),Ye}while(1<=f&&0<=C);break}}}finally{ie=!1,Error.prepareStackTrace=A}return(A=a?a.displayName||a.name:"")?z(A):""}function Q(a,i){switch(a.tag){case 26:case 27:case 5:return z(a.type);case 16:return z("Lazy");case 13:return a.child!==i&&i!==null?z("Suspense Fallback"):z("Suspense");case 19:return z("SuspenseList");case 0:case 15:return W(a.type,!1);case 11:return W(a.type.render,!1);case 1:return W(a.type,!0);case 31:return z("Activity");default:return""}}function I(a){try{var i="",A=null;do i+=Q(a,A),A=a,a=a.return;while(a);return i}catch(f){return` +Error generating stack: `+f.message+` +`+f.stack}}var k=Object.prototype.hasOwnProperty,G=r.unstable_scheduleCallback,me=r.unstable_cancelCallback,be=r.unstable_shouldYield,Ue=r.unstable_requestPaint,Re=r.unstable_now,He=r.unstable_getCurrentPriorityLevel,Ve=r.unstable_ImmediatePriority,it=r.unstable_UserBlockingPriority,lt=r.unstable_NormalPriority,ut=r.unstable_LowPriority,Tt=r.unstable_IdlePriority,mt=r.log,Ur=r.unstable_setDisableYieldValue,jt=null,_t=null;function Dt(a){if(typeof mt=="function"&&Ur(a),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(jt,a)}catch{}}var Gt=Math.clz32?Math.clz32:It,kt=Math.log,Fr=Math.LN2;function It(a){return a>>>=0,a===0?32:31-(kt(a)/Fr|0)|0}var Pt=256,Br=262144,zt=4194304;function Bt(a){var i=a&42;if(i!==0)return i;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function cr(a,i,A){var f=a.pendingLanes;if(f===0)return 0;var C=0,E=a.suspendedLanes,ee=a.pingedLanes;a=a.warmLanes;var ge=f&134217727;return ge!==0?(f=ge&~E,f!==0?C=Bt(f):(ee&=ge,ee!==0?C=Bt(ee):A||(A=ge&~a,A!==0&&(C=Bt(A))))):(ge=f&~E,ge!==0?C=Bt(ge):ee!==0?C=Bt(ee):A||(A=f&~a,A!==0&&(C=Bt(A)))),C===0?0:i!==0&&i!==C&&(i&E)===0&&(E=C&-C,A=i&-i,E>=A||E===32&&(A&4194048)!==0)?i:C}function _n(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function Aa(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xn(){var a=zt;return zt<<=1,(zt&62914560)===0&&(zt=4194304),a}function an(a){for(var i=[],A=0;31>A;A++)i.push(a);return i}function Et(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Ci(a,i,A,f,C,E){var ee=a.pendingLanes;a.pendingLanes=A,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=A,a.entangledLanes&=A,a.errorRecoveryDisabledLanes&=A,a.shellSuspendCounter=0;var ge=a.entanglements,ke=a.expirationTimes,Ke=a.hiddenUpdates;for(A=ee&~A;0"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var Ls=/[\n"\\]/g;function vs(a){return a.replace(Ls,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Il(a,i,A,f,C,E,ee,ge){a.name="",ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"?a.type=ee:a.removeAttribute("type"),i!=null?ee==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+yr(i)):a.value!==""+yr(i)&&(a.value=""+yr(i)):ee!=="submit"&&ee!=="reset"||a.removeAttribute("value"),i!=null?RA(a,ee,yr(i)):A!=null?RA(a,ee,yr(A)):f!=null&&a.removeAttribute("value"),C==null&&E!=null&&(a.defaultChecked=!!E),C!=null&&(a.checked=C&&typeof C!="function"&&typeof C!="symbol"),ge!=null&&typeof ge!="function"&&typeof ge!="symbol"&&typeof ge!="boolean"?a.name=""+yr(ge):a.removeAttribute("name")}function Hc(a,i,A,f,C,E,ee,ge){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.type=E),i!=null||A!=null){if(!(E!=="submit"&&E!=="reset"||i!=null)){ho(a);return}A=A!=null?""+yr(A):"",i=i!=null?""+yr(i):A,ge||i===a.value||(a.value=i),a.defaultValue=i}f=f??C,f=typeof f!="function"&&typeof f!="symbol"&&!!f,a.checked=ge?a.checked:!!f,a.defaultChecked=!!f,ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"&&(a.name=ee),ho(a)}function RA(a,i,A){i==="number"&&va(a.ownerDocument)===a||a.defaultValue===""+A||(a.defaultValue=""+A)}function Na(a,i,A,f){if(a=a.options,i){i={};for(var C=0;C"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zA=!1;if($s)try{var Xo={};Object.defineProperty(Xo,"passive",{get:function(){zA=!0}}),window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{zA=!1}var Ja=null,Yo=null,$n=null;function Gc(){if($n)return $n;var a,i=Yo,A=i.length,f,C="value"in Ja?Ja.value:Ja.textContent,E=C.length;for(a=0;a=Rn),Vs=" ",mo=!1;function po(a,i){switch(a){case"keyup":return Hl.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ml(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ri=!1;function Ba(a,i){switch(a){case"compositionend":return Ml(i);case"keypress":return i.which!==32?null:(mo=!0,Vs);case"textInput":return a=i.data,a===Vs&&mo?null:a;default:return null}}function Oi(a,i){if(ri)return a==="compositionend"||!ti&&po(a,i)?(a=Gc(),$n=Yo=Ja=null,ri=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:A,offset:i-a};a=f}e:{for(;A;){if(A.nextSibling){A=A.nextSibling;break e}A=A.parentNode}A=void 0}A=ql(A)}}function Ki(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?Ki(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function zi(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=va(a.document);i instanceof a.HTMLIFrameElement;){try{var A=typeof i.contentWindow.location.href=="string"}catch{A=!1}if(A)a=i.contentWindow;else break;i=va(a.document)}return i}function oi(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var el=$s&&"documentMode"in document&&11>=document.documentMode,$a=null,qi=null,da=null,An=!1;function wr(a,i,A){var f=A.window===A?A.document:A.nodeType===9?A:A.ownerDocument;An||$a==null||$a!==va(f)||(f=$a,"selectionStart"in f&&oi(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),da&&Pi(da,f)||(da=f,f=kf(qi,"onSelect"),0>=ee,C-=ee,mn=1<<32-Gt(i)+C|A<er?(lr=St,St=null):lr=St.sibling;var Cr=qe(Ie,St,Pe[er],$e);if(Cr===null){St===null&&(St=lr);break}a&&St&&Cr.alternate===null&&i(Ie,St),Qe=E(Cr,Qe,er),jr===null?Lt=Cr:jr.sibling=Cr,jr=Cr,St=lr}if(er===Pe.length)return A(Ie,St),ar&&tn(Ie,er),Lt;if(St===null){for(;erer?(lr=St,St=null):lr=St.sibling;var mA=qe(Ie,St,Cr.value,$e);if(mA===null){St===null&&(St=lr);break}a&&St&&mA.alternate===null&&i(Ie,St),Qe=E(mA,Qe,er),jr===null?Lt=mA:jr.sibling=mA,jr=mA,St=lr}if(Cr.done)return A(Ie,St),ar&&tn(Ie,er),Lt;if(St===null){for(;!Cr.done;er++,Cr=Pe.next())Cr=tt(Ie,Cr.value,$e),Cr!==null&&(Qe=E(Cr,Qe,er),jr===null?Lt=Cr:jr.sibling=Cr,jr=Cr);return ar&&tn(Ie,er),Lt}for(St=f(St);!Cr.done;er++,Cr=Pe.next())Cr=Ge(St,Ie,er,Cr.value,$e),Cr!==null&&(a&&Cr.alternate!==null&&St.delete(Cr.key===null?er:Cr.key),Qe=E(Cr,Qe,er),jr===null?Lt=Cr:jr.sibling=Cr,jr=Cr);return a&&St.forEach(function(l6){return i(Ie,l6)}),ar&&tn(Ie,er),Lt}function Pr(Ie,Qe,Pe,$e){if(typeof Pe=="object"&&Pe!==null&&Pe.type===N&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case p:e:{for(var Lt=Pe.key;Qe!==null;){if(Qe.key===Lt){if(Lt=Pe.type,Lt===N){if(Qe.tag===7){A(Ie,Qe.sibling),$e=C(Qe,Pe.props.children),$e.return=Ie,Ie=$e;break e}}else if(Qe.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===V&&Oe(Lt)===Qe.type){A(Ie,Qe.sibling),$e=C(Qe,Pe.props),Vt($e,Pe),$e.return=Ie,Ie=$e;break e}A(Ie,Qe);break}else i(Ie,Qe);Qe=Qe.sibling}Pe.type===N?($e=go(Pe.props.children,Ie.mode,$e,Pe.key),$e.return=Ie,Ie=$e):($e=Vl(Pe.type,Pe.key,Pe.props,null,Ie.mode,$e),Vt($e,Pe),$e.return=Ie,Ie=$e)}return ee(Ie);case v:e:{for(Lt=Pe.key;Qe!==null;){if(Qe.key===Lt)if(Qe.tag===4&&Qe.stateNode.containerInfo===Pe.containerInfo&&Qe.stateNode.implementation===Pe.implementation){A(Ie,Qe.sibling),$e=C(Qe,Pe.children||[]),$e.return=Ie,Ie=$e;break e}else{A(Ie,Qe);break}else i(Ie,Qe);Qe=Qe.sibling}$e=Wl(Pe,Ie.mode,$e),$e.return=Ie,Ie=$e}return ee(Ie);case V:return Pe=Oe(Pe),Pr(Ie,Qe,Pe,$e)}if(le(Pe))return wt(Ie,Qe,Pe,$e);if(U(Pe)){if(Lt=U(Pe),typeof Lt!="function")throw Error(n(150));return Pe=Lt.call(Pe),Mt(Ie,Qe,Pe,$e)}if(typeof Pe.then=="function")return Pr(Ie,Qe,pt(Pe),$e);if(Pe.$$typeof===_)return Pr(Ie,Qe,id(Ie,Pe),$e);bt(Ie,Pe)}return typeof Pe=="string"&&Pe!==""||typeof Pe=="number"||typeof Pe=="bigint"?(Pe=""+Pe,Qe!==null&&Qe.tag===6?(A(Ie,Qe.sibling),$e=C(Qe,Pe),$e.return=Ie,Ie=$e):(A(Ie,Qe),$e=tc(Pe,Ie.mode,$e),$e.return=Ie,Ie=$e),ee(Ie)):A(Ie,Qe)}return function(Ie,Qe,Pe,$e){try{vt=0;var Lt=Pr(Ie,Qe,Pe,$e);return st=null,Lt}catch(St){if(St===Ee||St===Ne)throw St;var jr=ha(29,St,null,Ie.mode);return jr.lanes=$e,jr.return=Ie,jr}}}var Vr=sr(!0),Jt=sr(!1),xt=!1;function At(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ss(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Ot(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function $t(a,i,A){var f=a.updateQueue;if(f===null)return null;if(f=f.shared,(kr&2)!==0){var C=f.pending;return C===null?i.next=i:(i.next=C.next,C.next=i),f.pending=i,i=ua(a),$A(a,null,A),i}return ZA(a,f,i,A),ua(a)}function Sr(a,i,A){if(i=i.updateQueue,i!==null&&(i=i.shared,(A&4194048)!==0)){var f=i.lanes;f&=a.pendingLanes,A|=f,i.lanes=A,qa(a,A)}}function Is(a,i){var A=a.updateQueue,f=a.alternate;if(f!==null&&(f=f.updateQueue,A===f)){var C=null,E=null;if(A=A.firstBaseUpdate,A!==null){do{var ee={lane:A.lane,tag:A.tag,payload:A.payload,callback:null,next:null};E===null?C=E=ee:E=E.next=ee,A=A.next}while(A!==null);E===null?C=E=i:E=E.next=i}else C=E=i;A={baseState:f.baseState,firstBaseUpdate:C,lastBaseUpdate:E,shared:f.shared,callbacks:f.callbacks},a.updateQueue=A;return}a=A.lastBaseUpdate,a===null?A.firstBaseUpdate=i:a.next=i,A.lastBaseUpdate=i}var ia=!1;function Or(){if(ia){var a=S;if(a!==null)throw a}}function Bs(a,i,A,f){ia=!1;var C=a.updateQueue;xt=!1;var E=C.firstBaseUpdate,ee=C.lastBaseUpdate,ge=C.shared.pending;if(ge!==null){C.shared.pending=null;var ke=ge,Ke=ke.next;ke.next=null,ee===null?E=Ke:ee.next=Ke,ee=ke;var Ye=a.alternate;Ye!==null&&(Ye=Ye.updateQueue,ge=Ye.lastBaseUpdate,ge!==ee&&(ge===null?Ye.firstBaseUpdate=Ke:ge.next=Ke,Ye.lastBaseUpdate=ke))}if(E!==null){var tt=C.baseState;ee=0,Ye=Ke=ke=null,ge=E;do{var qe=ge.lane&-536870913,Ge=qe!==ge.lane;if(Ge?(or&qe)===qe:(f&qe)===qe){qe!==0&&qe===b&&(ia=!0),Ye!==null&&(Ye=Ye.next={lane:0,tag:ge.tag,payload:ge.payload,callback:null,next:null});e:{var wt=a,Mt=ge;qe=i;var Pr=A;switch(Mt.tag){case 1:if(wt=Mt.payload,typeof wt=="function"){tt=wt.call(Pr,tt,qe);break e}tt=wt;break e;case 3:wt.flags=wt.flags&-65537|128;case 0:if(wt=Mt.payload,qe=typeof wt=="function"?wt.call(Pr,tt,qe):wt,qe==null)break e;tt=x({},tt,qe);break e;case 2:xt=!0}}qe=ge.callback,qe!==null&&(a.flags|=64,Ge&&(a.flags|=8192),Ge=C.callbacks,Ge===null?C.callbacks=[qe]:Ge.push(qe))}else Ge={lane:qe,tag:ge.tag,payload:ge.payload,callback:ge.callback,next:null},Ye===null?(Ke=Ye=Ge,ke=tt):Ye=Ye.next=Ge,ee|=qe;if(ge=ge.next,ge===null){if(ge=C.shared.pending,ge===null)break;Ge=ge,ge=Ge.next,Ge.next=null,C.lastBaseUpdate=Ge,C.shared.pending=null}}while(!0);Ye===null&&(ke=tt),C.baseState=ke,C.firstBaseUpdate=Ke,C.lastBaseUpdate=Ye,E===null&&(C.shared.lanes=0),nA|=ee,a.lanes=ee,a.memoizedState=tt}}function fa(a,i){if(typeof a!="function")throw Error(n(191,a));a.call(i)}function js(a,i){var A=a.callbacks;if(A!==null)for(a.callbacks=null,a=0;aE?E:8;var ee=ae.T,ge={};ae.T=ge,Gp(a,!1,i,A);try{var ke=C(),Ke=ae.S;if(Ke!==null&&Ke(ge,ke),ke!==null&&typeof ke=="object"&&typeof ke.then=="function"){var Ye=ue(ke,f);Eu(a,i,Ye,qn(a))}else Eu(a,i,f,qn(a))}catch(tt){Eu(a,i,{then:function(){},status:"rejected",reason:tt},qn())}finally{se.p=E,ee!==null&&ge.types!==null&&(ee.types=ge.types),ae.T=ee}}function sC(){}function zp(a,i,A,f){if(a.tag!==5)throw Error(n(476));var C=u1(a).queue;d1(a,C,i,fe,A===null?sC:function(){return h1(a),A(f)})}function u1(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:fe},next:null};var A={};return i.next={memoizedState:A,baseState:A,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:A},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function h1(a){var i=u1(a);i.next===null&&(i=a.alternate.memoizedState),Eu(a,i.next.queue,{},qn())}function qp(){return na(Wu)}function f1(){return cs().memoizedState}function m1(){return cs().memoizedState}function aC(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var A=qn();a=Ot(A);var f=$t(i,a,A);f!==null&&(Nn(f,i,A),Sr(f,i,A)),i={cache:Zl()},a.payload=i;return}i=i.return}}function nC(a,i,A){var f=qn();A={lane:f,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null},cf(a)?x1(i,A):(A=Jc(a,i,A,f),A!==null&&(Nn(A,a,f),g1(A,i,f)))}function p1(a,i,A){var f=qn();Eu(a,i,A,f)}function Eu(a,i,A,f){var C={lane:f,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null};if(cf(a))x1(i,C);else{var E=a.alternate;if(a.lanes===0&&(E===null||E.lanes===0)&&(E=i.lastRenderedReducer,E!==null))try{var ee=i.lastRenderedState,ge=E(ee,A);if(C.hasEagerState=!0,C.eagerState=ge,ta(ge,ee))return ZA(a,i,C,0),Wr===null&&JA(),!1}catch{}if(A=Jc(a,i,C,f),A!==null)return Nn(A,a,f),g1(A,i,f),!0}return!1}function Gp(a,i,A,f){if(f={lane:2,revertLane:Bx(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},cf(a)){if(i)throw Error(n(479))}else i=Jc(a,A,f,2),i!==null&&Nn(i,a,2)}function cf(a){var i=a.alternate;return a===Ut||i!==null&&i===Ut}function x1(a,i){gn=Ia=!0;var A=a.pending;A===null?i.next=i:(i.next=A.next,A.next=i),a.pending=i}function g1(a,i,A){if((A&4194048)!==0){var f=i.lanes;f&=a.pendingLanes,A|=f,i.lanes=A,qa(a,A)}}var Uu={readContext:na,use:$l,useCallback:Hr,useContext:Hr,useEffect:Hr,useImperativeHandle:Hr,useLayoutEffect:Hr,useInsertionEffect:Hr,useMemo:Hr,useReducer:Hr,useRef:Hr,useState:Hr,useDebugValue:Hr,useDeferredValue:Hr,useTransition:Hr,useSyncExternalStore:Hr,useId:Hr,useHostTransitionStatus:Hr,useFormState:Hr,useActionState:Hr,useOptimistic:Hr,useMemoCache:Hr,useCacheRefresh:Hr};Uu.useEffectEvent=Hr;var b1={readContext:na,use:$l,useCallback:function(a,i){return Ws().memoizedState=[a,i===void 0?null:i],a},useContext:na,useEffect:r1,useImperativeHandle:function(a,i,A){A=A!=null?A.concat([a]):null,tA(4194308,4,i1.bind(null,i,a),A)},useLayoutEffect:function(a,i){return tA(4194308,4,a,i)},useInsertionEffect:function(a,i){tA(4,2,a,i)},useMemo:function(a,i){var A=Ws();i=i===void 0?null:i;var f=a();if(Sa){Dt(!0);try{a()}finally{Dt(!1)}}return A.memoizedState=[f,i],f},useReducer:function(a,i,A){var f=Ws();if(A!==void 0){var C=A(i);if(Sa){Dt(!0);try{A(i)}finally{Dt(!1)}}}else C=i;return f.memoizedState=f.baseState=C,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:C},f.queue=a,a=a.dispatch=nC.bind(null,Ut,a),[f.memoizedState,a]},useRef:function(a){var i=Ws();return a={current:a},i.memoizedState=a},useState:function(a){a=_o(a);var i=a.queue,A=p1.bind(null,Ut,i);return i.dispatch=A,[a.memoizedState,A]},useDebugValue:Pp,useDeferredValue:function(a,i){var A=Ws();return Kp(A,a,i)},useTransition:function(){var a=_o(!1);return a=d1.bind(null,Ut,a.queue,!0,!1),Ws().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,A){var f=Ut,C=Ws();if(ar){if(A===void 0)throw Error(n(407));A=A()}else{if(A=i(),Wr===null)throw Error(n(349));(or&127)!==0||Xi(f,i,A)}C.memoizedState=A;var E={value:A,getSnapshot:i};return C.queue=E,r1(_u.bind(null,f,E,a),[a]),f.flags|=2048,Al(9,{destroy:void 0},Su.bind(null,f,E,A,i),null),A},useId:function(){var a=Ws(),i=Wr.identifierPrefix;if(ar){var A=pn,f=mn;A=(f&~(1<<32-Gt(f)-1)).toString(32)+A,i="_"+i+"R_"+A,A=_s++,0<\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof f.is=="string"?ee.createElement("select",{is:f.is}):ee.createElement("select"),f.multiple?E.multiple=!0:f.size&&(E.size=f.size);break;default:E=typeof f.is=="string"?ee.createElement(C,{is:f.is}):ee.createElement(C)}}E[Qr]=i,E[ts]=f;e:for(ee=i.child;ee!==null;){if(ee.tag===5||ee.tag===6)E.appendChild(ee.stateNode);else if(ee.tag!==4&&ee.tag!==27&&ee.child!==null){ee.child.return=ee,ee=ee.child;continue}if(ee===i)break e;for(;ee.sibling===null;){if(ee.return===null||ee.return===i)break e;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}i.stateNode=E;e:switch(ka(E,C,f),C){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&dl(i)}}return is(i),ix(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,A),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==f&&dl(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(n(166));if(a=J.current,aa(i)){if(a=i.stateNode,A=i.memoizedProps,f=null,C=sa,C!==null)switch(C.tag){case 27:case 5:f=C.memoizedProps}a[Qr]=i,a=!!(a.nodeValue===A||f!==null&&f.suppressHydrationWarning===!0||Rw(a.nodeValue,A)),a||yo(i,!0)}else a=Ff(a).createTextNode(f),a[Qr]=i,i.stateNode=a}return is(i),null;case 31:if(A=i.memoizedState,a===null||a.memoizedState!==null){if(f=aa(i),A!==null){if(a===null){if(!f)throw Error(n(318));if(a=i.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(557));a[Qr]=i}else nl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;is(i),a=!1}else A=vu(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=A),a=!0;if(!a)return i.flags&256?(Lr(i),i):(Lr(i),null);if((i.flags&128)!==0)throw Error(n(558))}return is(i),null;case 13:if(f=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(C=aa(i),f!==null&&f.dehydrated!==null){if(a===null){if(!C)throw Error(n(318));if(C=i.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[Qr]=i}else nl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;is(i),C=!1}else C=vu(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=C),C=!0;if(!C)return i.flags&256?(Lr(i),i):(Lr(i),null)}return Lr(i),(i.flags&128)!==0?(i.lanes=A,i):(A=f!==null,a=a!==null&&a.memoizedState!==null,A&&(f=i.child,C=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(C=f.alternate.memoizedState.cachePool.pool),E=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(E=f.memoizedState.cachePool.pool),E!==C&&(f.flags|=2048)),A!==a&&A&&(i.child.flags|=8192),mf(i,i.updateQueue),is(i),null);case 4:return re(),a===null&&_x(i.stateNode.containerInfo),is(i),null;case 10:return xn(i.type),is(i),null;case 19:if(D(hr),f=i.memoizedState,f===null)return is(i),null;if(C=(i.flags&128)!==0,E=f.rendering,E===null)if(C)Lu(f,!1);else{if(ks!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(E=ma(a),E!==null){for(i.flags|=128,Lu(f,!1),a=E.updateQueue,i.updateQueue=a,mf(i,a),i.subtreeFlags=0,a=A,A=i.child;A!==null;)ec(A,a),A=A.sibling;return $(hr,hr.current&1|2),ar&&tn(i,f.treeForkCount),i.child}a=a.sibling}f.tail!==null&&Re()>yf&&(i.flags|=128,C=!0,Lu(f,!1),i.lanes=4194304)}else{if(!C)if(a=ma(E),a!==null){if(i.flags|=128,C=!0,a=a.updateQueue,i.updateQueue=a,mf(i,a),Lu(f,!0),f.tail===null&&f.tailMode==="hidden"&&!E.alternate&&!ar)return is(i),null}else 2*Re()-f.renderingStartTime>yf&&A!==536870912&&(i.flags|=128,C=!0,Lu(f,!1),i.lanes=4194304);f.isBackwards?(E.sibling=i.child,i.child=E):(a=f.last,a!==null?a.sibling=E:i.child=E,f.last=E)}return f.tail!==null?(a=f.tail,f.rendering=a,f.tail=a.sibling,f.renderingStartTime=Re(),a.sibling=null,A=hr.current,$(hr,C?A&1|2:A&1),ar&&tn(i,f.treeForkCount),a):(is(i),null);case 22:case 23:return Lr(i),Ds(),f=i.memoizedState!==null,a!==null?a.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(A&536870912)!==0&&(i.flags&128)===0&&(is(i),i.subtreeFlags&6&&(i.flags|=8192)):is(i),A=i.updateQueue,A!==null&&mf(i,A.retryQueue),A=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(A=a.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==A&&(i.flags|=2048),a!==null&&D(pe),null;case 24:return A=null,a!==null&&(A=a.memoizedState.cache),i.memoizedState.cache!==A&&(i.flags|=2048),xn(gs),is(i),null;case 25:return null;case 30:return null}throw Error(n(156,i.tag))}function cC(a,i){switch(sd(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return xn(gs),re(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return oe(i),null;case 31:if(i.memoizedState!==null){if(Lr(i),i.alternate===null)throw Error(n(340));nl()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(Lr(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(n(340));nl()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return D(hr),null;case 4:return re(),null;case 10:return xn(i.type),null;case 22:case 23:return Lr(i),Ds(),a!==null&&D(pe),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return xn(gs),null;case 25:return null;default:return null}}function K1(a,i){switch(sd(i),i.tag){case 3:xn(gs),re();break;case 26:case 27:case 5:oe(i);break;case 4:re();break;case 31:i.memoizedState!==null&&Lr(i);break;case 13:Lr(i);break;case 19:D(hr);break;case 10:xn(i.type);break;case 22:case 23:Lr(i),Ds(),a!==null&&D(pe);break;case 24:xn(gs)}}function Tu(a,i){try{var A=i.updateQueue,f=A!==null?A.lastEffect:null;if(f!==null){var C=f.next;A=C;do{if((A.tag&a)===a){f=void 0;var E=A.create,ee=A.inst;f=E(),ee.destroy=f}A=A.next}while(A!==C)}}catch(ge){Ir(i,i.return,ge)}}function sA(a,i,A){try{var f=i.updateQueue,C=f!==null?f.lastEffect:null;if(C!==null){var E=C.next;f=E;do{if((f.tag&a)===a){var ee=f.inst,ge=ee.destroy;if(ge!==void 0){ee.destroy=void 0,C=i;var ke=A,Ke=ge;try{Ke()}catch(Ye){Ir(C,ke,Ye)}}}f=f.next}while(f!==E)}}catch(Ye){Ir(i,i.return,Ye)}}function z1(a){var i=a.updateQueue;if(i!==null){var A=a.stateNode;try{js(i,A)}catch(f){Ir(a,a.return,f)}}}function q1(a,i,A){A.props=oc(a.type,a.memoizedProps),A.state=a.memoizedState;try{A.componentWillUnmount()}catch(f){Ir(a,i,f)}}function Iu(a,i){try{var A=a.ref;if(A!==null){switch(a.tag){case 26:case 27:case 5:var f=a.stateNode;break;case 30:f=a.stateNode;break;default:f=a.stateNode}typeof A=="function"?a.refCleanup=A(f):A.current=f}}catch(C){Ir(a,i,C)}}function ko(a,i){var A=a.ref,f=a.refCleanup;if(A!==null)if(typeof f=="function")try{f()}catch(C){Ir(a,i,C)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof A=="function")try{A(null)}catch(C){Ir(a,i,C)}else A.current=null}function G1(a){var i=a.type,A=a.memoizedProps,f=a.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":A.autoFocus&&f.focus();break e;case"img":A.src?f.src=A.src:A.srcSet&&(f.srcset=A.srcSet)}}catch(C){Ir(a,a.return,C)}}function ox(a,i,A){try{var f=a.stateNode;UC(f,a.type,A,i),f[ts]=i}catch(C){Ir(a,a.return,C)}}function V1(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&cA(a.type)||a.tag===4}function lx(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||V1(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&cA(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Ax(a,i,A){var f=a.tag;if(f===5||f===6)a=a.stateNode,i?(A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A).insertBefore(a,i):(i=A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A,i.appendChild(a),A=A._reactRootContainer,A!=null||i.onclick!==null||(i.onclick=In));else if(f!==4&&(f===27&&cA(a.type)&&(A=a.stateNode,i=null),a=a.child,a!==null))for(Ax(a,i,A),a=a.sibling;a!==null;)Ax(a,i,A),a=a.sibling}function pf(a,i,A){var f=a.tag;if(f===5||f===6)a=a.stateNode,i?A.insertBefore(a,i):A.appendChild(a);else if(f!==4&&(f===27&&cA(a.type)&&(A=a.stateNode),a=a.child,a!==null))for(pf(a,i,A),a=a.sibling;a!==null;)pf(a,i,A),a=a.sibling}function W1(a){var i=a.stateNode,A=a.memoizedProps;try{for(var f=a.type,C=i.attributes;C.length;)i.removeAttributeNode(C[0]);ka(i,f,A),i[Qr]=a,i[ts]=A}catch(E){Ir(a,a.return,E)}}var ul=!1,Ys=!1,cx=!1,X1=typeof WeakSet=="function"?WeakSet:Set,pa=null;function dC(a,i){if(a=a.containerInfo,Ex=Df,a=zi(a),oi(a)){if("selectionStart"in a)var A={start:a.selectionStart,end:a.selectionEnd};else e:{A=(A=a.ownerDocument)&&A.defaultView||window;var f=A.getSelection&&A.getSelection();if(f&&f.rangeCount!==0){A=f.anchorNode;var C=f.anchorOffset,E=f.focusNode;f=f.focusOffset;try{A.nodeType,E.nodeType}catch{A=null;break e}var ee=0,ge=-1,ke=-1,Ke=0,Ye=0,tt=a,qe=null;t:for(;;){for(var Ge;tt!==A||C!==0&&tt.nodeType!==3||(ge=ee+C),tt!==E||f!==0&&tt.nodeType!==3||(ke=ee+f),tt.nodeType===3&&(ee+=tt.nodeValue.length),(Ge=tt.firstChild)!==null;)qe=tt,tt=Ge;for(;;){if(tt===a)break t;if(qe===A&&++Ke===C&&(ge=ee),qe===E&&++Ye===f&&(ke=ee),(Ge=tt.nextSibling)!==null)break;tt=qe,qe=tt.parentNode}tt=Ge}A=ge===-1||ke===-1?null:{start:ge,end:ke}}else A=null}A=A||{start:0,end:0}}else A=null;for(Ux={focusedElem:a,selectionRange:A},Df=!1,pa=i;pa!==null;)if(i=pa,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,pa=a;else for(;pa!==null;){switch(i=pa,E=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(A=0;A title"))),ka(E,f,A),E[Qr]=a,fs(E),f=E;break e;case"link":var ee=tv("link","href",C).get(f+(A.href||""));if(ee){for(var ge=0;gePr&&(ee=Pr,Pr=Mt,Mt=ee);var Ie=Gl(ge,Mt),Qe=Gl(ge,Pr);if(Ie&&Qe&&(Ge.rangeCount!==1||Ge.anchorNode!==Ie.node||Ge.anchorOffset!==Ie.offset||Ge.focusNode!==Qe.node||Ge.focusOffset!==Qe.offset)){var Pe=tt.createRange();Pe.setStart(Ie.node,Ie.offset),Ge.removeAllRanges(),Mt>Pr?(Ge.addRange(Pe),Ge.extend(Qe.node,Qe.offset)):(Pe.setEnd(Qe.node,Qe.offset),Ge.addRange(Pe))}}}}for(tt=[],Ge=ge;Ge=Ge.parentNode;)Ge.nodeType===1&&tt.push({element:Ge,left:Ge.scrollLeft,top:Ge.scrollTop});for(typeof ge.focus=="function"&&ge.focus(),ge=0;geA?32:A,ae.T=null,A=xx,xx=null;var E=oA,ee=xl;if(oa=0,wd=oA=null,xl=0,(kr&6)!==0)throw Error(n(331));var ge=kr;if(kr|=4,iw(E.current),sw(E,E.current,ee,A),kr=ge,Pu(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(jt,E)}catch{}return!0}finally{se.p=C,ae.T=f,Bw(a,i)}}function Cw(a,i,A){i=un(A,i),i=Yp(a.stateNode,i,2),a=$t(a,i,2),a!==null&&(Et(a,2),Fo(a))}function Ir(a,i,A){if(a.tag===3)Cw(a,a,A);else for(;i!==null;){if(i.tag===3){Cw(i,a,A);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(iA===null||!iA.has(f))){a=un(A,a),A=S1(2),f=$t(i,A,2),f!==null&&(_1(A,f,i,a),Et(f,2),Fo(f));break}}i=i.return}}function wx(a,i,A){var f=a.pingCache;if(f===null){f=a.pingCache=new fC;var C=new Set;f.set(i,C)}else C=f.get(i),C===void 0&&(C=new Set,f.set(i,C));C.has(A)||(hx=!0,C.add(A),a=bC.bind(null,a,i,A),i.then(a,a))}function bC(a,i,A){var f=a.pingCache;f!==null&&f.delete(i),a.pingedLanes|=a.suspendedLanes&A,a.warmLanes&=~A,Wr===a&&(or&A)===A&&(ks===4||ks===3&&(or&62914560)===or&&300>Re()-bf?(kr&2)===0&&vd(a,0):fx|=A,yd===or&&(yd=0)),Fo(a)}function Sw(a,i){i===0&&(i=Xn()),a=Gi(a,i),a!==null&&(Et(a,i),Fo(a))}function yC(a){var i=a.memoizedState,A=0;i!==null&&(A=i.retryLane),Sw(a,A)}function wC(a,i){var A=0;switch(a.tag){case 31:case 13:var f=a.stateNode,C=a.memoizedState;C!==null&&(A=C.retryLane);break;case 19:f=a.stateNode;break;case 22:f=a.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(i),Sw(a,A)}function vC(a,i){return G(a,i)}var Cf=null,Bd=null,vx=!1,Sf=!1,Nx=!1,AA=0;function Fo(a){a!==Bd&&a.next===null&&(Bd===null?Cf=Bd=a:Bd=Bd.next=a),Sf=!0,vx||(vx=!0,BC())}function Pu(a,i){if(!Nx&&Sf){Nx=!0;do for(var A=!1,f=Cf;f!==null;){if(a!==0){var C=f.pendingLanes;if(C===0)var E=0;else{var ee=f.suspendedLanes,ge=f.pingedLanes;E=(1<<31-Gt(42|a)+1)-1,E&=C&~(ee&~ge),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(A=!0,Ew(f,E))}else E=or,E=cr(f,f===Wr?E:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(E&3)===0||_n(f,E)||(A=!0,Ew(f,E));f=f.next}while(A);Nx=!1}}function NC(){_w()}function _w(){Sf=vx=!1;var a=0;AA!==0&&LC()&&(a=AA);for(var i=Re(),A=null,f=Cf;f!==null;){var C=f.next,E=kw(f,i);E===0?(f.next=null,A===null?Cf=C:A.next=C,C===null&&(Bd=A)):(A=f,(a!==0||(E&3)!==0)&&(Sf=!0)),f=C}oa!==0&&oa!==5||Pu(a),AA!==0&&(AA=0)}function kw(a,i){for(var A=a.suspendedLanes,f=a.pingedLanes,C=a.expirationTimes,E=a.pendingLanes&-62914561;0ge)break;var Ye=ke.transferSize,tt=ke.initiatorType;Ye&&Ow(tt)&&(ke=ke.responseEnd,ee+=Ye*(ke"u"?null:document;function Jw(a,i,A){var f=jd;if(f&&typeof i=="string"&&i){var C=vs(i);C='link[rel="'+a+'"][href="'+C+'"]',typeof A=="string"&&(C+='[crossorigin="'+A+'"]'),Yw.has(C)||(Yw.add(C),a={rel:a,crossOrigin:A,href:i},f.querySelector(C)===null&&(i=f.createElement("link"),ka(i,"link",a),fs(i),f.head.appendChild(i)))}}function KC(a){gl.D(a),Jw("dns-prefetch",a,null)}function zC(a,i){gl.C(a,i),Jw("preconnect",a,i)}function qC(a,i,A){gl.L(a,i,A);var f=jd;if(f&&a&&i){var C='link[rel="preload"][as="'+vs(i)+'"]';i==="image"&&A&&A.imageSrcSet?(C+='[imagesrcset="'+vs(A.imageSrcSet)+'"]',typeof A.imageSizes=="string"&&(C+='[imagesizes="'+vs(A.imageSizes)+'"]')):C+='[href="'+vs(a)+'"]';var E=C;switch(i){case"style":E=Cd(a);break;case"script":E=Sd(a)}hi.has(E)||(a=x({rel:"preload",href:i==="image"&&A&&A.imageSrcSet?void 0:a,as:i},A),hi.set(E,a),f.querySelector(C)!==null||i==="style"&&f.querySelector(Gu(E))||i==="script"&&f.querySelector(Vu(E))||(i=f.createElement("link"),ka(i,"link",a),fs(i),f.head.appendChild(i)))}}function GC(a,i){gl.m(a,i);var A=jd;if(A&&a){var f=i&&typeof i.as=="string"?i.as:"script",C='link[rel="modulepreload"][as="'+vs(f)+'"][href="'+vs(a)+'"]',E=C;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Sd(a)}if(!hi.has(E)&&(a=x({rel:"modulepreload",href:a},i),hi.set(E,a),A.querySelector(C)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(A.querySelector(Vu(E)))return}f=A.createElement("link"),ka(f,"link",a),fs(f),A.head.appendChild(f)}}}function VC(a,i,A){gl.S(a,i,A);var f=jd;if(f&&a){var C=Jn(f).hoistableStyles,E=Cd(a);i=i||"default";var ee=C.get(E);if(!ee){var ge={loading:0,preload:null};if(ee=f.querySelector(Gu(E)))ge.loading=5;else{a=x({rel:"stylesheet",href:a,"data-precedence":i},A),(A=hi.get(E))&&Ox(a,A);var ke=ee=f.createElement("link");fs(ke),ka(ke,"link",a),ke._p=new Promise(function(Ke,Ye){ke.onload=Ke,ke.onerror=Ye}),ke.addEventListener("load",function(){ge.loading|=1}),ke.addEventListener("error",function(){ge.loading|=2}),ge.loading|=4,Uf(ee,i,f)}ee={type:"stylesheet",instance:ee,count:1,state:ge},C.set(E,ee)}}}function WC(a,i){gl.X(a,i);var A=jd;if(A&&a){var f=Jn(A).hoistableScripts,C=Sd(a),E=f.get(C);E||(E=A.querySelector(Vu(C)),E||(a=x({src:a,async:!0},i),(i=hi.get(C))&&Hx(a,i),E=A.createElement("script"),fs(E),ka(E,"link",a),A.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},f.set(C,E))}}function XC(a,i){gl.M(a,i);var A=jd;if(A&&a){var f=Jn(A).hoistableScripts,C=Sd(a),E=f.get(C);E||(E=A.querySelector(Vu(C)),E||(a=x({src:a,async:!0,type:"module"},i),(i=hi.get(C))&&Hx(a,i),E=A.createElement("script"),fs(E),ka(E,"link",a),A.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},f.set(C,E))}}function Zw(a,i,A,f){var C=(C=J.current)?Ef(C):null;if(!C)throw Error(n(446));switch(a){case"meta":case"title":return null;case"style":return typeof A.precedence=="string"&&typeof A.href=="string"?(i=Cd(A.href),A=Jn(C).hoistableStyles,f=A.get(i),f||(f={type:"style",instance:null,count:0,state:null},A.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(A.rel==="stylesheet"&&typeof A.href=="string"&&typeof A.precedence=="string"){a=Cd(A.href);var E=Jn(C).hoistableStyles,ee=E.get(a);if(ee||(C=C.ownerDocument||C,ee={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(a,ee),(E=C.querySelector(Gu(a)))&&!E._p&&(ee.instance=E,ee.state.loading=5),hi.has(a)||(A={rel:"preload",as:"style",href:A.href,crossOrigin:A.crossOrigin,integrity:A.integrity,media:A.media,hrefLang:A.hrefLang,referrerPolicy:A.referrerPolicy},hi.set(a,A),E||YC(C,a,A,ee.state))),i&&f===null)throw Error(n(528,""));return ee}if(i&&f!==null)throw Error(n(529,""));return null;case"script":return i=A.async,A=A.src,typeof A=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Sd(A),A=Jn(C).hoistableScripts,f=A.get(i),f||(f={type:"script",instance:null,count:0,state:null},A.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,a))}}function Cd(a){return'href="'+vs(a)+'"'}function Gu(a){return'link[rel="stylesheet"]['+a+"]"}function $w(a){return x({},a,{"data-precedence":a.precedence,precedence:null})}function YC(a,i,A,f){a.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=a.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),ka(i,"link",A),fs(i),a.head.appendChild(i))}function Sd(a){return'[src="'+vs(a)+'"]'}function Vu(a){return"script[async]"+a}function ev(a,i,A){if(i.count++,i.instance===null)switch(i.type){case"style":var f=a.querySelector('style[data-href~="'+vs(A.href)+'"]');if(f)return i.instance=f,fs(f),f;var C=x({},A,{"data-href":A.href,"data-precedence":A.precedence,href:null,precedence:null});return f=(a.ownerDocument||a).createElement("style"),fs(f),ka(f,"style",C),Uf(f,A.precedence,a),i.instance=f;case"stylesheet":C=Cd(A.href);var E=a.querySelector(Gu(C));if(E)return i.state.loading|=4,i.instance=E,fs(E),E;f=$w(A),(C=hi.get(C))&&Ox(f,C),E=(a.ownerDocument||a).createElement("link"),fs(E);var ee=E;return ee._p=new Promise(function(ge,ke){ee.onload=ge,ee.onerror=ke}),ka(E,"link",f),i.state.loading|=4,Uf(E,A.precedence,a),i.instance=E;case"script":return E=Sd(A.src),(C=a.querySelector(Vu(E)))?(i.instance=C,fs(C),C):(f=A,(C=hi.get(E))&&(f=x({},A),Hx(f,C)),a=a.ownerDocument||a,C=a.createElement("script"),fs(C),ka(C,"link",f),a.head.appendChild(C),i.instance=C);case"void":return null;default:throw Error(n(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,Uf(f,A.precedence,a));return i.instance}function Uf(a,i,A){for(var f=A.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=f.length?f[f.length-1]:null,E=C,ee=0;ee title"):null)}function JC(a,i,A){if(A===1||i.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(a=i.disabled,typeof i.precedence=="string"&&a==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function sv(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function ZC(a,i,A,f){if(A.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(A.state.loading&4)===0){if(A.instance===null){var C=Cd(f.href),E=i.querySelector(Gu(C));if(E){i=E._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(a.count++,a=Lf.bind(a),i.then(a,a)),A.state.loading|=4,A.instance=E,fs(E);return}E=i.ownerDocument||i,f=$w(f),(C=hi.get(C))&&Ox(f,C),E=E.createElement("link"),fs(E);var ee=E;ee._p=new Promise(function(ge,ke){ee.onload=ge,ee.onerror=ke}),ka(E,"link",f),A.instance=E}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(A,i),(i=A.state.preload)&&(A.state.loading&3)===0&&(a.count++,A=Lf.bind(a),i.addEventListener("load",A),i.addEventListener("error",A))}}var Mx=0;function $C(a,i){return a.stylesheets&&a.count===0&&If(a,a.stylesheets),0Mx?50:800)+i);return a.unsuspend=A,function(){a.unsuspend=null,clearTimeout(f),clearTimeout(C)}}:null}function Lf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)If(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Tf=null;function If(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Tf=new Map,i.forEach(e6,a),Tf=null,Lf.call(a))}function e6(a,i){if(!(i.state.loading&4)){var A=Tf.get(a);if(A)var f=A.get(null);else{A=new Map,Tf.set(a,A);for(var C=a.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}return r(),Zx.exports=q6(),Zx.exports}var V6=G6();const W6=h6(V6);function X6(){return null}const Y6={};function m4(r,t){let s;try{s=r()}catch{return}return{getItem:o=>{var l;const d=u=>u===null?null:JSON.parse(u,void 0),c=(l=s.getItem(o))!=null?l:null;return c instanceof Promise?c.then(d):d(c)},setItem:(o,l)=>s.setItem(o,JSON.stringify(l,void 0)),removeItem:o=>s.removeItem(o)}}const Th=r=>t=>{try{const s=r(t);return s instanceof Promise?s:{then(n){return Th(n)(s)},catch(n){return this}}}catch(s){return{then(n){return this},catch(n){return Th(n)(s)}}}},J6=(r,t)=>(s,n,o)=>{let l={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:B=>B,version:0,merge:(B,g)=>({...g,...B}),...t},d=!1;const c=new Set,u=new Set;let h;try{h=l.getStorage()}catch{}if(!h)return r((...B)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),s(...B)},n,o);const m=Th(l.serialize),x=()=>{const B=l.partialize({...n()});let g;const j=m({state:B,version:l.version}).then(_=>h.setItem(l.name,_)).catch(_=>{g=_});if(g)throw g;return j},y=o.setState;o.setState=(B,g)=>{y(B,g),x()};const p=r((...B)=>{s(...B),x()},n,o);let v;const N=()=>{var B;if(!h)return;d=!1,c.forEach(j=>j(n()));const g=((B=l.onRehydrateStorage)==null?void 0:B.call(l,n()))||void 0;return Th(h.getItem.bind(h))(l.name).then(j=>{if(j)return l.deserialize(j)}).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==l.version){if(l.migrate)return l.migrate(j.state,j.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return j.state}).then(j=>{var _;return v=l.merge(j,(_=n())!=null?_:p),s(v,!0),x()}).then(()=>{g?.(v,void 0),d=!0,u.forEach(j=>j(v))}).catch(j=>{g?.(void 0,j)})};return o.persist={setOptions:B=>{l={...l,...B},B.getStorage&&(h=B.getStorage())},clearStorage:()=>{h?.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>N(),hasHydrated:()=>d,onHydrate:B=>(c.add(B),()=>{c.delete(B)}),onFinishHydration:B=>(u.add(B),()=>{u.delete(B)})},N(),v||p},Z6=(r,t)=>(s,n,o)=>{let l={storage:m4(()=>localStorage),partialize:N=>N,version:0,merge:(N,B)=>({...B,...N}),...t},d=!1;const c=new Set,u=new Set;let h=l.storage;if(!h)return r((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),s(...N)},n,o);const m=()=>{const N=l.partialize({...n()});return h.setItem(l.name,{state:N,version:l.version})},x=o.setState;o.setState=(N,B)=>{x(N,B),m()};const y=r((...N)=>{s(...N),m()},n,o);o.getInitialState=()=>y;let p;const v=()=>{var N,B;if(!h)return;d=!1,c.forEach(j=>{var _;return j((_=n())!=null?_:y)});const g=((B=l.onRehydrateStorage)==null?void 0:B.call(l,(N=n())!=null?N:y))||void 0;return Th(h.getItem.bind(h))(l.name).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==l.version){if(l.migrate)return[!0,l.migrate(j.state,j.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,j.state];return[!1,void 0]}).then(j=>{var _;const[w,L]=j;if(p=l.merge(L,(_=n())!=null?_:y),s(p,!0),w)return m()}).then(()=>{g?.(p,void 0),p=n(),d=!0,u.forEach(j=>j(p))}).catch(j=>{g?.(void 0,j)})};return o.persist={setOptions:N=>{l={...l,...N},N.storage&&(h=N.storage)},clearStorage:()=>{h?.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>v(),hasHydrated:()=>d,onHydrate:N=>(c.add(N),()=>{c.delete(N)}),onFinishHydration:N=>(u.add(N),()=>{u.delete(N)})},l.skipHydration||v(),p||y},$6=(r,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Y6?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),J6(r,t)):Z6(r,t),eS=$6,hu=g6()(eS(r=>({token:null,user:null,isAuthenticated:!1,setAuth:(t,s)=>r({token:t,user:s,isAuthenticated:!0}),clearAuth:()=>r({token:null,user:null,isAuthenticated:!1}),updateUser:t=>r({user:t})}),{name:"calypso-auth",storage:m4(()=>localStorage)})),ze=b6.create({baseURL:"/api/v1",headers:{"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:"0"}});ze.interceptors.request.use(r=>{const t=hu.getState().token;return t&&(r.headers.Authorization=`Bearer ${t}`),r},r=>Promise.reject(r));ze.interceptors.response.use(r=>r,r=>(r.response?.status===401&&(hu.getState().clearAuth(),window.location.href="/login"),Promise.reject(r)));const tS={login:async r=>(await ze.post("/auth/login",r)).data};function rS(){const r=Ph(),t=hu(m=>m.setAuth),[s,n]=Ce.useState(""),[o,l]=Ce.useState(""),[d,c]=Ce.useState(""),u=ft({mutationFn:tS.login,onSuccess:m=>{t(m.token,m.user),r("/")},onError:m=>{c(m.response?.data?.error||"Login failed")}}),h=m=>{m.preventDefault(),c(""),u.mutate({username:s,password:o})};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:` + input:-webkit-autofill, + input:-webkit-autofill:hover, + input:-webkit-autofill:focus, + input:-webkit-autofill:active { + -webkit-box-shadow: 0 0 0 30px #111a22 inset !important; + -webkit-text-fill-color: #ffffff !important; + box-shadow: 0 0 0 30px #111a22 inset !important; + caret-color: #ffffff !important; + } + input:-webkit-autofill::first-line { + color: #ffffff !important; + } + `}),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background-dark",children:e.jsxs("div",{className:"max-w-md w-full space-y-8 p-8 bg-card-dark border border-border-dark rounded-lg shadow-md",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"mb-4",children:e.jsx("img",{src:"/logo.png",alt:"Calypso Logo",className:"w-16 h-16 object-contain"})}),e.jsx("h2",{className:"text-center text-3xl font-extrabold text-white",children:"Calypso"}),e.jsx("p",{className:"mt-1 text-center text-xs text-text-secondary",children:"Dev Release V.1"}),e.jsx("p",{className:"mt-2 text-center text-sm text-text-secondary",children:"Adastra Backup Storage Appliance"}),e.jsx("p",{className:"mt-4 text-center text-sm text-text-secondary",children:"Sign in to your account"})]}),e.jsxs("form",{className:"mt-8 space-y-6",onSubmit:h,children:[d&&e.jsx("div",{className:"rounded-md bg-red-500/10 border border-red-500/30 p-4",children:e.jsx("p",{className:"text-sm text-red-400 font-medium",children:d})}),e.jsxs("div",{className:"rounded-md shadow-sm -space-y-px",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"sr-only",children:"Username"}),e.jsx("input",{id:"username",name:"username",type:"text",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-border-dark bg-[#111a22] placeholder-text-secondary text-white rounded-t-md focus:outline-none focus:ring-primary focus:border-primary focus:z-10 sm:text-sm autofill:bg-[#111a22] autofill:text-white",placeholder:"Username",value:s,onChange:m=>n(m.target.value),autoComplete:"username"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"sr-only",children:"Password"}),e.jsx("input",{id:"password",name:"password",type:"password",required:!0,className:"appearance-none rounded-none relative block w-full px-3 py-2 border border-border-dark bg-[#111a22] placeholder-text-secondary text-white rounded-b-md focus:outline-none focus:ring-primary focus:border-primary focus:z-10 sm:text-sm autofill:bg-[#111a22] autofill:text-white",placeholder:"Password",value:o,onChange:m=>l(m.target.value),autoComplete:"current-password"})]})]}),e.jsx("div",{children:e.jsxs("button",{type:"submit",disabled:u.isPending,className:"relative group relative w-full flex justify-center py-2.5 px-4 border border-primary/30 bg-card-dark text-white text-sm font-bold rounded-lg hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsx("span",{className:"relative z-10 flex items-center gap-2",children:u.isPending?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] animate-spin",children:"refresh"}),"Signing in..."]}):"Sign in"})]})})]})]})})]})}const Cc={listAlerts:async r=>(await ze.get("/monitoring/alerts",{params:r})).data,getAlert:async r=>(await ze.get(`/monitoring/alerts/${r}`)).data,acknowledgeAlert:async r=>{await ze.post(`/monitoring/alerts/${r}/acknowledge`)},resolveAlert:async r=>{await ze.post(`/monitoring/alerts/${r}/resolve`)},getMetrics:async()=>(await ze.get("/monitoring/metrics")).data},Xd={listDisks:async()=>(await ze.get("/storage/disks")).data.disks||[],syncDisks:async()=>(await ze.post("/storage/disks/sync")).data,listVolumeGroups:async()=>(await ze.get("/storage/volume-groups")).data.volume_groups||[],listRepositories:async()=>(await ze.get("/storage/repositories")).data.repositories||[],getRepository:async r=>(await ze.get(`/storage/repositories/${r}`)).data,createRepository:async r=>(await ze.post("/storage/repositories",r)).data,deleteRepository:async r=>{await ze.delete(`/storage/repositories/${r}`)}},sn={listPools:async()=>(await ze.get("/storage/zfs/pools")).data.pools||[],getPool:async r=>(await ze.get(`/storage/zfs/pools/${r}`)).data,createPool:async r=>(await ze.post("/storage/zfs/pools",r)).data,deletePool:async r=>{await ze.delete(`/storage/zfs/pools/${r}`)},addSpareDisk:async(r,t)=>{await ze.post(`/storage/zfs/pools/${r}/spare`,{disks:t})},listDatasets:async r=>(await ze.get(`/storage/zfs/pools/${r}/datasets`)).data.datasets||[],createDataset:async(r,t)=>(await ze.post(`/storage/zfs/pools/${r}/datasets`,t)).data,deleteDataset:async(r,t)=>{await ze.delete(`/storage/zfs/pools/${r}/datasets/${encodeURIComponent(t)}`)},getARCStats:async()=>(await ze.get("/storage/zfs/arc/stats")).data},$u={listSnapshots:async r=>{const t=r?`?dataset=${encodeURIComponent(r)}`:"";return(await ze.get(`/storage/zfs/snapshots${t}`)).data.snapshots||[]},createSnapshot:async r=>{await ze.post("/storage/zfs/snapshots",r)},deleteSnapshot:async(r,t)=>{const s=t?"?recursive=true":"";await ze.delete(`/storage/zfs/snapshots/${encodeURIComponent(r)}${s}`)},rollbackSnapshot:async(r,t)=>{await ze.post(`/storage/zfs/snapshots/${encodeURIComponent(r)}/rollback`,{force:t||!1})},cloneSnapshot:async(r,t)=>{await ze.post(`/storage/zfs/snapshots/${encodeURIComponent(r)}/clone`,t)}},eh={listSchedules:async()=>(await ze.get("/storage/zfs/snapshot-schedules")).data.schedules||[],getSchedule:async r=>(await ze.get(`/storage/zfs/snapshot-schedules/${r}`)).data,createSchedule:async r=>(await ze.post("/storage/zfs/snapshot-schedules",r)).data,updateSchedule:async(r,t)=>(await ze.put(`/storage/zfs/snapshot-schedules/${r}`,t)).data,deleteSchedule:async r=>{await ze.delete(`/storage/zfs/snapshot-schedules/${r}`)},toggleSchedule:async(r,t)=>{await ze.post(`/storage/zfs/snapshot-schedules/${r}/toggle`,{enabled:t})}},th={listTasks:async r=>{const t=r?`?direction=${r}`:"";return(await ze.get(`/storage/zfs/replication-tasks${t}`)).data.tasks||[]},getTask:async r=>(await ze.get(`/storage/zfs/replication-tasks/${r}`)).data,createTask:async r=>(await ze.post("/storage/zfs/replication-tasks",r)).data,updateTask:async(r,t)=>(await ze.put(`/storage/zfs/replication-tasks/${r}`,t)).data,deleteTask:async r=>{await ze.delete(`/storage/zfs/replication-tasks/${r}`)}},ao={listNetworkInterfaces:async()=>(await ze.get("/system/interfaces")).data.interfaces||[],updateNetworkInterface:async(r,t)=>(await ze.put(`/system/interfaces/${r}`,t)).data.interface,getNTPSettings:async()=>(await ze.get("/system/ntp")).data.settings,saveNTPSettings:async r=>{await ze.post("/system/ntp",r)},listServices:async()=>(await ze.get("/system/services")).data.services||[],restartService:async r=>{await ze.post(`/system/services/${r}/restart`)},getSystemLogs:async(r=30)=>(await ze.get(`/system/logs?limit=${r}`)).data.logs||[],getNetworkThroughput:async(r="5m")=>(await ze.get(`/system/network/throughput?duration=${r}`)).data.data||[],getManagementIPAddress:async()=>(await ze.get("/system/management-ip")).data.ip_address};function fr(r,t=2){if(r===0)return"0 Bytes";const s=1024,n=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],l=Math.floor(Math.log(r)/Math.log(s));return parseFloat((r/Math.pow(s,l)).toFixed(n))+" "+o[l]}function sS(r){const t=new Date,s=typeof r=="string"?new Date(r):r,n=Math.floor((t.getTime()-s.getTime())/1e3);return n<60?"just now":n<3600?`${Math.floor(n/60)} minutes ago`:n<86400?`${Math.floor(n/3600)} hours ago`:n<604800?`${Math.floor(n/86400)} days ago`:s.toLocaleDateString()}const tg=[{id:"1",name:"Daily Backup: VM-Cluster-01",type:"Replication",progress:45,speed:"145 MB/s",status:"running",eta:"1h 12m"},{id:"2",name:"ZFS Scrub: Pool-01",type:"Maintenance",progress:78,speed:"1.2 GB/s",status:"running"}];function aS(){const[r,t]=Ce.useState("jobs"),[s,n]=Ce.useState([]),o=5,{data:l=[],isLoading:d,refetch:c}=dt({queryKey:["system-logs"],queryFn:()=>ao.getSystemLogs(30),refetchInterval:600*1e3}),{data:u}=dt({queryKey:["health"],queryFn:async()=>(await ze.get("/health")).data,refetchInterval:o*1e3,staleTime:o*1e3*2,refetchOnWindowFocus:!1,refetchOnMount:!1,notifyOnChangeProps:["data","error"],structuralSharing:(M,V)=>JSON.stringify(M)===JSON.stringify(V)?M:V}),{data:h}=dt({queryKey:["metrics"],queryFn:Cc.getMetrics,refetchInterval:o*1e3,staleTime:o*1e3*2,refetchOnWindowFocus:!1,refetchOnMount:!1,notifyOnChangeProps:["data","error"],structuralSharing:(M,V)=>JSON.stringify(M)===JSON.stringify(V)?M:V}),{data:m}=dt({queryKey:["alerts","dashboard"],queryFn:()=>Cc.listAlerts({is_acknowledged:!1,limit:10}),refetchInterval:o*1e3,staleTime:o*1e3*2,refetchOnWindowFocus:!1,refetchOnMount:!1,notifyOnChangeProps:["data","error"],structuralSharing:(M,V)=>JSON.stringify(M)===JSON.stringify(V)?M:V}),{data:x=[]}=dt({queryKey:["storage","repositories"],queryFn:Xd.listRepositories,staleTime:60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,notifyOnChangeProps:["data","error"],structuralSharing:(M,V)=>JSON.stringify(M)===JSON.stringify(V)?M:V}),{days:y,hours:p,minutes:v}=Ce.useMemo(()=>{const M=h?.system?.uptime_seconds||0;return{days:Math.floor(M/86400),hours:Math.floor(M%86400/3600),minutes:Math.floor(M%3600/60)}},[h?.system?.uptime_seconds]),{totalStorage:N,usedStorage:B,storagePercent:g}=Ce.useMemo(()=>{const M=Array.isArray(x)?x.reduce((ne,Z)=>ne+(Z?.size_bytes||0),0):0,V=Array.isArray(x)?x.reduce((ne,Z)=>ne+(Z?.used_bytes||0),0):0,T=M>0?V/M*100:0;return{totalStorage:M,usedStorage:V,storagePercent:T}},[x]),{data:j=[]}=dt({queryKey:["network-throughput"],queryFn:()=>ao.getNetworkThroughput("5m"),refetchInterval:5*1e3});Ce.useEffect(()=>{if(j.length>0){const M=j.slice(-30).map(V=>({time:V.time,inbound:Math.round(V.inbound),outbound:Math.round(V.outbound)}));n(M)}},[j]);const _=Ce.useMemo(()=>{if(s.length===0)return{inbound:0,outbound:0,total:0};const M=s[s.length-1];return{inbound:M.inbound,outbound:M.outbound,total:M.inbound+M.outbound}},[s]),w=Ce.useMemo(()=>s.length===0?0:Math.max(...s.map(M=>M.inbound+M.outbound)),[s]),{systemStatus:L,isHealthy:K}=Ce.useMemo(()=>{const M=u?.status==="healthy"?"System Healthy":"System Degraded",V=u?.status==="healthy";return{systemStatus:M,isHealthy:V}},[u?.status]);return e.jsxs("div",{className:"h-full bg-background-dark text-white",children:[e.jsx("header",{className:"flex-none px-6 py-5 border-b border-border-dark bg-background-dark/95 backdrop-blur z-10",children:e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-3 max-w-[1600px] mx-auto",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-white text-3xl font-black tracking-tight",children:"System Monitor"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Real-time telemetry, storage health, and system event logs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-card-dark rounded-lg border border-border-dark",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[K&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),!K&&e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-yellow-500"})]}),e.jsx("span",{className:`text-xs font-medium ${K?"text-emerald-400":"text-yellow-400"}`,children:L})]}),e.jsxs("button",{className:"flex items-center gap-2 h-10 px-4 bg-card-dark hover:bg-[#233648] border border-border-dark text-white text-sm font-bold rounded-lg transition-colors",children:[e.jsx(Cn,{className:"h-4 w-4"}),e.jsxs("span",{children:["Refresh: ",o,"s"]})]})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6",children:e.jsxs("div",{className:"flex flex-col gap-6 max-w-[1600px] mx-auto pb-10",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"CPU Load"}),e.jsx(e4,{className:"text-text-secondary w-5 h-5"})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsxs("p",{className:"text-white text-3xl font-bold",children:[h?.system?.cpu_usage_percent?.toFixed(0)||0,"%"]}),e.jsxs("span",{className:"text-emerald-500 text-sm font-medium mb-1 flex items-center",children:[e.jsx(t4,{className:"w-4 h-4 mr-1"}),"2%"]})]}),e.jsx("div",{className:"h-1.5 w-full bg-[#233648] rounded-full mt-3 overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${h?.system?.cpu_usage_percent||0}%`}})})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"RAM Usage"}),e.jsx(r4,{className:"text-text-secondary w-5 h-5"})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsx("p",{className:"text-white text-3xl font-bold",children:fr(h?.system?.memory_used_bytes||0,1)}),e.jsxs("span",{className:"text-text-secondary text-xs mb-2",children:["/ ",fr(h?.system?.memory_total_bytes||0,1)]})]}),e.jsx("div",{className:"h-1.5 w-full bg-[#233648] rounded-full mt-3 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500 rounded-full transition-all",style:{width:`${h?.system?.memory_usage_percent||0}%`}})})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Storage Status"}),e.jsx(su,{className:"text-emerald-500 w-5 h-5"})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsx("p",{className:"text-white text-3xl font-bold",children:"Online"}),e.jsx("span",{className:"text-text-secondary text-sm font-medium mb-1",children:"No Errors"})]}),e.jsxs("div",{className:"flex gap-1 mt-3",children:[e.jsx("div",{className:"h-1.5 flex-1 bg-emerald-500 rounded-l-full"}),e.jsx("div",{className:"h-1.5 flex-1 bg-emerald-500"}),e.jsx("div",{className:"h-1.5 flex-1 bg-emerald-500"}),e.jsx("div",{className:"h-1.5 flex-1 bg-emerald-500 rounded-r-full"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"System Uptime"}),e.jsx(Ec,{className:"text-text-secondary w-5 h-5"})]}),e.jsx("div",{className:"mt-1",children:e.jsxs("p",{className:"text-white text-3xl font-bold",children:[y,"d ",p,"h ",v,"m"]})}),e.jsx("p",{className:"text-text-secondary text-xs mt-3",children:"Last reboot: Manual Patching"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"xl:col-span-2 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Network Throughput"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Inbound vs Outbound (eth0)"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-white text-2xl font-bold leading-tight",children:[(_.total/1e3).toFixed(1)," Gbps"]}),e.jsxs("p",{className:"text-emerald-500 text-sm",children:["Peak: ",(w/1e3).toFixed(1)," Gbps"]})]})]}),e.jsx("div",{className:"h-[200px] w-full",children:e.jsx(Cl,{width:"100%",height:"100%",children:e.jsxs(ky,{data:s,margin:{top:5,right:10,left:0,bottom:0},children:[e.jsx(Nc,{strokeDasharray:"3 3",stroke:"#324d67",opacity:.3}),e.jsx(Bc,{dataKey:"time",stroke:"#92adc9",style:{fontSize:"11px"},tick:{fill:"#92adc9"}}),e.jsx(jc,{stroke:"#92adc9",style:{fontSize:"11px"},tick:{fill:"#92adc9"},label:{value:"Mbps",angle:-90,position:"insideLeft",fill:"#92adc9",style:{fontSize:"11px"}}}),e.jsx(Sl,{contentStyle:{backgroundColor:"#1a2632",border:"1px solid #324d67",borderRadius:"8px",color:"#fff"},labelStyle:{color:"#92adc9",fontSize:"12px"},itemStyle:{color:"#fff",fontSize:"12px"},formatter:M=>[`${M} Mbps`,""]}),e.jsx(Qh,{wrapperStyle:{fontSize:"12px",color:"#92adc9"},iconType:"line"}),e.jsx(Lh,{type:"monotone",dataKey:"inbound",stroke:"#137fec",strokeWidth:2,dot:!1,name:"Inbound",activeDot:{r:4}}),e.jsx(Lh,{type:"monotone",dataKey:"outbound",stroke:"#10b981",strokeWidth:2,dot:!1,name:"Outbound",activeDot:{r:4}})]})})})]}),e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Storage Capacity"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Repository usage"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-white text-2xl font-bold leading-tight",children:[g.toFixed(1),"%"]}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Target: <90%"})]})]}),e.jsx("div",{className:"h-[150px] w-full relative",children:e.jsx("div",{className:"w-full h-full bg-[#111a22] rounded flex items-center justify-center",children:e.jsx("div",{className:"w-full px-4",children:e.jsx("div",{className:"w-full bg-[#233648] h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full transition-all",style:{width:`${g}%`}})})})})})]})]}),e.jsx("div",{className:"flex flex-col gap-6",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 h-full shadow-sm flex flex-col",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Storage Overview"}),e.jsxs("span",{className:"bg-[#233648] text-white text-xs px-2 py-1 rounded border border-border-dark",children:[x?.length||0," Repos"]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-border-dark",children:[e.jsxs("div",{className:"flex justify-between text-sm text-text-secondary",children:[e.jsx("span",{children:"Total Capacity"}),e.jsx("span",{className:"text-white font-bold",children:fr(N)})]}),e.jsx("div",{className:"w-full bg-[#233648] h-2 rounded-full mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full transition-all",style:{width:`${g}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-text-secondary mt-1",children:[e.jsxs("span",{children:["Used: ",fr(B)]}),e.jsxs("span",{children:["Free: ",fr(N-B)]})]})]})]})})]}),e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-sm overflow-hidden flex flex-col h-[400px]",children:[e.jsxs("div",{className:"flex border-b border-border-dark bg-[#161f29]",children:[e.jsxs("button",{onClick:()=>t("jobs"),className:`px-6 py-4 text-sm font-bold transition-colors ${r==="jobs"?"text-primary border-b-2 border-primary bg-card-dark":"text-text-secondary hover:text-white"}`,children:["Active Jobs"," ",tg.length>0&&e.jsx("span",{className:"ml-2 bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs",children:tg.length})]}),e.jsx("button",{onClick:()=>t("logs"),className:`px-6 py-4 text-sm font-medium transition-colors ${r==="logs"?"text-primary border-b-2 border-primary bg-card-dark":"text-text-secondary hover:text-white"}`,children:"System Logs"}),e.jsx("button",{onClick:()=>t("alerts"),className:`px-6 py-4 text-sm font-medium transition-colors ${r==="alerts"?"text-primary border-b-2 border-primary bg-card-dark":"text-text-secondary hover:text-white"}`,children:"Alerts History"}),e.jsx("div",{className:"flex-1 flex justify-end items-center px-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(Wm,{className:"absolute left-2 top-1.5 text-text-secondary w-4 h-4"}),e.jsx("input",{className:"bg-[#111a22] border border-border-dark rounded-md py-1 pl-8 pr-3 text-sm text-white focus:outline-none focus:border-primary w-48 transition-all",placeholder:"Search logs...",type:"text"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r==="jobs"&&e.jsx("div",{className:"p-0",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{className:"bg-[#1a2632] text-xs uppercase text-text-secondary font-medium sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Job Name"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Type"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark w-1/3",children:"Progress"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Speed"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Status"})]})}),e.jsx("tbody",{className:"text-sm divide-y divide-border-dark",children:tg.map(M=>e.jsxs("tr",{className:"group hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 font-medium text-white",children:M.name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.type}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-full bg-[#111a22] rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full relative overflow-hidden",style:{width:`${M.progress}%`},children:e.jsx("div",{className:"absolute inset-0 bg-white/20 animate-pulse"})})}),e.jsxs("span",{className:"text-xs font-mono text-white",children:[M.progress,"%"]})]}),M.eta&&e.jsxs("p",{className:"text-[10px] text-text-secondary mt-1",children:["ETA: ",M.eta]})]}),e.jsx("td",{className:"px-6 py-4 text-text-secondary font-mono",children:M.speed}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-primary/20 text-primary",children:"Running"})})]},M.id))})]})}),r==="logs"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-6 py-2 bg-[#161f29] border-y border-border-dark flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs uppercase text-text-secondary font-bold tracking-wider",children:"Recent System Events"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>c(),disabled:d,className:"text-xs text-primary hover:text-white transition-colors flex items-center gap-1 disabled:opacity-50",children:[e.jsx(Cn,{size:14,className:d?"animate-spin":""}),"Refresh"]}),e.jsx("button",{className:"text-xs text-primary hover:text-white transition-colors",children:"View All Logs"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar bg-[#111a22]",children:d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("span",{className:"text-text-secondary",children:"Loading logs..."})}):l.length===0?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("span",{className:"text-text-secondary",children:"No logs available"})}):e.jsx("table",{className:"w-full text-left border-collapse",children:e.jsx("tbody",{className:"text-sm font-mono divide-y divide-border-dark/50",children:l.map((M,V)=>e.jsxs("tr",{className:"group hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-2 text-text-secondary w-32 whitespace-nowrap",children:M.time}),e.jsx("td",{className:"px-6 py-2 w-24",children:e.jsx("span",{className:M.level==="INFO"||M.level==="NOTICE"||M.level==="DEBUG"?"text-emerald-500":M.level==="WARN"?"text-yellow-500":"text-red-500",children:M.level})}),e.jsx("td",{className:"px-6 py-2 w-32 text-white",children:M.source}),e.jsx("td",{className:"px-6 py-2 text-text-secondary truncate max-w-lg",children:M.message})]},V))})})})]}),r==="alerts"&&e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar bg-[#111a22] p-6",children:m?.alerts&&m.alerts.length>0?e.jsx("div",{className:"space-y-3",children:m.alerts.map(M=>e.jsx("div",{className:"bg-[#1a2632] border border-border-dark rounded-lg p-4 hover:bg-[#233648] transition-colors",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Eh,{className:`w-4 h-4 ${M.severity==="critical"?"text-red-500":M.severity==="warning"?"text-yellow-500":"text-blue-500"}`}),e.jsx("h4",{className:"text-white font-medium",children:M.title}),e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${M.severity==="critical"?"bg-red-500/20 text-red-400":M.severity==="warning"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.severity})]}),e.jsx("p",{className:"text-text-secondary text-sm",children:M.message}),e.jsx("p",{className:"text-text-secondary text-xs mt-2 font-mono",children:new Date(M.created_at).toLocaleString()})]})})},M.id))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(su,{className:"w-12 h-12 text-emerald-500 mx-auto mb-4"}),e.jsx("p",{className:"text-text-secondary",children:"No alerts"})]})})]})]})]})})]})}function nS({poolId:r,onDeleteDataset:t,onCreateDataset:s}){const n=["storage","zfs","pools",r,"datasets"],{data:o=[],isLoading:l}=dt({queryKey:n,queryFn:()=>sn.listDatasets(r),refetchOnWindowFocus:!0,refetchOnMount:!0,staleTime:0,refetchInterval:1e3});return l?e.jsx("tr",{className:"bg-[#151d26]",children:e.jsx("td",{colSpan:7,className:"py-3 px-5 pl-10 text-white/60 text-xs",children:"Loading datasets..."})}):o.length===0?e.jsx("tr",{className:"bg-[#151d26]",children:e.jsx("td",{colSpan:7,className:"py-3 px-5 pl-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-white/60 text-xs",children:"No datasets found"}),e.jsxs("button",{onClick:d=>{d.stopPropagation(),s(r)},className:"px-3 py-1.5 bg-primary/20 hover:bg-primary/30 text-primary text-xs font-medium rounded-lg border border-primary/30 transition-colors flex items-center gap-1.5",title:"Create Dataset",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Create Dataset"]})]})})}):e.jsx(e.Fragment,{children:o.map(d=>{const c=d.quota>0?d.used_bytes/d.quota*100:d.available_bytes>0?d.used_bytes/(d.used_bytes+d.available_bytes)*100:0,u=d.name.includes("/")?d.name.split("/").slice(1).join("/"):d.name;return e.jsxs("tr",{className:"bg-[#151d26] hover:bg-[#1a242f] transition-colors",children:[e.jsx("td",{className:"py-3 px-5"}),e.jsx("td",{className:"py-3 px-5 pl-10",children:e.jsxs("div",{className:"flex items-center gap-3 relative before:content-[''] before:absolute before:-left-4 before:top-1/2 before:-translate-y-1/2 before:w-3 before:h-px before:bg-border-dark before:opacity-50",children:[e.jsx("span",{className:"material-symbols-outlined text-white/70 text-[18px]",children:d.type==="volume"?"storage":d.type==="snapshot"?"camera":"folder"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-white",children:u}),d.mount_point&&d.mount_point!=="none"&&d.mount_point!=="-"&&e.jsx("span",{className:"text-xs text-white/50",children:d.mount_point}),d.type==="volume"&&e.jsx("span",{className:"text-xs text-primary/70",children:"Volume (Block Device)"})]})]})}),e.jsx("td",{className:"py-3 px-5",children:e.jsx("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold ${d.type==="volume"?"bg-blue-500/20 text-blue-400 border border-blue-500/30":d.mount_point&&d.mount_point!=="none"&&d.mount_point!=="-"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-gray-500/20 text-gray-400 border border-gray-500/30"}`,children:d.type==="volume"?"VOLUME":d.mount_point&&d.mount_point!=="none"&&d.mount_point!=="-"?"MOUNTED":"UNMOUNTED"})}),e.jsx("td",{className:"py-3 px-5",children:e.jsxs("div",{className:"flex flex-col gap-1 w-32",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-white font-medium",children:fr(d.used_bytes,1)}),e.jsx("span",{className:"text-white/80 font-medium",children:fr(d.available_bytes,1)})]}),e.jsx("div",{className:"w-full bg-[#233648] rounded-full h-1.5",children:e.jsx("div",{className:"h-1.5 rounded-full bg-primary",style:{width:`${Math.min(c,100)}%`}})})]})}),e.jsx("td",{className:"py-3 px-5 text-white/80 text-xs",children:d.quota>0?fr(d.quota,1):"Unlimited"}),e.jsx("td",{className:"py-3 px-5 text-white/80 text-xs",children:d.compression.toUpperCase()}),e.jsx("td",{className:"py-3 px-5 text-right",children:e.jsx("div",{className:"flex items-center gap-1 justify-end",children:e.jsx("button",{onClick:h=>{if(h.stopPropagation(),confirm(`Are you sure you want to delete dataset "${u}"? This action cannot be undone.`)){const m=d.name.includes("/")?d.name.split("/").slice(1).join("/"):d.name;t(r,m)}},className:"p-1 rounded-md hover:bg-red-500/20 text-red-400 hover:text-red-300 transition-colors",title:"Delete dataset",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})})})]},d.name)})})}function iS(){const[r,t]=Ce.useState(new Set),[s,n]=Ce.useState(null),[o,l]=Ce.useState(""),[d,c]=Ce.useState(!1),[u,h]=Ce.useState(!1),[m,x]=Ce.useState(!1),[y,p]=Ce.useState(null),[v,N]=Ce.useState([]),[B,g]=Ce.useState(!1),[j,_]=Ce.useState({name:"",type:"filesystem",compression:"lz4",quota:"",reservation:"",mount_point:""}),[w,L]=Ce.useState({name:"",description:"",raid_level:"stripe",disks:[],compression:"lz4",deduplication:!1,auto_expand:!1}),K=Nr(),{data:M=[],isLoading:V}=dt({queryKey:["storage","disks"],queryFn:Xd.listDisks}),{data:T=[],isLoading:ne}=dt({queryKey:["storage","repositories"],queryFn:Xd.listRepositories}),{data:Z=[],isLoading:U}=dt({queryKey:["storage","zfs","pools"],queryFn:sn.listPools,refetchInterval:3e3,staleTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0}),{data:q}=dt({queryKey:["storage","zfs","arc","stats"],queryFn:sn.getARCStats,refetchInterval:2e3,staleTime:0}),F=ft({mutationFn:Xd.syncDisks,onSuccess:async()=>{await K.invalidateQueries({queryKey:["storage","disks"]}),K.refetchQueries({queryKey:["storage","disks"]}),alert("Disk rescan completed!")},onError:G=>{console.error("Failed to rescan disks:",G),alert(G.response?.data?.error||"Failed to rescan disks")}}),le=ft({mutationFn:sn.createPool,onSuccess:async()=>{await K.invalidateQueries({queryKey:["storage","zfs","pools"]}),await K.refetchQueries({queryKey:["storage","zfs","pools"]}),await K.invalidateQueries({queryKey:["storage","disks"]}),c(!1),L({name:"",description:"",raid_level:"stripe",disks:[],compression:"lz4",deduplication:!1,auto_expand:!1}),alert("Pool created successfully!")},onError:G=>{console.error("Failed to create pool:",G),alert(G.response?.data?.error||"Failed to create pool")}}),ae=ft({mutationFn:({poolId:G,disks:me})=>sn.addSpareDisk(G,me),onSuccess:()=>{K.invalidateQueries({queryKey:["storage","zfs","pools"]}),K.invalidateQueries({queryKey:["storage","disks"]}),h(!1),N([]),alert("Spare disks added successfully!")},onError:G=>{console.error("Failed to add spare disks:",G),alert(G.response?.data?.error||"Failed to add spare disks")}}),se=ft({mutationFn:G=>sn.deletePool(G),onSuccess:async()=>{await K.invalidateQueries({queryKey:["storage","zfs","pools"]}),await K.refetchQueries({queryKey:["storage","zfs","pools"]}),await K.invalidateQueries({queryKey:["storage","disks"]}),n(null),alert("Pool destroyed successfully!")},onError:G=>{console.error("Failed to delete pool:",G),alert(G.response?.data?.error||"Failed to destroy pool")}}),fe=ft({mutationFn:({poolId:G,data:me})=>sn.createDataset(G,me),onSuccess:async(G,me)=>{t(be=>new Set(be).add(me.poolId)),x(!1),p(null),_({name:"",type:"filesystem",compression:"lz4",quota:"",reservation:"",mount_point:""}),K.invalidateQueries({queryKey:["storage","zfs","pools",me.poolId,"datasets"],exact:!0}),alert("Dataset created successfully!")},onError:G=>{console.error("Failed to create dataset:",G),alert(G.response?.data?.error||"Failed to create dataset")}}),ye=ft({mutationFn:({poolId:G,datasetName:me})=>sn.deleteDataset(G,me),onSuccess:async(G,me)=>{t(be=>new Set(be).add(me.poolId)),await K.invalidateQueries({queryKey:["storage","zfs","pools",me.poolId,"datasets"],exact:!0}),alert("Dataset deleted successfully!")},onError:G=>{console.error("Failed to delete dataset:",G),alert(G.response?.data?.error||"Failed to delete dataset")}}),_e=(G,me)=>{ye.mutate({poolId:G,datasetName:me})},xe=G=>{const me=Z.find(be=>be.id===G);me&&(p(me),x(!0))},D=[...Z,...T],$=D.reduce((G,me)=>G+(me.size_bytes||0),0),X=D.reduce((G,me)=>G+(me.used_bytes||0),0),te=$>0?X/$*100:0,J=D.filter(G=>{if("health_status"in G){const me=G.health_status?.toLowerCase()||"";return G.is_active&&me==="online"}return G.is_active}).length,H=D.filter(G=>{if("health_status"in G){const me=G.health_status?.toLowerCase()||"";return!G.is_active||me!=="online"}return!G.is_active}).length===0?"Optimal":"Degraded",re=Z.filter(G=>G.is_active&&G.health_status?.toLowerCase()==="online"),Ae=re.length>0?re.reduce((G,me)=>{if(me.compress_ratio&&me.compress_ratio>0){const He=me.deduplication?1.3:1;return G+me.compress_ratio*He}const Ue={lz4:1.5,zstd:2.5,gzip:2,"gzip-1":1.8,"gzip-9":2.5,off:1}[me.compression?.toLowerCase()||"lz4"]||1.5,Re=me.deduplication?1.3:1;return G+Ue*Re},0)/re.length:1,oe=re.some(G=>G.compression&&G.compression.toLowerCase()!=="off"),ce=re.some(G=>G.deduplication),Se=re.find(G=>G.compression&&G.compression.toLowerCase()!=="off")?.compression?.toUpperCase()||"LZ4",z=q?.hit_ratio??0,ie=q?.cache_usage??0,W=q?.cache_size??0,Q=q?.cache_max??0,I=G=>{const me=new Set(r);me.has(G)?me.delete(G):me.add(G),t(me)},k=D.filter(G=>G.name.toLowerCase().includes(o.toLowerCase()));return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background-dark",children:[e.jsx("header",{className:"flex-shrink-0 px-8 py-6 border-b border-border-dark bg-card-dark/50 backdrop-blur-sm z-10",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto w-full flex flex-col gap-4",children:[e.jsxs("nav",{className:"flex items-center text-sm font-medium text-text-secondary",children:[e.jsx(ba,{to:"/",className:"hover:text-primary transition-colors",children:"Home"}),e.jsx("span",{className:"mx-2",children:"/"}),e.jsx("span",{className:"text-white",children:"Storage Management"})]}),e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h1",{className:"text-3xl font-extrabold text-white tracking-tight",children:"Storage Pools"}),e.jsx("p",{className:"text-text-secondary",children:"Manage ZFS pools, datasets, and physical disks topology."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>F.mutate(),disabled:F.isPending,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-border-dark bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-colors disabled:opacity-50",children:[e.jsx("span",{className:`material-symbols-outlined text-[20px] ${F.isPending?"animate-spin":""}`,children:"refresh"}),F.isPending?"Rescanning...":"Rescan Disks"]}),e.jsxs("button",{onClick:async()=>{g(!0);try{await K.invalidateQueries({queryKey:["storage","zfs","pools"]}),await K.refetchQueries({queryKey:["storage","zfs","pools"]}),await new Promise(G=>setTimeout(G,300)),alert("Pools refreshed successfully!")}catch(G){console.error("Failed to refresh pools:",G),alert("Failed to refresh pools. Please try again.")}finally{g(!1)}},disabled:U||B,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-border-dark bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Refresh pools list from database",children:[e.jsx("span",{className:`material-symbols-outlined text-[20px] ${U||B?"animate-spin":""}`,children:"sync"}),U||B?"Refreshing...":"Refresh Pools"]}),e.jsxs("button",{onClick:()=>c(!0),className:"relative flex items-center gap-2 px-4 py-2 rounded-lg border border-primary/30 bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsxs("span",{className:"relative flex items-center gap-2 z-10",children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"add_circle"}),"Create Pool"]})]})]})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-8 custom-scrollbar",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto w-full flex flex-col gap-8 pb-10",children:[e.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-card-dark p-5 rounded-xl border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("p",{className:"text-text-secondary text-sm font-semibold uppercase tracking-wider",children:"Total Capacity"}),e.jsx("span",{className:"material-symbols-outlined text-text-secondary",children:"database"})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-2xl font-bold text-white",children:fr($,1)}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Raw"})]}),e.jsx("div",{className:"mt-3 w-full bg-[#233648] rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-1.5 rounded-full",style:{width:`${Math.min(te,100)}%`}})}),e.jsxs("p",{className:"mt-2 text-xs text-text-secondary",children:[te.toFixed(0),"% Used (",fr(X,1),")"]})]}),e.jsxs("div",{className:"bg-card-dark p-5 rounded-xl border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("p",{className:"text-white/70 text-sm font-semibold uppercase tracking-wider",children:"Health Status"}),e.jsx("span",{className:`material-symbols-outlined ${H==="Optimal"?"text-emerald-500":"text-orange-500"}`,children:H==="Optimal"?"check_circle":"warning"})]}),e.jsx("div",{className:"flex items-baseline gap-2",children:e.jsx("h3",{className:`text-2xl font-bold ${H==="Optimal"?"text-emerald-500":"text-orange-500"}`,children:H})}),e.jsxs("p",{className:"mt-2 text-xs text-white/80",children:[J," pool",J!==1?"s":""," online"]}),H==="Optimal"&&e.jsx("p",{className:"text-xs text-emerald-500 mt-1 font-medium",children:"Last scrub: N/A"})]}),e.jsxs("div",{className:"bg-card-dark p-5 rounded-xl border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("p",{className:"text-white/70 text-sm font-semibold uppercase tracking-wider",children:"Efficiency"}),e.jsx("span",{className:"material-symbols-outlined text-white/70",children:"compress"})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("h3",{className:"text-2xl font-bold text-white",children:[Ae,"x"]}),e.jsx("span",{className:"text-xs text-white/70",children:"Ratio"})]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[oe&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-blue-500/10 text-blue-500 text-[10px] font-bold",children:Se}),ce&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-purple-500/10 text-purple-500 text-[10px] font-bold",children:"DEDUP ON"}),!oe&&!ce&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-gray-500/10 text-gray-500 text-[10px] font-bold",children:"NO COMPRESSION"})]})]}),e.jsxs("div",{className:"bg-card-dark p-5 rounded-xl border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("p",{className:"text-white/70 text-sm font-semibold uppercase tracking-wider",children:"ARC Hit Ratio"}),e.jsx("span",{className:"material-symbols-outlined text-white/70",children:"memory"})]}),e.jsx("div",{className:"flex items-baseline gap-2",children:e.jsxs("h3",{className:"text-2xl font-bold text-white",children:[z.toFixed(1),"%"]})}),e.jsxs("p",{className:"mt-2 text-xs text-white/80",children:["Cache Usage: ",Q>0?`${fr(W,1)} / ${fr(Q,1)} (${ie.toFixed(1)}%)`:"N/A"]}),e.jsxs("div",{className:"mt-2 flex gap-1",children:[e.jsx("div",{className:"h-1 flex-1 bg-emerald-500 rounded-full"}),e.jsx("div",{className:"h-1 flex-1 bg-emerald-500 rounded-full"}),e.jsx("div",{className:"h-1 flex-1 bg-emerald-500 rounded-full"}),e.jsx("div",{className:"h-1 flex-1 bg-emerald-500/30 rounded-full"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Active Pools"}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-white/70 text-[20px]",children:"search"}),e.jsx("input",{className:"pl-10 pr-4 py-1.5 bg-[#233648] border border-border-dark rounded-lg text-sm text-white focus:ring-2 focus:ring-primary focus:border-transparent outline-none w-64 placeholder-white/50",placeholder:"Search datasets...",type:"text",value:o,onChange:G=>l(G.target.value)})]})})]}),e.jsxs("div",{className:"bg-card-dark rounded-xl border border-border-dark overflow-hidden shadow-sm",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#1e2832] border-b border-border-dark",children:[e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70 w-10"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70",children:"Name"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70",children:"Status"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70",children:"Used / Avail"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70",children:"Topology"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70",children:"Compression"}),e.jsx("th",{className:"py-3 px-5 text-xs font-semibold uppercase tracking-wider text-white/70 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:ne||U?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"py-8 px-5 text-center text-white/80",children:"Loading pools..."})}):k.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"py-8 px-5 text-center text-white/80",children:"No pools found"})}):k.map(G=>{const me=r.has(G.id),be=G.size_bytes>0?G.used_bytes/G.size_bytes*100:0,Ue=G.size_bytes-G.used_bytes,Re="raid_level"in G,He=Re&&G.health_status?.toLowerCase()||"online",Ve=G.is_active&&(He==="online"||He===""),it=Ve?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-orange-500/20 text-orange-400 border-orange-500/30";return e.jsxs($B.Fragment,{children:[e.jsxs("tr",{className:"group hover:bg-white/5 transition-colors cursor-pointer",onClick:()=>I(G.id),children:[e.jsx("td",{className:"py-4 px-5",children:e.jsx("span",{className:`material-symbols-outlined text-[20px] text-white transition-transform ${me?"rotate-90":""}`,children:"arrow_right"})}),e.jsx("td",{className:"py-4 px-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`material-symbols-outlined ${Ve?"text-primary":"text-orange-500"}`,children:Ve?"dns":"warning"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-bold text-white block",children:G.name}),e.jsx("span",{className:"text-xs text-white/70",children:Re?`ZFS ${G.raid_level.toUpperCase()}`:G.mount_point||"Not mounted"})]})]})}),e.jsx("td",{className:"py-4 px-5",children:e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-bold border ${it}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Ve?"bg-emerald-500":"bg-orange-500 animate-pulse"}`}),Re?He.toUpperCase():Ve?"ONLINE":"DEGRADED"]})}),e.jsx("td",{className:"py-4 px-5",children:e.jsxs("div",{className:"flex flex-col gap-1 w-32",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-white font-medium",children:fr(G.used_bytes,1)}),e.jsx("span",{className:"text-white/80 font-medium",children:fr(Ue,1)})]}),e.jsx("div",{className:"w-full bg-[#233648] rounded-full h-1.5",children:e.jsx("div",{className:`h-1.5 rounded-full ${Ve?"bg-primary":"bg-orange-500"}`,style:{width:`${Math.min(be,100)}%`}})})]})}),e.jsx("td",{className:"py-4 px-5 text-white",children:Re?`${G.raid_level.toUpperCase()} (${G.disks.length} disks)`:G.volume_group||"N/A"}),e.jsx("td",{className:"py-4 px-5 text-white",children:Re?G.compression.toUpperCase():G.filesystem_type||"LZ4"}),e.jsx("td",{className:"py-4 px-5 text-right",children:e.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[Re&&e.jsx("button",{className:"p-1.5 rounded-md hover:bg-primary/20 text-primary hover:text-primary transition-colors",onClick:lt=>{lt.stopPropagation(),p(G),x(!0)},title:"Create Dataset",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"add"})}),e.jsx("button",{className:"p-1.5 rounded-md hover:bg-[#233648] text-white transition-colors",onClick:lt=>{lt.stopPropagation(),n(G)},children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"more_vert"})})]})})]}),me&&Re&&e.jsx(nS,{poolId:G.id,onDeleteDataset:_e,onCreateDataset:xe})]},G.id)})})]})}),e.jsxs("div",{className:"bg-[#1e2832] px-5 py-3 border-t border-border-dark flex justify-between items-center text-xs text-white/80",children:[e.jsxs("span",{children:["Showing ",k.length," active pool",k.length!==1?"s":""]}),e.jsx("button",{className:"hover:text-primary font-medium text-white/80",children:"View Archived Pools"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Physical Disks"}),e.jsx("button",{className:"text-primary text-sm font-bold hover:underline",children:"View All Disks"})]}),V?e.jsx("div",{className:"text-center py-8 text-white/80",children:"Loading disks..."}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:M.map(G=>{const me=G.health_status==="healthy"||G.health_status==="online",be=G.health_status==="faulted"||G.health_status==="error",Ue=G.is_used?66:0;return e.jsxs("div",{className:`bg-card-dark rounded-lg p-4 border ${be?"border-red-500/30 bg-red-900/10 hover:border-red-500":"border-border-dark hover:border-primary/50"} flex flex-col gap-3 transition-colors group cursor-pointer relative overflow-hidden`,children:[e.jsx("div",{className:"absolute top-0 right-0 p-2",children:e.jsx("div",{className:`w-2 h-2 rounded-full ${be?"bg-red-500 animate-pulse":me?"bg-emerald-500":"bg-blue-500"}`})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded ${be?"bg-red-100 dark:bg-red-900/20":"bg-[#233648]"} flex items-center justify-center`,children:e.jsx("span",{className:`material-symbols-outlined ${be?"text-red-500 group-hover:text-red-400":"text-white/70 group-hover:text-primary"} transition-colors`,children:be?"error":"hard_drive"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-bold text-white",children:G.device_path}),e.jsx("span",{className:`text-xs ${be?"text-red-500 font-bold":"text-white"}`,children:be?"FAULTED":`Slot ${G.id.slice(-1)}`})]})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-text-secondary",children:[e.jsxs("span",{children:[G.vendor||"Unknown"," ",G.model||""]}),e.jsx("span",{children:fr(G.size_bytes,1)})]}),G.attached_to_pool&&e.jsxs("div",{className:"text-xs text-primary font-medium",children:["Attached to pool: ",G.attached_to_pool]}),e.jsxs("div",{className:"flex gap-0.5 h-1.5 w-full rounded-full overflow-hidden bg-[#233648]",children:[e.jsx("div",{className:`${be?"bg-red-500 opacity-50":"bg-primary"}`,style:{width:`${Ue}%`}}),e.jsx("div",{className:"bg-transparent flex-1"})]}),e.jsxs("div",{className:"flex flex-col gap-0.5 mt-1",children:[e.jsx("span",{className:`text-[10px] font-medium ${be?"text-red-400":"text-emerald-400"}`,children:be?"FAULTED":"Healthy"}),e.jsx("span",{className:`text-[10px] ${G.is_used||G.attached_to_pool?"text-primary":"text-white/60"}`,children:G.is_used||G.attached_to_pool?"Provisioned":"Unprovisioned"})]})]})]},G.id)})})]})]})}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-30",onClick:()=>n(null)}),e.jsxs("div",{className:"fixed inset-y-0 right-0 w-96 bg-card-dark border-l border-border-dark shadow-2xl z-40 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("h3",{className:"text-lg font-bold text-white",children:[s.name," Properties"]}),e.jsx("button",{onClick:()=>n(null),className:"text-white/80 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined text-[24px]",children:"close"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-6 custom-scrollbar",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"info"}),e.jsx("span",{className:"text-sm font-bold text-primary",children:s.is_active&&s.health_status?.toLowerCase()==="online"?"Healthy":"Degraded"})]}),e.jsx("p",{className:"text-xs text-white/90 leading-relaxed mb-3",children:s.is_active&&s.health_status?.toLowerCase()==="online"?"This pool is operating normally.":"This pool has issues and requires attention."}),e.jsxs("div",{className:"mt-3 space-y-1.5 text-xs",children:[e.jsxs("p",{className:"text-white/80",children:["RAID Level: ",e.jsx("span",{className:"font-bold text-white ml-1",children:s.raid_level.toUpperCase()})]}),e.jsxs("p",{className:"text-white/80",children:["Data Disks: ",e.jsx("span",{className:"font-bold text-white ml-1",children:s.disks.length}),e.jsxs("span",{className:"text-white/60 ml-1",children:["(",s.disks.join(", "),")"]})]}),s.spare_disks&&s.spare_disks.length>0&&e.jsxs("p",{className:"text-white/80",children:["Spare Disks: ",e.jsx("span",{className:"font-bold text-white ml-1",children:s.spare_disks.length}),e.jsxs("span",{className:"text-white/60 ml-1",children:["(",s.spare_disks.join(", "),")"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Compression Level"}),e.jsxs("select",{defaultValue:s.compression,className:"w-full bg-[#233648] border border-border-dark rounded-lg px-3 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",children:[e.jsx("option",{value:"off",children:"Off"}),e.jsx("option",{value:"lz4",children:"LZ4 (Recommended)"}),e.jsx("option",{value:"zstd",children:"ZSTD"}),e.jsx("option",{value:"gzip",children:"GZIP"})]}),e.jsx("p",{className:"text-xs text-white/70 leading-relaxed",children:"Balances performance and storage efficiency."})]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-border-dark pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Deduplication"}),e.jsx("button",{className:`w-11 h-6 rounded-full relative transition-colors focus:outline-none focus:ring-2 focus:ring-primary ${s.deduplication?"bg-primary":"bg-[#233648]"}`,children:e.jsx("span",{className:`absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition-transform ${s.deduplication?"transform translate-x-5":"transform translate-x-0"}`})})]}),e.jsx("p",{className:"text-xs text-white/70 leading-relaxed",children:"Requires significant RAM. Use with caution."})]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-border-dark pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Auto-Expand"}),e.jsx("button",{className:`w-11 h-6 rounded-full relative transition-colors focus:outline-none focus:ring-2 focus:ring-primary ${s.auto_expand?"bg-primary":"bg-[#233648]"}`,children:e.jsx("span",{className:`absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition-transform ${s.auto_expand?"transform translate-x-5":"transform translate-x-0"}`})})]}),e.jsx("p",{className:"text-xs text-white/70 leading-relaxed",children:"Automatically grow pool when larger disks are added."})]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-border-dark pt-4",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Scrub Interval"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{className:"w-20 bg-[#233648] border border-border-dark rounded-lg px-3 py-2 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",type:"number",defaultValue:s.scrub_interval}),e.jsx("span",{className:"text-sm text-white/80 font-medium",children:"days"})]}),e.jsx("p",{className:"text-xs text-white/70 leading-relaxed",children:"Data integrity check interval."})]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-border-dark pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Spare Disks"}),e.jsxs("button",{onClick:()=>{h(!0),N([])},className:"px-3 py-1.5 text-xs font-bold text-primary border border-primary/30 rounded-lg hover:bg-primary/10 transition-colors flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Spare"]})]}),e.jsx("p",{className:"text-xs text-white/70 leading-relaxed",children:"Spare disks are automatically used to replace failed disks in the pool."}),s.spare_disks&&s.spare_disks.length>0&&e.jsx("div",{className:"mt-2 space-y-1",children:s.spare_disks.map(G=>e.jsxs("div",{className:"flex items-center gap-2 text-xs text-white/80 bg-[#233648] px-2 py-1 rounded",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px] text-primary",children:"hard_drive"}),e.jsx("span",{children:G})]},G))})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-border-dark bg-[#1e2832] flex gap-3",children:[e.jsxs("button",{className:"relative flex-1 px-4 py-2 rounded-lg border border-primary/30 bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsxs("span",{className:"relative flex items-center justify-center gap-2 z-10",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"save"}),"Save Changes"]})]}),e.jsx("button",{onClick:()=>n(null),className:"px-4 py-2 bg-card-dark border border-border-dark text-white text-sm font-bold rounded-lg hover:bg-[#233648] transition-colors",children:"Cancel"})]}),e.jsx("div",{className:"p-6 pt-0 bg-[#1e2832]",children:e.jsxs("button",{onClick:()=>{s&&confirm(`Are you sure you want to destroy pool "${s.name}"? This action cannot be undone and will delete all data in the pool.`)&&se.mutate(s.id)},disabled:se.isPending||!s,className:"w-full px-4 py-2 border border-red-500/30 text-red-500 hover:bg-red-500/10 text-sm font-bold rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:se.isPending?"hourglass_empty":"delete"}),se.isPending?"Destroying...":"Export / Destroy Pool"]})})]})]}),d&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Create ZFS Pool"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Create a new ZFS pool from available physical disks"})]}),e.jsx("button",{onClick:()=>c(!1),className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined text-[24px]",children:"close"})})]}),e.jsxs("form",{onSubmit:G=>{if(G.preventDefault(),!w.name||w.disks.length===0){alert("Please fill in all required fields and select at least one disk");return}const me={stripe:1,mirror:2,raidz:3,raidz2:4,raidz3:5};if(w.disks.lengthL({...w,name:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",placeholder:"e.g., backup-pool-01"}),e.jsx("p",{className:"text-xs text-white/70",children:"Unique name for the ZFS pool"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Description"}),e.jsx("textarea",{value:w.description,onChange:G=>L({...w,description:G.target.value}),rows:2,className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none resize-none",placeholder:"Optional description for this pool"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["RAID Level ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{required:!0,value:w.raid_level,onChange:G=>L({...w,raid_level:G.target.value,disks:[]}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white focus:ring-2 focus:ring-primary focus:border-transparent outline-none",children:[e.jsx("option",{value:"stripe",children:"Stripe (No redundancy, 1+ disks)"}),e.jsx("option",{value:"mirror",children:"Mirror (2+ disks, even number)"}),e.jsx("option",{value:"raidz",children:"RAIDZ (3+ disks, single parity)"}),e.jsx("option",{value:"raidz2",children:"RAIDZ2 (4+ disks, double parity)"}),e.jsx("option",{value:"raidz3",children:"RAIDZ3 (5+ disks, triple parity)"})]}),e.jsxs("p",{className:"text-xs text-white/70",children:[w.raid_level==="stripe"&&"No redundancy, maximum capacity",w.raid_level==="mirror"&&"50% capacity, full redundancy",w.raid_level==="raidz"&&"Single parity, good balance",w.raid_level==="raidz2"&&"Double parity, high reliability",w.raid_level==="raidz3"&&"Triple parity, maximum reliability"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["Select Disks ",e.jsx("span",{className:"text-red-500",children:"*"})]}),V?e.jsx("div",{className:"text-sm text-white/70",children:"Loading disks..."}):e.jsx("div",{className:"max-h-48 overflow-y-auto custom-scrollbar border border-border-dark rounded-lg bg-[#233648] p-3 space-y-2",children:M.filter(G=>!G.is_used).length===0?e.jsx("div",{className:"text-sm text-orange-400 bg-orange-500/10 border border-orange-500/30 rounded-lg p-3",children:"No available disks. All disks are in use."}):M.filter(G=>!G.is_used).map(G=>e.jsxs("label",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-[#1e2832] cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:w.disks.includes(G.device_path),onChange:me=>{me.target.checked?L({...w,disks:[...w.disks,G.device_path]}):L({...w,disks:w.disks.filter(be=>be!==G.device_path)})},className:"w-4 h-4 text-primary bg-[#233648] border-border-dark rounded focus:ring-primary"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:G.device_path}),e.jsxs("div",{className:"text-xs text-white/70",children:[G.vendor||"Unknown"," ",G.model||""," • ",fr(G.size_bytes,1)]})]})]},G.id))}),e.jsxs("p",{className:"text-xs text-white/70",children:["Selected: ",w.disks.length," disk(s). Minimum: ",w.raid_level==="stripe"?1:w.raid_level==="mirror"?2:w.raid_level==="raidz"?3:w.raid_level==="raidz2"?4:5]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Compression"}),e.jsxs("select",{value:w.compression,onChange:G=>L({...w,compression:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white focus:ring-2 focus:ring-primary focus:border-transparent outline-none",children:[e.jsx("option",{value:"off",children:"Off"}),e.jsx("option",{value:"lz4",children:"LZ4 (Recommended)"}),e.jsx("option",{value:"zstd",children:"ZSTD"}),e.jsx("option",{value:"gzip",children:"GZIP"})]}),e.jsx("p",{className:"text-xs text-white/70",children:"LZ4 provides good compression with minimal CPU overhead"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Deduplication"}),e.jsx("button",{type:"button",onClick:()=>L({...w,deduplication:!w.deduplication}),className:`w-11 h-6 rounded-full relative transition-colors focus:outline-none focus:ring-2 focus:ring-primary ${w.deduplication?"bg-primary":"bg-[#233648]"}`,children:e.jsx("span",{className:`absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition-transform ${w.deduplication?"transform translate-x-5":"transform translate-x-0"}`})})]}),e.jsx("p",{className:"text-xs text-white/70",children:"Requires significant RAM. Use with caution."})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Auto-Expand"}),e.jsx("button",{type:"button",onClick:()=>L({...w,auto_expand:!w.auto_expand}),className:`w-11 h-6 rounded-full relative transition-colors focus:outline-none focus:ring-2 focus:ring-primary ${w.auto_expand?"bg-primary":"bg-[#233648]"}`,children:e.jsx("span",{className:`absolute left-1 top-1 bg-white w-4 h-4 rounded-full transition-transform ${w.auto_expand?"transform translate-x-5":"transform translate-x-0"}`})})]}),e.jsx("p",{className:"text-xs text-white/70",children:"Automatically grow pool when larger disks are added"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:()=>c(!1),className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-border-dark bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:le.isPending||M.filter(G=>!G.is_used).length===0||w.disks.length===0,className:"relative flex items-center gap-2 px-4 py-2 rounded-lg border border-primary/30 bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsx("span",{className:"relative flex items-center gap-2 z-10",children:le.isPending?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"material-symbols-outlined text-[20px] animate-spin",children:"refresh"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"add_circle"}),"Create ZFS Pool"]})})]})]})]})]})}),m&&y&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Create Dataset"}),e.jsxs("p",{className:"text-sm text-text-secondary mt-1",children:["Create a new dataset in pool: ",y.name]})]}),e.jsx("button",{onClick:()=>{x(!1),p(null),_({name:"",type:"filesystem",compression:"lz4",quota:"",reservation:"",mount_point:""})},className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined text-[24px]",children:"close"})})]}),e.jsxs("form",{onSubmit:G=>{if(G.preventDefault(),!j.name){alert("Please enter a dataset name");return}if(j.type==="volume"&&(!j.quota||parseFloat(j.quota)<=0)){alert("Volume size (quota) is required and must be greater than 0");return}fe.mutate({poolId:y.id,data:{name:j.name,type:j.type,compression:j.compression||"lz4",quota:j.quota?parseInt(j.quota)*1024*1024*1024:-1,reservation:j.reservation?parseInt(j.reservation)*1024*1024*1024:0,mount_point:j.mount_point||void 0}})},className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["Dataset Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",required:!0,value:j.name,onChange:G=>_({...j,name:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",placeholder:"e.g., backup-data"}),e.jsxs("p",{className:"text-xs text-white/70",children:["Dataset will be created as: ",y.name,"/",j.name||"dataset-name"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["Type ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{required:!0,value:j.type,onChange:G=>_({...j,type:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white focus:ring-2 focus:ring-primary focus:border-transparent outline-none",children:[e.jsx("option",{value:"filesystem",children:"Filesystem"}),e.jsx("option",{value:"volume",children:"Volume (Block Device)"})]}),e.jsx("p",{className:"text-xs text-white/70",children:j.type==="filesystem"?"A filesystem dataset that can be mounted and used like a directory":"A volume that appears as a block device (like /dev/zvol/...)"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Compression"}),e.jsxs("select",{value:j.compression,onChange:G=>_({...j,compression:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white focus:ring-2 focus:ring-primary focus:border-transparent outline-none",children:[e.jsx("option",{value:"off",children:"Off"}),e.jsx("option",{value:"lz4",children:"LZ4 (Recommended)"}),e.jsx("option",{value:"zstd",children:"ZSTD"}),e.jsx("option",{value:"gzip",children:"GZIP"})]}),e.jsx("p",{className:"text-xs text-white/70",children:"LZ4 provides good compression with minimal CPU overhead"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:[j.type==="volume"?"Volume Size (GB)":"Quota (GB)"," ",j.type==="volume"&&e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"number",required:j.type==="volume",value:j.quota,onChange:G=>_({...j,quota:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",placeholder:j.type==="volume"?"e.g., 100":"Leave empty for unlimited",min:"1"}),e.jsx("p",{className:"text-xs text-white/70",children:j.type==="volume"?"Size of the volume in GB (required for volumes)":"Maximum space this filesystem can use. Leave empty for unlimited."})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Reservation (GB)"}),e.jsx("input",{type:"number",value:j.reservation,onChange:G=>_({...j,reservation:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",placeholder:"Leave empty for none",min:"0"}),e.jsx("p",{className:"text-xs text-white/70",children:"Guaranteed space reserved for this dataset"})]}),j.type==="filesystem"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Mount Point"}),e.jsx("input",{type:"text",value:j.mount_point,onChange:G=>_({...j,mount_point:G.target.value}),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2.5 text-sm text-white placeholder-white/50 focus:ring-2 focus:ring-primary focus:border-transparent outline-none",placeholder:"e.g., /mnt/backup-data (optional)"}),e.jsx("p",{className:"text-xs text-white/70",children:"Optional mount point. Leave empty for default location."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:()=>{x(!1),p(null),_({name:"",type:"filesystem",compression:"lz4",quota:"",reservation:"",mount_point:""})},className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-border-dark bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:fe.isPending,className:"relative flex items-center gap-2 px-4 py-2 rounded-lg border border-primary/30 bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsx("span",{className:"relative flex items-center gap-2 z-10",children:fe.isPending?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] animate-spin",children:"refresh"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"add_circle"}),"Create Dataset"]})})]})]})]})]})}),u&&s&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Add Spare Disks"}),e.jsxs("p",{className:"text-sm text-text-secondary mt-1",children:["Add spare disks to pool: ",s.name]})]}),e.jsx("button",{onClick:()=>{h(!1),N([])},className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined text-[24px]",children:"close"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"info"}),e.jsx("span",{className:"text-sm font-bold text-primary",children:"About Spare Disks"})]}),e.jsx("p",{className:"text-xs text-white/90 leading-relaxed",children:"Spare disks are automatically used to replace failed disks in the pool. They provide redundancy and help maintain pool health without manual intervention."})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"text-sm font-semibold text-white",children:["Select Spare Disks ",e.jsx("span",{className:"text-red-500",children:"*"})]}),V?e.jsx("div",{className:"text-sm text-white/70",children:"Loading disks..."}):M.filter(G=>!G.is_used).length===0?e.jsx("div",{className:"text-sm text-orange-400 bg-orange-500/10 border border-orange-500/30 rounded-lg p-3",children:"No available disks found. Please ensure disks are connected and rescanned."}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-64 overflow-y-auto custom-scrollbar",children:M.filter(G=>!G.is_used).map(G=>e.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg border cursor-pointer transition-colors ${v.includes(G.device_path)?"bg-primary/20 border-primary text-white":"bg-[#233648] border-border-dark text-white/80 hover:bg-[#2a3e50]"}`,onClick:()=>{N(me=>me.includes(G.device_path)?me.filter(be=>be!==G.device_path):[...me,G.device_path])},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:v.includes(G.device_path),onChange:()=>{N(me=>me.includes(G.device_path)?me.filter(be=>be!==G.device_path):[...me,G.device_path])},className:"form-checkbox h-4 w-4 text-primary rounded border-gray-300 focus:ring-primary bg-transparent"}),e.jsx("span",{className:"text-sm font-medium",children:G.device_path})]}),e.jsx("span",{className:"text-xs text-white/70",children:fr(G.size_bytes,1)})]},G.id))}),e.jsxs("p",{className:"text-xs text-white/70",children:["Selected: ",v.length," disk(s)"]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:()=>{h(!1),N([])},className:"px-4 py-2 rounded-lg border border-border-dark bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:()=>{if(v.length===0){alert("Please select at least one disk");return}ae.mutate({poolId:s.id,disks:v})},disabled:ae.isPending||v.length===0,className:"relative flex items-center gap-2 px-4 py-2 rounded-lg border border-primary/30 bg-card-dark text-white text-sm font-bold hover:bg-[#233648] transition-all overflow-hidden electric-glow electric-glow-border disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/15 to-primary/0 opacity-60"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent animate-[shimmer_3s_infinite]"}),e.jsxs("span",{className:"relative flex items-center gap-2 z-10",children:[ae.isPending?e.jsx("span",{className:"material-symbols-outlined text-[18px] animate-spin",children:"refresh"}):e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"add_circle"}),ae.isPending?"Adding...":"Add Spare Disks"]})]})]})]})]})})]})}function Lc(...r){return w6(v6(r))}const bi=Ce.forwardRef(({className:r,...t},s)=>e.jsx("div",{ref:s,className:Lc("rounded-lg border border-border-dark bg-card-dark text-white shadow-sm",r),...t}));bi.displayName="Card";const yi=Ce.forwardRef(({className:r,...t},s)=>e.jsx("div",{ref:s,className:Lc("flex flex-col space-y-1.5 p-6",r),...t}));yi.displayName="CardHeader";const wi=Ce.forwardRef(({className:r,...t},s)=>e.jsx("h3",{ref:s,className:Lc("text-2xl font-semibold leading-none tracking-tight",r),...t}));wi.displayName="CardTitle";const nu=Ce.forwardRef(({className:r,...t},s)=>e.jsx("p",{ref:s,className:Lc("text-sm text-text-secondary",r),...t}));nu.displayName="CardDescription";const vi=Ce.forwardRef(({className:r,...t},s)=>e.jsx("div",{ref:s,className:Lc("p-6 pt-0",r),...t}));vi.displayName="CardContent";const oS=Ce.forwardRef(({className:r,...t},s)=>e.jsx("div",{ref:s,className:Lc("flex items-center p-6 pt-0",r),...t}));oS.displayName="CardFooter";const ct=Ce.forwardRef(({className:r,variant:t="default",size:s="default",...n},o)=>e.jsx("button",{className:Lc("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{"bg-primary text-primary-foreground hover:bg-primary/90":t==="default","bg-destructive text-destructive-foreground hover:bg-destructive/90":t==="destructive","border border-border-dark bg-card-dark hover:bg-[#233648] hover:text-white text-white":t==="outline","bg-secondary text-secondary-foreground hover:bg-secondary/80":t==="secondary","hover:bg-accent hover:text-accent-foreground":t==="ghost","text-primary underline-offset-4 hover:underline":t==="link","h-10 px-4 py-2":s==="default","h-9 rounded-md px-3":s==="sm","h-11 rounded-md px-8":s==="lg","h-10 w-10":s==="icon"},r),ref:o,...n}));ct.displayName="Button";const lS={info:a4,warning:Eh,critical:s4},AS={info:"bg-blue-500/20 text-blue-400 border-blue-500/30",warning:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",critical:"bg-red-500/20 text-red-400 border-red-500/30"};function cS(){const[r,t]=Ce.useState("unacknowledged"),s=Nr(),{data:n,isLoading:o}=dt({queryKey:["alerts",r],queryFn:()=>Cc.listAlerts(r==="unacknowledged"?{is_acknowledged:!1}:void 0)}),l=ft({mutationFn:Cc.acknowledgeAlert,onSuccess:()=>{s.invalidateQueries({queryKey:["alerts"]})}}),d=ft({mutationFn:Cc.resolveAlert,onSuccess:()=>{s.invalidateQueries({queryKey:["alerts"]})}}),c=n?.alerts||[];return e.jsxs("div",{className:"space-y-6 min-h-screen bg-background-dark p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Alerts"}),e.jsx("p",{className:"mt-2 text-sm text-text-secondary",children:"Monitor system alerts and notifications"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(ct,{variant:r==="all"?"default":"outline",onClick:()=>t("all"),children:"All Alerts"}),e.jsx(ct,{variant:r==="unacknowledged"?"default":"outline",onClick:()=>t("unacknowledged"),children:"Unacknowledged"})]})]}),e.jsxs(bi,{children:[e.jsxs(yi,{children:[e.jsxs(wi,{className:"flex items-center",children:[e.jsx(Lb,{className:"h-5 w-5 mr-2"}),"Active Alerts"]}),e.jsx(nu,{children:o?"Loading...":`${c.length} ${r==="unacknowledged"?"unacknowledged":""} alert${c.length!==1?"s":""}`})]}),e.jsx(vi,{children:o?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading alerts..."}):c.length>0?e.jsx("div",{className:"space-y-4",children:c.map(u=>{const h=lS[u.severity];return e.jsx("div",{className:`border rounded-lg p-4 bg-card-dark ${AS[u.severity]}`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start space-x-3 flex-1",children:[e.jsx(h,{className:"h-5 w-5 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-white",children:u.title}),e.jsx("span",{className:"text-xs px-2 py-1 bg-[#233648] border border-border-dark rounded text-text-secondary",children:u.source})]}),e.jsx("p",{className:"text-sm mb-2 text-text-secondary",children:u.message}),e.jsxs("div",{className:"flex items-center space-x-4 text-xs",children:[e.jsx("span",{children:sS(u.created_at)}),u.resource_type&&e.jsxs("span",{children:[u.resource_type,": ",u.resource_id]})]})]})]}),e.jsxs("div",{className:"flex space-x-2 ml-4",children:[!u.is_acknowledged&&e.jsxs(ct,{size:"sm",variant:"outline",onClick:()=>l.mutate(u.id),disabled:l.isPending,children:[e.jsx(n4,{className:"h-4 w-4 mr-1"}),"Acknowledge"]}),!u.resolved_at&&e.jsxs(ct,{size:"sm",variant:"outline",onClick:()=>d.mutate(u.id),disabled:d.isPending,children:[e.jsx(s4,{className:"h-4 w-4 mr-1"}),"Resolve"]})]})]})},u.id)})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Lb,{className:"h-12 w-12 text-text-secondary mx-auto mb-4"}),e.jsx("p",{className:"text-sm text-text-secondary",children:"No alerts found"})]})})]})]})}const dS={listLibraries:async()=>(await ze.get("/tape/physical/libraries")).data.libraries||[]},Ym={listLibraries:async()=>(await ze.get("/tape/vtl/libraries")).data.libraries||[],getLibrary:async r=>(await ze.get(`/tape/vtl/libraries/${r}`)).data,createLibrary:async r=>(await ze.post("/tape/vtl/libraries",r)).data.library,deleteLibrary:async r=>{await ze.delete(`/tape/vtl/libraries/${r}`)},getLibraryDrives:async r=>(await ze.get(`/tape/vtl/libraries/${r}/drives`)).data.drives||[],getLibraryTapes:async r=>(await ze.get(`/tape/vtl/libraries/${r}/tapes`)).data.tapes||[],createTape:async(r,t)=>(await ze.post(`/tape/vtl/libraries/${r}/tapes`,t)).data.tape,loadTape:async(r,t)=>(await ze.post(`/tape/vtl/libraries/${r}/load`,t)).data,unloadTape:async(r,t)=>(await ze.post(`/tape/vtl/libraries/${r}/unload`,t)).data};function uS(){const[r,t]=Ce.useState("vtl"),[s,n]=Ce.useState(null),[o,l]=Ce.useState(""),d=Nr(),{data:c=[],isLoading:u}=dt({queryKey:["physical-tape-libraries"],queryFn:dS.listLibraries,enabled:r==="physical",refetchInterval:5e3}),{data:h=[],isLoading:m}=dt({queryKey:["vtl-libraries"],queryFn:Ym.listLibraries,enabled:r==="vtl",refetchInterval:5e3}),{data:x=[]}=dt({queryKey:["vtl-library-tapes",s],queryFn:()=>Ym.getLibraryTapes(s),enabled:!!s&&r==="vtl"}),y=r==="vtl"?h.length:c.length,p=r==="vtl"?h.filter(j=>j.is_active).length:c.filter(j=>j.is_active).length,v=r==="vtl"?h.reduce((j,_)=>j+_.slot_count,0):c.reduce((j,_)=>j+_.slot_count,0),N=x.filter(j=>j.slot_number>0).length,B=(r==="vtl"?h:c).filter(j=>j.name.toLowerCase().includes(o.toLowerCase())||r==="vtl"&&"mhvtl_library_id"in j&&j.mhvtl_library_id.toString().includes(o)),g=()=>{d.invalidateQueries({queryKey:r==="vtl"?["vtl-libraries"]:["physical-tape-libraries"]})};return e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden relative bg-background-dark",children:[e.jsx("header",{className:"flex-none px-6 py-5 border-b border-border-dark bg-[#111a22]/95 backdrop-blur z-10",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto w-full flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.jsx(ba,{to:"/",className:"text-text-secondary text-sm font-medium hover:text-primary transition-colors",children:"Home"}),e.jsx("span",{className:"text-text-secondary text-xs",children:"/"}),e.jsx("span",{className:"text-white text-sm font-medium",children:"Virtual Tape Libraries"})]}),e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-white text-3xl font-bold tracking-tight",children:"Virtual Tape Libraries"}),e.jsx("p",{className:"text-text-secondary text-base max-w-2xl",children:"Manage virtual tape devices, emulation profiles, and storage targets."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:g,className:"px-4 py-2 bg-surface-dark hover:bg-[#2a3b4d] border border-border-dark rounded-lg text-white text-sm font-medium flex items-center gap-2 transition-all",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"refresh"}),"Refresh"]}),r==="vtl"&&e.jsxs(ba,{to:"/tape/vtl/create",className:"px-4 py-2 bg-primary hover:bg-blue-600 rounded-lg text-white text-sm font-bold shadow-lg shadow-blue-900/20 flex items-center gap-2 transition-all",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"add"}),"Create VTL"]})]})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto bg-background-dark",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto p-6 flex flex-col gap-6 pb-20",children:[e.jsx("div",{className:"border-b border-border-dark",children:e.jsxs("nav",{className:"-mb-px flex space-x-8",children:[e.jsxs("button",{onClick:()=>{t("vtl"),n(null)},className:`py-4 px-1 border-b-2 font-medium text-sm ${r==="vtl"?"border-primary text-primary":"border-transparent text-text-secondary hover:text-white hover:border-border-dark"}`,children:["Virtual Tape Libraries (",h.length,")"]}),e.jsxs("button",{onClick:()=>{t("physical"),n(null)},className:`py-4 px-1 border-b-2 font-medium text-sm ${r==="physical"?"border-primary text-primary":"border-transparent text-text-secondary hover:text-white hover:border-border-dark"}`,children:["Physical Libraries (",c.length,")"]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1 p-5 rounded-xl border border-border-dark bg-surface-dark relative overflow-hidden group",children:[e.jsx("div",{className:"absolute right-0 top-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx("span",{className:"material-symbols-outlined text-6xl text-white",children:"dns"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Total Libraries"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:y}),e.jsxs("span",{className:"text-green-500 text-xs font-medium mb-1.5 flex items-center",children:[e.jsx("span",{className:"material-symbols-outlined text-sm mr-0.5",children:"check_circle"}),p===y?"All Online":`${p} Online`]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 p-5 rounded-xl border border-border-dark bg-surface-dark relative overflow-hidden group",children:[e.jsx("div",{className:"absolute right-0 top-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx("span",{className:"material-symbols-outlined text-6xl text-white",children:"database"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Total Capacity"}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:fr(r==="vtl"?h.reduce((j,_)=>j+_.slot_count*15*1024*1024*1024*1024,0):0,1)})})]}),e.jsxs("div",{className:"flex flex-col gap-1 p-5 rounded-xl border border-border-dark bg-surface-dark relative overflow-hidden group",children:[e.jsx("div",{className:"absolute right-0 top-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx("span",{className:"material-symbols-outlined text-6xl text-white",children:"album"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Tapes Online"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:N}),e.jsxs("span",{className:"text-text-secondary text-xs font-medium mb-1.5",children:["/ ",v," Slots"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 p-5 rounded-xl border border-border-dark bg-surface-dark relative overflow-hidden group",children:[e.jsx("div",{className:"absolute right-0 top-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx("span",{className:"material-symbols-outlined text-6xl text-white",children:"swap_horiz"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Active Sessions"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:r==="vtl"?h.reduce((j,_)=>j+_.drive_count,0):c.reduce((j,_)=>j+_.drive_count,0)}),e.jsx("span",{className:"text-blue-400 text-xs font-medium mb-1.5",children:"Drives"})]})]})]}),e.jsxs("div",{className:"p-5 rounded-xl bg-surface-dark border border-border-dark flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-text-secondary",children:"pie_chart"}),e.jsx("h3",{className:"text-white text-sm font-semibold",children:"VTL Partition Usage (ZFS Pool)"})]}),e.jsxs("p",{className:"text-white text-sm font-medium",children:[fr(N*15*1024*1024*1024*1024,1)," /"," ",fr(v*15*1024*1024*1024*1024,1)," Used"]})]}),e.jsx("div",{className:"w-full bg-[#111a22] rounded-full h-3 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-primary h-3 rounded-full",style:{width:`${v>0?N/v*100:0}%`}})}),e.jsxs("div",{className:"flex justify-between items-center text-xs text-text-secondary",children:[e.jsxs("span",{children:["Compression Ratio: ",e.jsx("span",{className:"text-white font-mono",children:"1.5x"})]}),e.jsxs("span",{className:"flex items-center gap-1 text-green-400",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"})," Pool Healthy"]})]})]}),e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-surface-dark overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-border-dark flex flex-col sm:flex-row gap-4 justify-between items-center bg-[#1c2834]",children:[e.jsxs("div",{className:"relative w-full sm:w-96",children:[e.jsx("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary text-lg",children:"search"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-border-dark text-white text-sm rounded-lg pl-10 pr-4 py-2 focus:ring-1 focus:ring-primary focus:border-primary placeholder-gray-600 outline-none transition-all",placeholder:"Search libraries by name or ID...",type:"text",value:o,onChange:j=>l(j.target.value)})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs("button",{className:"px-3 py-2 bg-[#111a22] hover:bg-[#1a2632] border border-border-dark rounded-lg text-text-secondary text-sm font-medium flex items-center gap-2 transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"filter_list"}),"Filter"]}),e.jsxs("button",{className:"px-3 py-2 bg-[#111a22] hover:bg-[#1a2632] border border-border-dark rounded-lg text-text-secondary text-sm font-medium flex items-center gap-2 transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"settings"}),"Columns"]})]})]}),m||u?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"Loading libraries..."})}):B.length===0?e.jsxs("div",{className:"p-12 text-center",children:[e.jsx("span",{className:"material-symbols-outlined text-6xl text-text-secondary mb-4 block",children:"database"}),e.jsxs("h3",{className:"text-lg font-medium text-white mb-2",children:["No ",r==="vtl"?"Virtual":"Physical"," Tape Libraries"]}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:r==="vtl"?"Create your first virtual tape library to get started":"Discover physical tape libraries connected to the system"}),r==="vtl"&&e.jsxs(ba,{to:"/tape/vtl/create",className:"inline-flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 rounded-lg text-white text-sm font-bold",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"add"}),"Create VTL Library"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#151e29] border-b border-border-dark",children:[e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary w-12",children:e.jsx("input",{className:"rounded border-border-dark bg-[#111a22] text-primary focus:ring-offset-background-dark focus:ring-primary h-4 w-4",type:"checkbox"})}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary",children:"Library Name"}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary",children:"Status"}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary",children:"Emulation"}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary",children:"Tapes / Slots"}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary",children:"iSCSI Target"}),e.jsx("th",{className:"py-4 px-6 text-xs font-semibold uppercase tracking-wider text-text-secondary text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:B.map(j=>{const _=r==="vtl",w=_?j.mhvtl_library_id:j.id,L=j.is_active?"Ready":"Offline",K=j.is_active?"green":"gray",M=_&&s===j.id?x.length:0;return e.jsxs("tr",{className:"group hover:bg-[#233342] transition-colors cursor-pointer",onClick:()=>_&&n(s===j.id?null:j.id),children:[e.jsx("td",{className:"py-4 px-6",children:e.jsx("input",{className:"rounded border-border-dark bg-[#111a22] text-primary focus:ring-offset-background-dark focus:ring-primary h-4 w-4",type:"checkbox",onClick:V=>V.stopPropagation()})}),e.jsx("td",{className:"py-4 px-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`size-8 rounded flex items-center justify-center ${j.is_active?"bg-blue-900/30 text-primary":"bg-gray-700/30 text-gray-400"}`,children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"shelves"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-sm font-bold",children:j.name}),e.jsxs("p",{className:"text-text-secondary text-xs",children:["ID: ",w]})]})]})}),e.jsx("td",{className:"py-4 px-6",children:e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${K==="green"?"bg-green-500/10 text-green-400 border-green-500/20":"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:[K==="green"&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),K==="gray"&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-500"}),L]})}),e.jsxs("td",{className:"py-4 px-6",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:_?j.vendor||"MHVTL":"physical"in j?j.vendor:"N/A"}),e.jsxs("p",{className:"text-text-secondary text-xs",children:["LTO-8 • ",j.drive_count," ",j.drive_count===1?"Drive":"Drives"]})]}),e.jsxs("td",{className:"py-4 px-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-text-secondary text-lg",children:"album"}),e.jsxs("span",{className:"text-white text-sm",children:[M||0," / ",j.slot_count]})]}),e.jsx("div",{className:"w-24 bg-[#111a22] rounded-full h-1 mt-1.5",children:e.jsx("div",{className:`h-1 rounded-full ${j.is_active?"bg-primary":"bg-gray-500"}`,style:{width:`${j.slot_count>0?(M||0)/j.slot_count*100:0}%`}})})]}),e.jsx("td",{className:"py-4 px-6",children:e.jsxs("div",{className:"flex items-center gap-2 group/copy cursor-pointer",onClick:()=>{const V=`iqn.2023-10.com.vtl:${j.name.toLowerCase().replace(/\s+/g,"")}`;navigator.clipboard.writeText(V)},children:[e.jsxs("code",{className:"text-xs text-text-secondary font-mono bg-[#111a22] px-2 py-1 rounded border border-border-dark group-hover/copy:text-white transition-colors",children:["iqn.2023-10.com.vtl:",j.name.toLowerCase().replace(/\s+/g,"")]}),e.jsx("span",{className:"material-symbols-outlined text-text-secondary text-sm opacity-0 group-hover/copy:opacity-100 transition-opacity",children:"content_copy"})]})}),e.jsx("td",{className:"py-4 px-6 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(ba,{to:_?`/tape/vtl/${j.id}`:`/tape/physical/${j.id}`,className:"p-2 text-text-secondary hover:text-white hover:bg-[#324d67] rounded-lg transition-colors",title:"Manage Tapes",onClick:V=>V.stopPropagation(),children:e.jsx("span",{className:"material-symbols-outlined text-xl",children:"cable"})}),e.jsx("button",{className:"p-2 text-text-secondary hover:text-primary hover:bg-primary/10 rounded-lg transition-colors",title:"Edit Configuration",onClick:V=>V.stopPropagation(),children:e.jsx("span",{className:"material-symbols-outlined text-xl",children:"edit"})}),e.jsx("button",{className:"p-2 text-text-secondary hover:text-red-400 hover:bg-red-400/10 rounded-lg transition-colors",title:"Delete Library",onClick:V=>V.stopPropagation(),children:e.jsx("span",{className:"material-symbols-outlined text-xl",children:"delete"})})]})})]},j.id)})})]})}),e.jsxs("div",{className:"px-6 py-4 border-t border-border-dark flex items-center justify-between bg-[#1c2834]",children:[e.jsxs("p",{className:"text-text-secondary text-sm",children:["Showing ",e.jsxs("span",{className:"text-white font-medium",children:["1-",B.length]})," of"," ",e.jsx("span",{className:"text-white font-medium",children:B.length})," libraries"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"px-3 py-1.5 rounded-lg border border-border-dark bg-[#111a22] text-text-secondary text-sm hover:text-white disabled:opacity-50",disabled:!0,children:"Previous"}),e.jsx("button",{className:"px-3 py-1.5 rounded-lg border border-border-dark bg-[#111a22] text-text-secondary text-sm hover:text-white disabled:opacity-50",disabled:!0,children:"Next"})]})]})]})]})]})}),s&&r==="vtl"&&e.jsx("div",{className:"bg-surface-dark border-t border-border-dark p-6 absolute bottom-0 w-full transform translate-y-0 transition-transform z-30 shadow-2xl shadow-black max-h-[70vh] overflow-y-auto",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary text-2xl",children:"cable"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-white text-lg font-bold",children:["Tape Management: ",h.find(j=>j.id===s)?.name]}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Manage virtual cartridges, import/export slots, and barcodes."})]})]}),e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[e.jsx("button",{className:"px-3 py-2 bg-[#111a22] border border-border-dark rounded-lg text-text-secondary hover:text-white text-sm font-medium transition-colors",children:"Bulk Format"}),e.jsxs(ba,{to:`/tape/vtl/${s}/tapes/create`,className:"px-3 py-2 bg-primary hover:bg-blue-600 rounded-lg text-white text-sm font-bold transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"add"}),"Add Tapes"]}),e.jsx("button",{onClick:()=>n(null),className:"p-2 text-text-secondary hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]}),x.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("span",{className:"material-symbols-outlined text-6xl text-text-secondary mb-4 block",children:"album"}),e.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No Tapes Found"}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"This library has no tapes yet. Create tapes to get started."}),e.jsxs(ba,{to:`/tape/vtl/${s}/tapes/create`,className:"inline-flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 rounded-lg text-white text-sm font-bold",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"add"}),"Add Tapes"]})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3",children:x.map(j=>e.jsxs("div",{className:`p-3 rounded-lg border flex flex-col gap-2 relative group hover:border-primary transition-all cursor-pointer min-h-[120px] ${j.status==="in_drive"?"bg-[#111a22] border-green-500/30 shadow-lg shadow-green-500/10":"bg-[#111a22] border-border-dark hover:shadow-lg hover:shadow-primary/10"}`,children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("span",{className:`material-symbols-outlined text-xl ${j.status==="in_drive"?"text-green-500":"text-text-secondary"}`,children:"album"}),e.jsxs("span",{className:"text-[10px] uppercase font-bold text-text-secondary bg-[#1c2834] px-1.5 py-0.5 rounded",children:["SLOT ",j.slot_number]})]}),e.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[e.jsx("p",{className:"text-white text-xs font-mono font-bold truncate",title:j.barcode,children:j.barcode}),e.jsxs("p",{className:"text-text-secondary text-[10px] mt-1",children:[fr(j.size_bytes,1)," / ",fr(j.size_bytes,1)]})]}),e.jsxs("div",{className:"absolute inset-0 bg-black/70 hidden group-hover:flex items-center justify-center gap-2 backdrop-blur-sm rounded-lg",children:[e.jsx("button",{className:"p-2 text-white hover:text-primary hover:bg-primary/20 rounded transition-colors",title:"Eject",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"eject"})}),e.jsx("button",{className:"p-2 text-white hover:text-red-400 hover:bg-red-400/20 rounded transition-colors",title:"Delete",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"delete"})})]})]},j.id))})]})})]})}function hS(){const{id:r}=jy(),t=Ph(),s=Nr(),[n,o]=Ce.useState(null),{data:l,isLoading:d}=dt({queryKey:["vtl-library",r],queryFn:()=>Ym.getLibrary(r),enabled:!!r}),c=ft({mutationFn:()=>Ym.deleteLibrary(r),onSuccess:()=>{s.invalidateQueries({queryKey:["vtl-libraries"]}),t("/tape")}});if(d)return e.jsx("div",{className:"text-sm text-text-secondary min-h-screen bg-background-dark p-6",children:"Loading library details..."});if(!l)return e.jsx("div",{className:"text-sm text-red-400 min-h-screen bg-background-dark p-6",children:"Library not found"});const{library:u,drives:h,tapes:m}=l;return e.jsxs("div",{className:"space-y-6 min-h-screen bg-background-dark p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(ct,{variant:"ghost",size:"sm",onClick:()=>t("/tape"),children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:u.name}),e.jsxs("p",{className:"mt-1 text-sm text-text-secondary",children:["Virtual Tape Library • ",u.slot_count," slots • ",u.drive_count," drives"]})]})]}),e.jsxs(ct,{variant:"destructive",onClick:()=>{confirm("Are you sure you want to delete this library?")&&c.mutate()},children:[e.jsx(es,{className:"h-4 w-4 mr-2"}),"Delete Library"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"Library Status"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Status:"}),e.jsx("span",{className:u.is_active?"text-green-400":"text-text-secondary",children:u.is_active?"Active":"Inactive"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"mhVTL ID:"}),e.jsx("span",{className:"font-medium text-white",children:u.mhvtl_library_id})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Storage Path:"}),e.jsx("span",{className:"font-mono text-xs text-white",children:u.storage_path})]})]})})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"Capacity"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Total Slots:"}),e.jsx("span",{className:"font-medium text-white",children:u.slot_count})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Used Slots:"}),e.jsx("span",{className:"font-medium text-white",children:m.length})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Free Slots:"}),e.jsx("span",{className:"font-medium text-white",children:u.slot_count-m.length})]})]})})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"Drives"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Total Drives:"}),e.jsx("span",{className:"font-medium text-white",children:u.drive_count})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Idle:"}),e.jsx("span",{className:"font-medium text-white",children:h.filter(x=>x.status==="idle").length})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Ready:"}),e.jsx("span",{className:"font-medium text-white",children:h.filter(x=>x.status==="ready").length})]})]})})]})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(wi,{children:"Drives"}),e.jsx(nu,{children:"Virtual tape drives in this library"})]}),e.jsxs(ct,{variant:"outline",size:"sm",children:[e.jsx(Cn,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})}),e.jsx(vi,{children:h.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:h.map(x=>e.jsx(fS,{drive:x,tapes:m,isSelected:n===x.id,onSelect:()=>o(x.id)},x.id))}):e.jsx("p",{className:"text-sm text-text-secondary",children:"No drives configured"})})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(wi,{children:"Virtual Tapes"}),e.jsxs(nu,{children:[m.length," of ",u.slot_count," slots used"]})]}),e.jsxs(ct,{variant:"outline",size:"sm",children:[e.jsx(Ks,{className:"h-4 w-4 mr-2"}),"Create Tape"]})]})}),e.jsx(vi,{children:m.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-[#1a2632]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Barcode"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Slot"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Size"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-card-dark divide-y divide-border-dark",children:m.map(x=>e.jsxs("tr",{className:"hover:bg-[#233648]",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-white",children:x.barcode}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-text-secondary",children:x.slot_number}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-text-secondary",children:fr(x.size_bytes)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${x.status==="loaded"?"bg-blue-100 text-blue-800":x.status==="mounted"?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:x.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n&&e.jsxs(ct,{variant:"outline",size:"sm",onClick:()=>{console.log("Load tape",x.id,"to drive",n)},children:[e.jsx(i4,{className:"h-3 w-3 mr-1"}),"Load"]})})]},x.id))})]})}):e.jsx("p",{className:"text-sm text-text-secondary",children:"No tapes created yet"})})]})]})}function fS({drive:r,tapes:t,isSelected:s,onSelect:n}){const o=t.find(l=>l.id===r.current_tape_id);return e.jsxs("div",{className:`border rounded-lg p-4 cursor-pointer transition-colors ${s?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,onClick:n,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("h4",{className:"font-medium",children:["Drive ",r.drive_number]}),e.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${r.status==="ready"?"bg-green-100 text-green-800":r.status==="loaded"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:r.status})]}),o?e.jsxs("div",{className:"text-sm text-text-secondary",children:[e.jsxs("p",{className:"text-white",children:["Tape: ",o.barcode]}),e.jsx("p",{className:"text-xs text-text-secondary",children:fr(o.size_bytes)})]}):e.jsx("p",{className:"text-sm text-text-secondary",children:"No tape loaded"}),s&&e.jsx("div",{className:"mt-2 pt-2 border-t",children:e.jsx("p",{className:"text-xs text-blue-600",children:"Selected - Click tape to load"})})]})}const br={listTargets:async()=>(await ze.get("/scst/targets",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.targets||[],getTarget:async r=>(await ze.get(`/scst/targets/${r}`,{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data,createTarget:async r=>(await ze.post("/scst/targets",r)).data,addLUN:async(r,t)=>(await ze.post(`/scst/targets/${r}/luns`,t)).data,removeLUN:async(r,t)=>(await ze.delete(`/scst/targets/${r}/luns/${t}`)).data,addInitiator:async(r,t)=>(await ze.post(`/scst/targets/${r}/initiators`,t)).data,applyConfig:async()=>(await ze.post("/scst/config/apply")).data,listHandlers:async()=>(await ze.get("/scst/handlers",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.handlers||[],listPortals:async()=>(await ze.get("/scst/portals",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.portals||[],getPortal:async r=>(await ze.get(`/scst/portals/${r}`,{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data,createPortal:async r=>(await ze.post("/scst/portals",r)).data,updatePortal:async(r,t)=>(await ze.put(`/scst/portals/${r}`,t)).data,deletePortal:async r=>{await ze.delete(`/scst/portals/${r}`)},enableTarget:async r=>(await ze.post(`/scst/targets/${r}/enable`)).data,disableTarget:async r=>(await ze.post(`/scst/targets/${r}/disable`)).data,deleteTarget:async r=>(await ze.delete(`/scst/targets/${r}`)).data,listInitiators:async()=>(await ze.get("/scst/initiators",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.initiators||[],getInitiator:async r=>(await ze.get(`/scst/initiators/${r}`,{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data,removeInitiator:async r=>{await ze.delete(`/scst/initiators/${r}`)},listExtents:async()=>(await ze.get("/scst/extents",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.extents||[],createExtent:async r=>(await ze.post("/scst/extents",r)).data,deleteExtent:async r=>{await ze.delete(`/scst/extents/${r}`)},listInitiatorGroups:async()=>(await ze.get("/scst/initiator-groups",{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data.groups||[],getInitiatorGroup:async r=>(await ze.get(`/scst/initiator-groups/${r}`,{headers:{"Cache-Control":"no-cache"},params:{_t:Date.now()}})).data,createInitiatorGroup:async r=>(await ze.post("/scst/initiator-groups",r)).data,updateInitiatorGroup:async(r,t)=>(await ze.put(`/scst/initiator-groups/${r}`,t)).data,deleteInitiatorGroup:async r=>{await ze.delete(`/scst/initiator-groups/${r}`)},addInitiatorToGroup:async(r,t)=>(await ze.post(`/scst/initiator-groups/${r}/initiators`,{initiator_iqn:t})).data,getConfigFile:async r=>(await ze.get("/scst/config/file",{params:r?{path:r}:{}})).data,updateConfigFile:async(r,t)=>(await ze.put("/scst/config/file",{content:r,path:t})).data};function mS(){const r=Nr(),[t,s]=Ce.useState(!1),[n,o]=Ce.useState("targets"),[l,d]=Ce.useState(null),[c,u]=Ce.useState(""),{data:h,isLoading:m}=dt({queryKey:["scst-targets"],queryFn:br.listTargets,refetchInterval:3e3,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0,staleTime:0,gcTime:0,structuralSharing:!1}),x=ft({mutationFn:br.applyConfig,onSuccess:()=>{r.invalidateQueries({queryKey:["scst-targets"]}),alert("Configuration applied successfully!")}}),y=h?.filter(p=>p.iqn.toLowerCase().includes(c.toLowerCase())||p.alias&&p.alias.toLowerCase().includes(c.toLowerCase()))||[];return e.jsxs("div",{className:"flex-1 overflow-y-auto p-8",children:[e.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col gap-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ba,{to:"/storage",className:"text-text-secondary text-sm font-medium hover:text-white transition-colors",children:"Storage"}),e.jsx(Ka,{className:"text-text-secondary",size:16}),e.jsx("span",{className:"text-white text-sm font-medium",children:"iSCSI Management"})]}),e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h1",{className:"text-white text-3xl font-extrabold leading-tight tracking-tight",children:"iSCSI Management"}),e.jsx("p",{className:"text-text-secondary text-base font-normal",children:"Manage targets, portals, and initiator access control lists."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ct,{variant:"outline",onClick:()=>x.mutate(),disabled:x.isPending,className:"flex items-center gap-2 px-4 h-10 rounded-lg bg-card-dark border border-border-dark hover:bg-white/5 text-white text-sm font-semibold",children:[e.jsx(vc,{size:20}),e.jsx("span",{children:"Global Settings"})]}),e.jsxs(ct,{onClick:()=>s(!0),className:"flex items-center gap-2 px-4 h-10 rounded-lg bg-primary hover:bg-blue-600 text-white text-sm font-bold shadow-lg shadow-blue-900/20",children:[e.jsx(Ks,{size:20}),e.jsx("span",{children:"Create Target"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-card-dark border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Service Status"}),e.jsx(n4,{className:"text-green-500",size:24})]}),e.jsx("p",{className:"text-white text-2xl font-bold",children:"Running"}),e.jsx("p",{className:"text-green-500 text-xs font-medium mt-1",children:"Uptime: 14d 2h"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-card-dark border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Port Binding"}),e.jsx(ya,{className:"text-text-secondary",size:24})]}),e.jsx("p",{className:"text-white text-2xl font-bold",children:"3260"}),e.jsx("p",{className:"text-text-secondary text-xs font-medium mt-1",children:"Listening on 0.0.0.0"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-card-dark border border-border-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Active Sessions"}),e.jsx(N6,{className:"text-primary",size:24})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-white text-2xl font-bold",children:"12"}),e.jsxs("span",{className:"text-green-500 text-sm font-medium flex items-center",children:[e.jsx(B6,{size:16})," 2"]})]}),e.jsx("p",{className:"text-text-secondary text-xs font-medium mt-1",children:"Total throughput: 450 MB/s"})]})]}),e.jsxs("div",{className:"flex flex-col bg-card-dark border border-border-dark rounded-xl overflow-hidden shadow-sm",children:[e.jsx("div",{className:"border-b border-border-dark px-6",children:e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("button",{onClick:()=>o("targets"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="targets"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Targets",n==="targets"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]}),e.jsxs("button",{onClick:()=>o("portals"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="portals"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Portals",n==="portals"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]}),e.jsxs("button",{onClick:()=>o("initiators"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="initiators"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Initiators",n==="initiators"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]}),e.jsxs("button",{onClick:()=>o("extents"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="extents"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Extents",n==="extents"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]}),e.jsxs("button",{onClick:()=>o("groups"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="groups"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Groups",n==="groups"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]}),e.jsxs("button",{onClick:()=>o("config"),className:`relative py-4 text-sm tracking-wide transition-colors ${n==="config"?"text-primary font-bold":"text-text-secondary hover:text-white font-medium"}`,children:["Config Editor",n==="config"&&e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary rounded-t-full"})]})]})}),e.jsxs("div",{className:"p-4 flex items-center justify-between gap-4 border-b border-border-dark/50 bg-[#141d26]",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search targets by alias or IQN...",value:c,onChange:p=>u(p.target.value),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg pl-10 pr-4 py-2 text-sm text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-text-secondary/50"})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-md bg-[#0f161d] border border-border-dark",children:[e.jsx("span",{className:"text-xs text-text-secondary font-medium",children:"Filter:"}),e.jsxs("select",{className:"bg-[#0f161d] text-xs text-white font-medium focus:outline-none cursor-pointer border-none appearance-none pr-6",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 0 center",paddingRight:"24px"},children:[e.jsx("option",{className:"bg-[#0f161d] text-white",children:"All Status"}),e.jsx("option",{className:"bg-[#0f161d] text-white",children:"Online"}),e.jsx("option",{className:"bg-[#0f161d] text-white",children:"Offline"})]})]})})]}),n==="targets"&&e.jsxs("div",{className:"flex flex-col",children:[m?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading targets..."}):y.length>0?e.jsx(e.Fragment,{children:y.map((p,v)=>e.jsx(pS,{target:p,isExpanded:l===p.id,onToggle:()=>d(l===p.id?null:p.id),onDelete:()=>{l===p.id&&d(null)},isLast:v===y.length-1},p.id))}):e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No targets found"})}),e.jsxs("div",{className:"p-4 bg-[#141d26] border-t border-border-dark flex items-center justify-between",children:[e.jsxs("p",{className:"text-xs text-text-secondary",children:["Showing 1-",y.length," of ",y.length," targets"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"p-1 rounded text-text-secondary hover:text-white hover:bg-white/10 disabled:opacity-50",children:e.jsx(Sy,{size:20})}),e.jsx("button",{className:"p-1 rounded text-text-secondary hover:text-white hover:bg-white/10",children:e.jsx(Ka,{size:20})})]})]})]}),n==="portals"&&e.jsx(bS,{}),n==="initiators"&&e.jsx(wS,{}),n==="extents"&&e.jsx(vS,{}),n==="groups"&&e.jsx(BS,{}),n==="config"&&e.jsx(_S,{})]})]}),t&&e.jsx(gS,{onClose:()=>s(!1),onSuccess:async()=>{s(!1),await r.invalidateQueries({queryKey:["scst-targets"]}),await r.refetchQueries({queryKey:["scst-targets"]})}})]})}function pS({target:r,isExpanded:t,onToggle:s,onDelete:n}){const{data:o}=dt({queryKey:["scst-target",r.id],queryFn:()=>br.getTarget(r.id),enabled:t}),l=o?.luns||[],d=o?.initiator_groups||[],[c,u]=Ce.useState(!1),h=Nr(),m=r.is_active?"bg-green-500/20 text-green-400 border-green-500/20":"bg-red-500/20 text-red-400 border-red-500/20",x=r.is_active?"Online":"Offline",y=ft({mutationFn:()=>br.enableTarget(r.id),onSuccess:()=>{h.invalidateQueries({queryKey:["scst-targets"]}),h.invalidateQueries({queryKey:["scst-target",r.id]})}}),p=ft({mutationFn:()=>br.disableTarget(r.id),onSuccess:()=>{h.invalidateQueries({queryKey:["scst-targets"]}),h.invalidateQueries({queryKey:["scst-target",r.id]})}}),v=ft({mutationFn:()=>br.deleteTarget(r.id),onSuccess:async()=>{t&&s(),n&&n(),h.setQueryData(["scst-targets"],B=>B&&B.filter(g=>g.id!==r.id)),h.removeQueries({queryKey:["scst-target",r.id]}),await h.invalidateQueries({queryKey:["scst-targets"]}),await h.refetchQueries({queryKey:["scst-targets"],type:"active"})},onError:B=>{h.refetchQueries({queryKey:["scst-targets"]}),alert(`Failed to delete target: ${B.response?.data?.error||B.message}`)}}),N=ft({mutationFn:({targetId:B,lunId:g})=>br.removeLUN(B,g),onMutate:async({lunId:B})=>{await h.cancelQueries({queryKey:["scst-target",r.id]}),await h.cancelQueries({queryKey:["scst-targets"]});const g=h.getQueryData(["scst-target",r.id]),j=h.getQueryData(["scst-targets"]);return h.setQueryData(["scst-target",r.id],_=>_&&{..._,luns:_.luns?_.luns.filter(w=>w.id!==B):[]}),h.setQueryData(["scst-targets"],_=>_&&_.map(w=>w.id===r.id?{...w,lun_count:Math.max(0,(w.lun_count||0)-1)}:w)),{previousTarget:g,previousTargets:j}},onSuccess:async()=>{h.removeQueries({queryKey:["scst-target",r.id]}),await h.invalidateQueries({queryKey:["scst-targets"]}),await h.invalidateQueries({queryKey:["scst-target",r.id]}),t&&await h.refetchQueries({queryKey:["scst-target",r.id]}),await h.refetchQueries({queryKey:["scst-targets"],type:"active"})},onError:(B,g,j)=>{if(B.response?.status===404){h.invalidateQueries({queryKey:["scst-target",r.id]}),h.invalidateQueries({queryKey:["scst-targets"]}),h.refetchQueries({queryKey:["scst-target",r.id]}),h.refetchQueries({queryKey:["scst-targets"]});return}j?.previousTarget&&h.setQueryData(["scst-target",r.id],j.previousTarget),j?.previousTargets&&h.setQueryData(["scst-targets"],j.previousTargets),h.refetchQueries({queryKey:["scst-target",r.id]}),h.refetchQueries({queryKey:["scst-targets"]}),alert(`Failed to remove LUN: ${B.response?.data?.error||B.message}`)}});return e.jsxs("div",{className:`group border-b border-border-dark ${t?"bg-white/[0.02]":"bg-transparent"}`,children:[e.jsxs("div",{className:`flex items-center p-4 gap-4 hover:bg-white/5 transition-colors cursor-pointer border-l-4 ${t?"border-primary":"border-transparent hover:border-border-dark"}`,onClick:s,children:[e.jsx("div",{className:`p-2 rounded-md ${t?"bg-primary/10 text-primary":"bg-border-dark/50 text-text-secondary"}`,children:e.jsx(ya,{size:24})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-white font-bold text-sm",children:r.alias||r.iqn.split(":").pop()}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wide border ${m}`,children:x}),r.is_active?e.jsx("button",{onClick:B=>{B.stopPropagation(),confirm("Disable this target? It will stop accepting iSCSI connections.")&&p.mutate()},className:"px-2 py-1 text-xs bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded border border-red-500/20",title:"Disable target",children:"Disable"}):e.jsx("button",{onClick:B=>{B.stopPropagation(),y.mutate()},className:"px-2 py-1 text-xs bg-green-500/20 text-green-400 hover:bg-green-500/30 rounded border border-green-500/20",title:"Enable target",children:"Enable"})]}),e.jsxs("div",{className:"flex items-center gap-2 group/iqn",children:[e.jsx("span",{className:"text-text-secondary font-mono text-xs truncate",children:r.iqn}),e.jsx("button",{className:"opacity-0 group-hover/iqn:opacity-100 text-text-secondary hover:text-white transition-opacity",title:"Copy IQN",onClick:B=>{B.stopPropagation(),navigator.clipboard.writeText(r.iqn)},children:e.jsx(so,{size:14})})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-8 mr-4",children:[e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"text-[10px] uppercase text-text-secondary font-bold tracking-wider",children:"LUNs"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ul,{className:"text-text-secondary",size:16}),e.jsx("span",{className:"text-white text-sm font-bold",children:r.lun_count||0})]})]}),e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"text-[10px] uppercase text-text-secondary font-bold tracking-wider",children:"Auth"}),e.jsx("span",{className:"text-white text-sm font-medium",children:"None"})]})]}),e.jsx("button",{className:"p-2 hover:bg-white/10 rounded-full text-text-secondary hover:text-white transition-colors",onClick:B=>{B.stopPropagation(),s()},children:t?e.jsx(j6,{size:24}):e.jsx(wh,{size:24})})]}),t&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg p-4 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Attached LUNs"}),e.jsx(ba,{to:`/iscsi/${r.id}`,className:"text-primary text-xs font-bold hover:underline",onClick:B=>B.stopPropagation(),children:"+ Add LUN"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:l.length>0?l.map(B=>e.jsxs("div",{className:"p-3 rounded bg-card-dark border border-border-dark flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-white text-sm font-medium",children:["LUN ",B.lun_number]}),B.is_active&&e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-green-100 text-green-800",children:"Active"})]}),e.jsxs("div",{className:"text-text-secondary text-xs",children:[B.handler||"Unknown"," • ",B.device_path||"No path"]}),e.jsx("div",{className:"text-text-secondary text-xs",children:B.device_type||"Unknown type"})]}),e.jsx("button",{onClick:()=>{confirm(`Remove LUN ${B.lun_number} from this target?`)&&N.mutate({targetId:r.id,lunId:B.id})},disabled:N.isPending,className:"p-1.5 hover:bg-red-500/10 rounded text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50",title:"Remove LUN",children:e.jsx(es,{size:14})})]},B.id)):e.jsx("div",{className:"p-3 rounded bg-card-dark border border-border-dark text-center text-text-secondary text-sm",children:"No LUNs attached"})})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Access Control"}),e.jsx("button",{className:"text-primary text-xs font-bold hover:underline",onClick:B=>{B.stopPropagation(),u(!0)},children:"Edit Policy"}),e.jsxs("button",{onClick:B=>{B.stopPropagation(),confirm(`Delete target "${r.alias||r.iqn}"? This will remove the target from SCST and all associated LUNs and initiators. This action cannot be undone.`)&&v.mutate()},disabled:v.isPending,className:"px-3 py-1.5 text-xs bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded border border-red-500/20 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[e.jsx(es,{size:14}),"Delete Target"]})]}),e.jsx("div",{className:"flex flex-col gap-2 h-full",children:e.jsxs("div",{className:"p-3 rounded bg-card-dark border border-border-dark flex flex-col gap-2",children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border-dark/50",children:[e.jsx("span",{className:"text-text-secondary text-xs",children:"Auth Method"}),e.jsx("span",{className:"text-white text-xs font-bold",children:"None"})]}),e.jsxs("div",{className:"flex justify-between items-center py-1",children:[e.jsx("span",{className:"text-text-secondary text-xs",children:"Initiator Group"}),d.length>0?e.jsx("div",{className:"flex flex-col items-end gap-1",children:d.map(B=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary text-xs font-bold",children:B.group_name}),e.jsxs("span",{className:"text-text-secondary text-xs",children:["(",B.initiators?.length||0," initiators)"]})]},B.id))}):e.jsx("span",{className:"text-text-secondary text-xs",children:"None"})]}),d.length>0&&e.jsx("div",{className:"pt-2 border-t border-border-dark/50",children:e.jsx("div",{className:"flex flex-col gap-1",children:d.flatMap(B=>(B.initiators||[]).map(g=>e.jsx("div",{className:"text-text-secondary text-xs font-mono",children:g.iqn},g.id)))})})]})})]}),e.jsx("div",{className:"col-span-1 lg:col-span-2 flex justify-end gap-2 mt-2 pt-3 border-t border-border-dark/50",children:e.jsx(ba,{to:`/iscsi/${r.id}`,className:"px-3 py-1.5 rounded text-xs font-bold bg-primary text-white hover:bg-blue-600 transition-colors",children:"View Details"})})]})}),c&&e.jsx(xS,{target:r,initiatorGroups:d,onClose:()=>u(!1),onSuccess:()=>{h.invalidateQueries({queryKey:["scst-target",r.id]}),u(!1)}})]})}function xS({target:r,initiatorGroups:t,onClose:s,onSuccess:n}){const[o,l]=Ce.useState(""),d=Nr(),c=ft({mutationFn:x=>br.addInitiator(r.id,{initiator_iqn:x}),onSuccess:()=>{d.invalidateQueries({queryKey:["scst-target",r.id]}),l(""),n()},onError:x=>{alert(`Failed to add initiator: ${x.response?.data?.error||x.message}`)}}),u=ft({mutationFn:x=>br.removeInitiator(x),onSuccess:()=>{d.invalidateQueries({queryKey:["scst-target",r.id]}),d.invalidateQueries({queryKey:["scst-initiators"]}),n()},onError:x=>{alert(`Failed to remove initiator: ${x.response?.data?.error||x.message}`)}}),h=x=>{if(x.preventDefault(),!o.trim()){alert("Please enter an initiator IQN");return}c.mutate(o.trim())},m=t.flatMap(x=>x.initiators||[]);return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:s,children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-border-dark flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Edit Access Policy"}),e.jsxs("p",{className:"text-sm text-text-secondary mt-1",children:["Manage initiators for ",r.iqn]})]}),e.jsx("button",{onClick:s,className:"p-2 hover:bg-white/10 rounded-lg text-text-secondary hover:text-white transition-colors",children:e.jsx(Zs,{size:20})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-white mb-3",children:"Add Initiator"}),e.jsxs("form",{onSubmit:h,className:"flex gap-2",children:[e.jsx("input",{type:"text",value:o,onChange:x=>l(x.target.value),placeholder:"iqn.2025-12.example:initiator",className:"flex-1 px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx(ct,{type:"submit",disabled:c.isPending,className:"px-4 bg-primary hover:bg-blue-600",children:c.isPending?"Adding...":"Add"})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-white mb-3",children:["Current Initiators (",m.length,")"]}),m.length>0?e.jsx("div",{className:"space-y-2",children:m.map(x=>e.jsxs("div",{className:"p-3 rounded bg-[#0f161d] border border-border-dark flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded bg-primary/10 text-primary",children:e.jsx(ya,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white text-sm font-mono",children:x.iqn}),e.jsx("div",{className:"text-text-secondary text-xs",children:x.is_active?"Active":"Inactive"})]})]}),e.jsx("button",{onClick:()=>{confirm(`Remove initiator ${x.iqn}?`)&&u.mutate(x.id)},disabled:u.isPending,className:"p-2 hover:bg-red-500/10 rounded-lg text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Remove initiator",children:e.jsx(es,{size:16})})]},x.id))}):e.jsx("div",{className:"p-4 rounded bg-[#0f161d] border border-border-dark text-center text-text-secondary text-sm",children:"No initiators configured"})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-white mb-3",children:"Authentication Method"}),e.jsxs("div",{className:"p-3 rounded bg-[#0f161d] border border-border-dark",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-text-secondary text-sm",children:"Current Method"}),e.jsx("span",{className:"text-white text-sm font-bold",children:"None"})]}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"Authentication configuration coming soon"})]})]})]}),e.jsx("div",{className:"p-6 border-t border-border-dark flex justify-end gap-2",children:e.jsx(ct,{variant:"outline",onClick:s,className:"px-4",children:"Close"})})]})})}function gS({onClose:r,onSuccess:t}){const[s,n]=Ce.useState(""),[o,l]=Ce.useState(""),[d,c]=Ce.useState("disk"),[u,h]=Ce.useState(""),m=Nr(),x=ft({mutationFn:br.createTarget,onSuccess:async p=>{await m.invalidateQueries({queryKey:["scst-targets"]}),await m.refetchQueries({queryKey:["scst-targets"]}),p?.id&&await m.invalidateQueries({queryKey:["scst-target",p.id]}),t()},onError:p=>{console.error("Failed to create target:",p);const v=p.response?.data?.error||p.message||"Failed to create target";alert(v)}}),y=p=>{if(p.preventDefault(),!s.trim()||!o.trim()){alert("IQN and Name are required");return}const v={iqn:s.trim(),target_type:d,name:o.trim(),description:u.trim()||void 0};console.log("Creating target:",v),x.mutate(v)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"p-6 border-b border-border-dark",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Create iSCSI Target"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Create a new SCST iSCSI target"})]}),e.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"iqn",className:"block text-sm font-medium text-white mb-1",children:"IQN (iSCSI Qualified Name) *"}),e.jsx("input",{id:"iqn",type:"text",value:s,onChange:p=>n(p.target.value),placeholder:"iqn.2024-01.com.example:target1",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Format: iqn.YYYY-MM.reverse.domain:identifier"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-white mb-1",children:"Name *"}),e.jsx("input",{id:"name",type:"text",value:o,onChange:p=>l(p.target.value),placeholder:"My Target",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"targetType",className:"block text-sm font-medium text-white mb-1",children:"Target Type *"}),e.jsxs("select",{id:"targetType",value:d,onChange:p=>c(p.target.value),className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0,children:[e.jsx("option",{value:"disk",children:"Disk"}),e.jsx("option",{value:"vtl",children:"Virtual Tape Library"}),e.jsx("option",{value:"physical_tape",children:"Physical Tape"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-white mb-1",children:"Description (Optional)"}),e.jsx("textarea",{id:"description",value:u,onChange:p=>h(p.target.value),placeholder:"Target description",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",rows:3})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:x.isPending,children:x.isPending?"Creating...":"Create Target"})]})]})]})})}function bS(){const r=Nr(),[t,s]=Ce.useState(!1),[n,o]=Ce.useState(null),{data:l=[],isLoading:d}=dt({queryKey:["scst-portals"],queryFn:br.listPortals}),c=ft({mutationFn:br.deletePortal,onSuccess:()=>{r.invalidateQueries({queryKey:["scst-portals"]})},onError:h=>{alert(`Failed to delete portal: ${h.response?.data?.error||h.message}`)}}),u=h=>{confirm(`Delete portal ${h.ip_address}:${h.port}?`)&&c.mutate(h.id)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-2xl font-bold",children:"iSCSI Portals"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage network portals for iSCSI connections"})]}),e.jsxs(ct,{onClick:()=>s(!0),className:"flex items-center gap-2 px-4 h-10 rounded-lg bg-primary hover:bg-blue-600 text-white text-sm font-bold",children:[e.jsx(Ks,{size:20}),e.jsx("span",{children:"Create Portal"})]})]}),d?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading portals..."}):l.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(h=>e.jsxs("div",{className:"p-4 rounded-lg bg-card-dark border border-border-dark hover:border-primary/50 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ya,{size:20,className:"text-primary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-bold text-sm",children:h.ip_address}),e.jsxs("div",{className:"text-text-secondary text-xs",children:["Port: ",h.port]})]})]}),e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${h.is_active?"bg-green-500/20 text-green-400 border border-green-500/20":"bg-gray-500/20 text-gray-400 border border-gray-500/20"}`,children:h.is_active?"Active":"Inactive"})]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsx(ct,{variant:"outline",size:"sm",onClick:()=>o(h),className:"flex-1 text-xs",children:"Edit"}),e.jsx(ct,{variant:"outline",size:"sm",onClick:()=>u(h),disabled:c.isPending,className:"flex-1 text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10",children:"Delete"})]})]},h.id))}):e.jsxs("div",{className:"p-12 text-center rounded-lg bg-card-dark border border-border-dark",children:[e.jsx(ya,{size:48,className:"mx-auto text-text-secondary mb-4"}),e.jsx("p",{className:"text-text-secondary",children:"No portals configured"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Create a portal to start accepting iSCSI connections"})]}),(t||n)&&e.jsx(yS,{portal:n,onClose:()=>{s(!1),o(null)},onSuccess:()=>{r.invalidateQueries({queryKey:["scst-portals"]}),s(!1),o(null)}})]})}function yS({portal:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(r?.ip_address||"0.0.0.0"),[l,d]=Ce.useState(r?.port||3260),[c,u]=Ce.useState(r?.is_active??!0),h=Nr(),m=ft({mutationFn:v=>br.createPortal(v),onSuccess:()=>{h.invalidateQueries({queryKey:["scst-portals"]}),s()},onError:v=>{alert(`Failed to create portal: ${v.response?.data?.error||v.message}`)}}),x=ft({mutationFn:v=>br.updatePortal(r.id,v),onSuccess:()=>{h.invalidateQueries({queryKey:["scst-portals"]}),s()},onError:v=>{alert(`Failed to update portal: ${v.response?.data?.error||v.message}`)}}),y=v=>{v.preventDefault();const N={ip_address:n.trim(),port:parseInt(l.toString()),is_active:c};r?x.mutate(N):m.mutate(N)},p=m.isPending||x.isPending;return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:t,children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl max-w-md w-full",onClick:v=>v.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-border-dark flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:r?"Edit Portal":"Create Portal"}),e.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded-lg text-text-secondary hover:text-white transition-colors",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"ipAddress",className:"block text-sm font-medium text-white mb-1",children:"IP Address *"}),e.jsx("input",{id:"ipAddress",type:"text",value:n,onChange:v=>o(v.target.value),placeholder:"0.0.0.0 (all interfaces) or specific IP",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Use 0.0.0.0 to listen on all interfaces, or specify an IP address"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"port",className:"block text-sm font-medium text-white mb-1",children:"Port *"}),e.jsx("input",{id:"port",type:"number",value:l,onChange:v=>d(parseInt(v.target.value)||3260),min:"1",max:"65535",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Default iSCSI port is 3260"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{id:"isActive",type:"checkbox",checked:c,onChange:v=>u(v.target.checked),className:"w-4 h-4 rounded bg-[#0f161d] border-border-dark text-primary focus:ring-primary"}),e.jsx("label",{htmlFor:"isActive",className:"text-sm text-white",children:"Active"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,disabled:p,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:p,children:p?r?"Updating...":"Creating...":r?"Update":"Create"})]})]})]})})}function wS(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState("all"),{data:l=[],isLoading:d}=dt({queryKey:["scst-initiators"],queryFn:br.listInitiators}),c=ft({mutationFn:br.removeInitiator,onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiators"]}),r.invalidateQueries({queryKey:["scst-targets"]})},onError:m=>{alert(`Failed to remove initiator: ${m.response?.data?.error||m.message}`)}}),u=l.filter(m=>{const x=m.iqn.toLowerCase().includes(t.toLowerCase())||m.target_iqn&&m.target_iqn.toLowerCase().includes(t.toLowerCase())||m.target_name&&m.target_name.toLowerCase().includes(t.toLowerCase()),y=n==="all"||n==="active"&&m.is_active||n==="inactive"&&!m.is_active;return x&&y}),h=m=>{confirm(`Remove initiator ${m.iqn}?`)&&c.mutate(m.id)};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-2xl font-bold",children:"iSCSI Initiators"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage initiator access control lists"})]})}),e.jsxs("div",{className:"p-4 flex items-center justify-between gap-4 border-b border-border-dark/50 bg-[#141d26]",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search initiators by IQN or target...",value:t,onChange:m=>s(m.target.value),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg pl-10 pr-4 py-2 text-sm text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-text-secondary/50"})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-md bg-[#0f161d] border border-border-dark",children:[e.jsx("span",{className:"text-xs text-text-secondary font-medium",children:"Filter:"}),e.jsxs("select",{value:n,onChange:m=>o(m.target.value),className:"bg-[#0f161d] text-xs text-white font-medium focus:outline-none cursor-pointer border-none appearance-none pr-6",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 0 center",paddingRight:"24px"},children:[e.jsx("option",{value:"all",className:"bg-[#0f161d] text-white",children:"All Status"}),e.jsx("option",{value:"active",className:"bg-[#0f161d] text-white",children:"Active"}),e.jsx("option",{value:"inactive",className:"bg-[#0f161d] text-white",children:"Inactive"})]})]})})]}),d?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading initiators..."}):u.length>0?e.jsx("div",{className:"bg-[#141d26] border border-border-dark rounded-lg overflow-hidden",children:e.jsx("div",{className:"divide-y divide-border-dark",children:u.map(m=>e.jsxs("div",{className:"p-4 hover:bg-white/5 transition-colors flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-4",children:[e.jsx("div",{className:"p-2 rounded-md bg-primary/10 text-primary",children:e.jsx(ya,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("span",{className:"text-white font-mono text-sm font-medium truncate",children:m.iqn}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wide border ${m.is_active?"bg-green-500/20 text-green-400 border-green-500/20":"bg-red-500/20 text-red-400 border-red-500/20"}`,children:m.is_active?"Active":"Inactive"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-secondary flex-wrap mt-1",children:[m.target_iqn&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-text-secondary/80",children:"Target:"}),e.jsx("span",{className:"font-mono text-white/90 truncate max-w-[300px]",title:m.target_iqn,children:m.target_name||m.target_iqn.split(":").pop()})]}),m.group_name&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-text-secondary/80",children:"Group:"}),e.jsx("span",{className:"font-mono text-white/90 truncate max-w-[300px]",title:m.group_name,children:m.group_name})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(m.iqn)},className:"p-2 hover:bg-white/10 rounded-lg text-text-secondary hover:text-white transition-colors",title:"Copy IQN",children:e.jsx(so,{size:16})}),e.jsx("button",{onClick:()=>h(m),disabled:c.isPending,className:"p-2 hover:bg-red-500/10 rounded-lg text-text-secondary hover:text-red-400 transition-colors",title:"Remove initiator",children:e.jsx(es,{size:16})})]})]},m.id))})}):e.jsxs("div",{className:"p-12 text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-border-dark/50 mb-4",children:e.jsx(ya,{className:"text-text-secondary",size:32})}),e.jsx("p",{className:"text-white font-medium mb-1",children:"No initiators found"}),e.jsx("p",{className:"text-text-secondary text-sm",children:t||n!=="all"?"Try adjusting your search or filter criteria":"Initiators will appear here once they are added to targets"})]})]})}function vS(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState(!1),[l,d]=Ce.useState([]),{data:c=[],isLoading:u}=dt({queryKey:["scst-extents"],queryFn:()=>br.listExtents(),refetchInterval:3e3,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0,staleTime:0,gcTime:0,structuralSharing:!1}),{data:h}=dt({queryKey:["scst-handlers"],queryFn:br.listHandlers});Ce.useEffect(()=>{h&&d(h.map(p=>({name:p.name,label:p.label,description:p.description})))},[h]);const m=ft({mutationFn:br.deleteExtent,onMutate:async p=>{await r.cancelQueries({queryKey:["scst-extents"]}),await r.cancelQueries({queryKey:["scst-targets"]});const v=r.getQueryData(["scst-extents"]);return r.setQueryData(["scst-extents"],N=>N?N.filter(B=>B.device_name!==p):[]),{previousExtents:v}},onSuccess:async()=>{r.removeQueries({queryKey:["scst-extents"]}),r.removeQueries({queryKey:["scst-targets"]}),await r.invalidateQueries({queryKey:["scst-extents"]}),await r.invalidateQueries({queryKey:["scst-targets"]}),await r.refetchQueries({queryKey:["scst-extents"],type:"all"}),await r.refetchQueries({queryKey:["scst-targets"],type:"all"})},onError:(p,v,N)=>{N?.previousExtents&&r.setQueryData(["scst-extents"],N.previousExtents),r.refetchQueries({queryKey:["scst-extents"]}),alert(`Failed to delete extent: ${p.response?.data?.error||p.message}`)}}),x=c.filter(p=>p.device_name.toLowerCase().includes(t.toLowerCase())||p.device_path.toLowerCase().includes(t.toLowerCase())||p.handler_type.toLowerCase().includes(t.toLowerCase())),y=p=>{if(p.is_in_use){alert(`Cannot delete extent ${p.device_name}: it is in use by ${p.lun_count} LUN(s)`);return}confirm(`Delete extent ${p.device_name}?`)&&m.mutate(p.device_name)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-2xl font-bold",children:"iSCSI Extents"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage device extents (opened devices) for iSCSI LUNs"})]}),e.jsxs(ct,{onClick:()=>o(!0),className:"flex items-center gap-2 px-4 h-10 rounded-lg bg-primary hover:bg-blue-600 text-white text-sm font-bold",children:[e.jsx(Ks,{size:20}),e.jsx("span",{children:"Create Extent"})]})]}),e.jsx("div",{className:"p-4 flex items-center justify-between gap-4 border-b border-border-dark/50 bg-[#141d26]",children:e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search extents by device name, path, or handler...",value:t,onChange:p=>s(p.target.value),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg pl-10 pr-4 py-2 text-sm text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-text-secondary/50"})]})}),u?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading extents..."}):x.length>0?e.jsx("div",{className:"bg-[#141d26] border border-border-dark rounded-lg overflow-hidden",children:e.jsx("div",{className:"divide-y divide-border-dark",children:x.map((p,v)=>e.jsxs("div",{className:"p-4 hover:bg-white/5 transition-colors flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-4",children:[e.jsx("div",{className:`p-2 rounded-md ${p.is_in_use?"bg-yellow-500/10 text-yellow-400":"bg-primary/10 text-primary"}`,children:e.jsx(Ul,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("span",{className:"text-white font-mono text-sm font-medium",children:p.device_name}),p.is_in_use&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wide border bg-yellow-500/20 text-yellow-400 border-yellow-500/20",children:["In Use (",p.lun_count," LUN",p.lun_count!==1?"s":"",")"]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-secondary",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium",children:"Handler:"}),e.jsx("span",{className:"truncate",children:p.handler_type})]}),p.device_path&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium",children:"Path:"}),e.jsx("span",{className:"font-mono truncate max-w-[400px]",children:p.device_path})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{p.device_path&&navigator.clipboard.writeText(p.device_path)},className:"p-2 hover:bg-white/10 rounded-lg text-text-secondary hover:text-white transition-colors",title:"Copy device path",children:e.jsx(so,{size:16})}),e.jsx("button",{onClick:()=>y(p),disabled:m.isPending||p.is_in_use,className:"p-2 hover:bg-red-500/10 rounded-lg text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:p.is_in_use?"Cannot delete: extent is in use":"Delete extent",children:e.jsx(es,{size:16})})]})]},`${p.handler_type}-${p.device_name}-${v}`))})}):e.jsxs("div",{className:"p-12 text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-border-dark/50 mb-4",children:e.jsx(Ul,{className:"text-text-secondary",size:32})}),e.jsx("p",{className:"text-white font-medium mb-1",children:"No extents found"}),e.jsx("p",{className:"text-text-secondary text-sm",children:t?"Try adjusting your search criteria":"Create an extent to make a device available for iSCSI LUNs"})]}),n&&e.jsx(NS,{handlers:l,onClose:()=>o(!1),onSuccess:async()=>{o(!1),r.removeQueries({queryKey:["scst-extents"]}),await r.invalidateQueries({queryKey:["scst-extents"]}),await r.refetchQueries({queryKey:["scst-extents"],type:"active"})}})]})}function NS({handlers:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(""),[l,d]=Ce.useState(""),[c,u]=Ce.useState(""),h=ft({mutationFn:y=>br.createExtent(y),onSuccess:async()=>{await s(),alert("Extent created successfully!")},onError:y=>{alert(`Failed to create extent: ${y.response?.data?.error||y.message}`)}}),m=y=>{if(y.preventDefault(),!n||!l||!c){alert("Please fill in all required fields");return}h.mutate({device_name:n,device_path:l,handler_type:c})},x=y=>{if(d(y),!n&&y){const p=y.split("/"),v=p[p.length-1];v&&o(v)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#141d26] border border-border-dark rounded-lg p-6 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Create Extent"}),e.jsx("button",{onClick:t,className:"text-text-secondary hover:text-white transition-colors",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:m,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"handlerType",className:"block text-sm font-medium text-white mb-1",children:"Handler Type *"}),e.jsxs("select",{id:"handlerType",value:c,onChange:y=>u(y.target.value),className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0,children:[e.jsx("option",{value:"",children:"Select handler..."}),r.map(y=>e.jsxs("option",{value:y.name,className:"bg-[#0f161d] text-white",children:[y.label||y.name," - ",y.description]},y.name))]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"devicePath",className:"block text-sm font-medium text-white mb-1",children:"Device Path *"}),e.jsx("input",{id:"devicePath",type:"text",value:l,onChange:y=>x(y.target.value),placeholder:"/dev/zvol/pool/volume or /path/to/file",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Full path to the device or file"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"deviceName",className:"block text-sm font-medium text-white mb-1",children:"Device Name *"}),e.jsx("input",{id:"deviceName",type:"text",value:n,onChange:y=>o(y.target.value),placeholder:"LUN01",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Unique name for this device in SCST"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,disabled:h.isPending,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:h.isPending,children:h.isPending?"Creating...":"Create Extent"})]})]})]})})}function BS(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(null),[c,u]=Ce.useState(null),[h,m]=Ce.useState(null),{data:x=[],isLoading:y}=dt({queryKey:["scst-initiator-groups"],queryFn:br.listInitiatorGroups,refetchInterval:3e3,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0,staleTime:0,gcTime:0,structuralSharing:!1}),{data:p=[]}=dt({queryKey:["scst-targets"],queryFn:br.listTargets}),v=ft({mutationFn:L=>br.createInitiatorGroup(L),onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiator-groups"]}),r.invalidateQueries({queryKey:["scst-targets"]}),o(!1)},onError:L=>{alert(`Failed to create group: ${L.response?.data?.error||L.message}`)}}),N=ft({mutationFn:({id:L,data:K})=>br.updateInitiatorGroup(L,K),onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiator-groups"]}),r.invalidateQueries({queryKey:["scst-targets"]}),d(null)},onError:L=>{alert(`Failed to update group: ${L.response?.data?.error||L.message}`)}}),B=ft({mutationFn:L=>br.deleteInitiatorGroup(L),onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiator-groups"]}),r.invalidateQueries({queryKey:["scst-targets"]})},onError:L=>{alert(`Failed to delete group: ${L.response?.data?.error||L.message}`)}}),g=ft({mutationFn:({groupId:L,initiatorIQN:K})=>br.addInitiatorToGroup(L,K),onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiator-groups"]}),r.invalidateQueries({queryKey:["scst-targets"]}),r.invalidateQueries({queryKey:["scst-initiators"]}),m(null)},onError:L=>{alert(`Failed to add initiator: ${L.response?.data?.error||L.message}`)}}),j=ft({mutationFn:L=>br.removeInitiator(L),onSuccess:()=>{r.invalidateQueries({queryKey:["scst-initiator-groups"]}),r.invalidateQueries({queryKey:["scst-targets"]}),r.invalidateQueries({queryKey:["scst-initiators"]})},onError:L=>{alert(`Failed to remove initiator: ${L.response?.data?.error||L.message}`)}}),_=x.filter(L=>{const K=p.find(V=>V.id===L.target_id);return L.group_name.toLowerCase().includes(t.toLowerCase())||K&&((K.alias||K.iqn).toLowerCase().includes(t.toLowerCase())||K.iqn.toLowerCase().includes(t.toLowerCase()))}),w=L=>{if(L.initiators&&L.initiators.length>0){alert(`Cannot delete group: Group contains ${L.initiators.length} initiator(s). Please remove all initiators first.`);return}confirm(`Delete initiator group "${L.group_name}"?`)&&B.mutate(L.id)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-2xl font-bold",children:"iSCSI Initiator Groups"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage initiator access control groups"})]}),e.jsxs(ct,{onClick:()=>o(!0),children:[e.jsx(Ks,{size:16,className:"mr-2"}),"Create Group"]})]}),e.jsx("div",{className:"p-4 flex items-center justify-between gap-4 border-b border-border-dark/50 bg-[#141d26]",children:e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search groups by name or target...",value:t,onChange:L=>s(L.target.value),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg pl-10 pr-4 py-2 text-sm text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-text-secondary/50"})]})}),y?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading groups..."}):_.length>0?e.jsx("div",{className:"bg-[#141d26] border border-border-dark rounded-lg overflow-hidden",children:e.jsx("div",{className:"divide-y divide-border-dark",children:_.map(L=>{const K=p.find(V=>V.id===L.target_id),M=c===L.id;return e.jsxs("div",{className:"border-b border-border-dark last:border-b-0",children:[e.jsx("div",{className:"p-4 hover:bg-white/5 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("button",{onClick:()=>u(M?null:L.id),className:"p-2 rounded-md bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:M?e.jsx(wh,{size:20}):e.jsx(Ka,{size:20})}),e.jsx("div",{className:"p-2 rounded-md bg-primary/10 text-primary",children:e.jsx(ya,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-3 mb-1",children:e.jsx("span",{className:"text-white font-mono text-sm font-medium",children:L.group_name})}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-secondary",children:[K&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium",children:"Target:"}),e.jsx("span",{className:"font-mono truncate max-w-[300px]",title:K.iqn,children:K.alias||K.iqn.split(":").pop()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium",children:"Initiators:"}),e.jsx("span",{className:"text-white/90",children:L.initiators?.length||0})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(L.created_at).toLocaleDateString()})]})]})]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d(L),className:"p-2 hover:bg-white/10 rounded-lg text-text-secondary hover:text-white transition-colors",title:"Edit group name",children:e.jsx(vc,{size:16})}),e.jsx("button",{onClick:()=>w(L),disabled:B.isPending,className:"p-2 hover:bg-red-500/10 rounded-lg text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50",title:"Delete group",children:e.jsx(es,{size:16})})]})]})}),M&&e.jsxs("div",{className:"px-4 pb-4 bg-[#0f161d] border-t border-border-dark",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 mt-3",children:[e.jsx("h4",{className:"text-white text-sm font-semibold",children:"Group Members"}),e.jsxs(ct,{size:"sm",onClick:()=>m(L.id),variant:"outline",children:[e.jsx(Ks,{size:14,className:"mr-1"}),"Add Initiator"]})]}),L.initiators&&L.initiators.length>0?e.jsx("div",{className:"space-y-2",children:L.initiators.map(V=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#141d26] border border-border-dark rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 rounded bg-primary/10 text-primary",children:e.jsx(ya,{size:14})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-white font-mono text-xs truncate",children:V.iqn}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold uppercase ${V.is_active?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:V.is_active?"Active":"Inactive"})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(V.iqn)},className:"p-1.5 hover:bg-white/10 rounded text-text-secondary hover:text-white transition-colors",title:"Copy IQN",children:e.jsx(so,{size:14})}),e.jsx("button",{onClick:()=>{confirm(`Remove initiator "${V.iqn}" from this group?`)&&j.mutate(V.id)},disabled:j.isPending,className:"p-1.5 hover:bg-red-500/10 rounded text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50",title:"Remove initiator",children:e.jsx(es,{size:14})})]})]},V.id))}):e.jsxs("div",{className:"p-6 text-center border border-border-dark rounded-lg bg-[#141d26]",children:[e.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"No initiators in this group"}),e.jsxs(ct,{size:"sm",onClick:()=>m(L.id),variant:"outline",children:[e.jsx(Ks,{size:14,className:"mr-1"}),"Add First Initiator"]})]})]})]},L.id)})})}):e.jsxs("div",{className:"p-12 text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-border-dark/50 mb-4",children:e.jsx(ya,{className:"text-text-secondary",size:32})}),e.jsx("p",{className:"text-white font-medium mb-1",children:"No groups found"}),e.jsx("p",{className:"text-text-secondary text-sm",children:t?"Try adjusting your search criteria":"Create an initiator group to organize initiators by access control"})]}),n&&e.jsx(jS,{targets:p,onClose:()=>o(!1),isLoading:v.isPending,onSubmit:L=>v.mutate(L)}),l&&e.jsx(CS,{group:l,onClose:()=>d(null),isLoading:N.isPending,onSubmit:L=>N.mutate({id:l.id,data:L})}),h&&e.jsx(SS,{groupName:x.find(L=>L.id===h)?.group_name||"",onClose:()=>m(null),isLoading:g.isPending,onSubmit:L=>g.mutate({groupId:h,initiatorIQN:L})})]})}function jS({targets:r,onClose:t,isLoading:s,onSubmit:n}){const[o,l]=Ce.useState(""),[d,c]=Ce.useState(""),u=h=>{if(h.preventDefault(),!o||!d.trim()){alert("Please fill in all required fields");return}n({target_id:o,group_name:d.trim()})};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#141d26] border border-border-dark rounded-lg p-6 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Create Initiator Group"}),e.jsx("button",{onClick:t,className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Target *"}),e.jsxs("select",{value:o,onChange:h=>l(h.target.value),className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0,children:[e.jsx("option",{value:"",children:"Select a target"}),r.map(h=>e.jsxs("option",{value:h.id,className:"bg-[#0f161d] text-white",children:[h.alias||h.iqn.split(":").pop()," (",h.iqn,")"]},h.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Group Name *"}),e.jsx("input",{type:"text",value:d,onChange:h=>c(h.target.value),placeholder:"my-acl-group",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Group name will be used as ACL group name in SCST"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 mt-6",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,disabled:s,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:s,children:s?"Creating...":"Create"})]})]})]})})}function CS({group:r,onClose:t,isLoading:s,onSubmit:n}){const[o,l]=Ce.useState(r.group_name),d=c=>{if(c.preventDefault(),!o.trim()){alert("Group name cannot be empty");return}n({group_name:o.trim()})};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#141d26] border border-border-dark rounded-lg p-6 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Edit Initiator Group"}),e.jsx("button",{onClick:t,className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:d,children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Group Name *"}),e.jsx("input",{type:"text",value:o,onChange:c=>l(c.target.value),placeholder:"my-acl-group",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Changing the group name will recreate it in SCST"})]})}),e.jsxs("div",{className:"flex items-center justify-end gap-3 mt-6",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,disabled:s,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:s,children:s?"Updating...":"Update"})]})]})]})})}function SS({groupName:r,onClose:t,isLoading:s,onSubmit:n}){const[o,l]=Ce.useState(""),d=c=>{if(c.preventDefault(),!o.trim()){alert("Please enter an initiator IQN");return}if(!o.trim().toLowerCase().startsWith("iqn.")){alert('Invalid IQN format. IQN must start with "iqn."');return}n(o.trim())};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#141d26] border border-border-dark rounded-lg p-6 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Add Initiator to Group"}),e.jsx("button",{onClick:t,className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:d,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Group"}),e.jsx("input",{type:"text",value:r,disabled:!0,className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white/60 text-sm cursor-not-allowed"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Initiator IQN *"}),e.jsx("input",{type:"text",value:o,onChange:c=>l(c.target.value),placeholder:"iqn.1993-08.org.debian:01:example",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary font-mono",required:!0}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Enter the IQN of the initiator to add to this group"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 mt-6",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,disabled:s,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:s,children:s?"Adding...":"Add Initiator"})]})]})]})})}function _S(){const[r,t]=Ce.useState(""),[s,n]=Ce.useState(!0),[o,l]=Ce.useState(!1),[d,c]=Ce.useState(""),[u,h]=Ce.useState("/etc/scst.conf"),m=Ce.useRef(null),{data:x,refetch:y,isFetching:p}=dt({queryKey:["scst-config-file"],queryFn:()=>br.getConfigFile()});Ce.useEffect(()=>{x&&(t(x.content),c(x.content),h(x.path),l(!1),n(!1))},[x]),Ce.useEffect(()=>{p?n(!0):x&&n(!1)},[p,x]);const v=ft({mutationFn:j=>br.updateConfigFile(j),onSuccess:()=>{c(r),l(!1),alert("Configuration file saved successfully!")},onError:j=>{alert(`Failed to save configuration: ${j.response?.data?.error||j.message}`)}}),N=j=>{t(j.target.value),l(j.target.value!==d)},B=()=>{o&&confirm("Save changes to scst.conf? This will update the SCST configuration.")&&v.mutate(r)},g=()=>{o&&!confirm("You have unsaved changes. Reload anyway?")||(n(!0),y())};return Ce.useEffect(()=>{m.current&&m.current.focus()},[]),e.jsxs("div",{className:"flex flex-col h-full min-h-[600px] bg-[#0a0f14] border border-border-dark rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex-none px-6 py-4 border-b border-border-dark bg-[#141d26] flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Uh,{className:"text-primary",size:20}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-sm",children:"SCST Configuration Editor"}),e.jsx("p",{className:"text-text-secondary text-xs mt-0.5",children:"Edit /etc/scst.conf file directly"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ct,{variant:"outline",size:"sm",onClick:g,disabled:s,className:"flex items-center gap-2",children:[e.jsx(Cn,{size:16,className:s?"animate-spin":""}),e.jsx("span",{children:"Reload"})]}),e.jsxs(ct,{size:"sm",onClick:B,disabled:!o||v.isPending,className:"flex items-center gap-2 bg-primary hover:bg-blue-600",children:[e.jsx(up,{size:16}),e.jsx("span",{children:v.isPending?"Saving...":"Save"})]})]})]}),e.jsx("div",{className:"flex-1 relative overflow-hidden",children:s?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-text-secondary",children:[e.jsx(Cn,{size:24,className:"animate-spin mx-auto mb-2"}),e.jsx("p",{children:"Loading configuration..."})]})}):e.jsx("textarea",{ref:m,value:r,onChange:N,className:"w-full h-full p-4 bg-[#0a0f14] text-green-400 font-mono text-sm resize-none focus:outline-none focus:ring-0 border-0",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',lineHeight:"1.6",tabSize:2},spellCheck:!1,placeholder:"Loading configuration file..."})}),e.jsxs("div",{className:"flex-none px-6 py-3 border-t border-border-dark bg-[#141d26] flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-4 text-text-secondary",children:[e.jsxs("span",{children:["Path: ",u]}),o&&e.jsxs("span",{className:"text-yellow-400 flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-yellow-400 rounded-full"}),"Unsaved changes"]})]}),e.jsxs("div",{className:"text-text-secondary",children:[r.split(` +`).length," lines"]})]})]})}function kS(){const{id:r}=jy(),t=Ph(),s=Nr(),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(!1);Ce.useEffect(()=>{console.log("showAddLUN state:",n)},[n]);const{data:c,isLoading:u}=dt({queryKey:["scst-target",r],queryFn:()=>br.getTarget(r),enabled:!!r}),h=ft({mutationFn:({targetId:p,lunId:v})=>br.removeLUN(p,v),onMutate:async({lunId:p})=>{await s.cancelQueries({queryKey:["scst-target",r]}),await s.cancelQueries({queryKey:["scst-targets"]});const v=s.getQueryData(["scst-target",r]),N=s.getQueryData(["scst-targets"]);return s.setQueryData(["scst-target",r],B=>B&&{...B,luns:B.luns?B.luns.filter(g=>g.id!==p):[]}),s.setQueryData(["scst-targets"],B=>B&&B.map(g=>g.id===r?{...g,lun_count:Math.max(0,(g.lun_count||0)-1)}:g)),{previousTarget:v,previousTargets:N}},onSuccess:()=>{s.invalidateQueries({queryKey:["scst-target",r]}),s.invalidateQueries({queryKey:["scst-targets"]})},onError:(p,v,N)=>{if(p.response?.status===404){s.invalidateQueries({queryKey:["scst-target",r]}),s.invalidateQueries({queryKey:["scst-targets"]});return}N?.previousTarget&&s.setQueryData(["scst-target",r],N.previousTarget),N?.previousTargets&&s.setQueryData(["scst-targets"],N.previousTargets),alert(`Failed to remove LUN: ${p.response?.data?.error||p.message}`)}});if(u)return e.jsx("div",{className:"text-sm text-text-secondary min-h-screen bg-background-dark p-6",children:"Loading target details..."});if(!c)return e.jsx("div",{className:"text-sm text-red-400 min-h-screen bg-background-dark p-6",children:"Target not found"});const{target:m,luns:x}=c,y=x||[];return e.jsxs("div",{className:"space-y-6 min-h-screen bg-background-dark p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(ct,{variant:"ghost",size:"sm",onClick:()=>t("/iscsi"),children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white font-mono text-lg",children:m.iqn}),m.alias&&e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:m.alias})]})]}),e.jsxs(ct,{variant:"outline",onClick:()=>{s.invalidateQueries({queryKey:["scst-target",r]})},children:[e.jsx(Cn,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"Target Status"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Status:"}),e.jsx("span",{className:m.is_active?"text-green-400":"text-text-secondary",children:m.is_active?"Active":"Inactive"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"IQN:"}),e.jsx("span",{className:"font-mono text-xs text-white",children:m.iqn})]})]})})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"LUNs"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Total LUNs:"}),e.jsx("span",{className:"font-medium text-white",children:y.length})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Active:"}),e.jsx("span",{className:"font-medium text-white",children:y.filter(p=>p.is_active).length})]})]})})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsx(wi,{className:"text-sm font-medium",children:"Actions"})}),e.jsx(vi,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ct,{variant:"outline",size:"sm",className:"w-full",onClick:()=>o(!0),children:[e.jsx(Ks,{className:"h-4 w-4 mr-2"}),"Assign Extent"]}),e.jsxs(ct,{variant:"outline",size:"sm",className:"w-full",onClick:()=>d(!0),children:[e.jsx(Vd,{className:"h-4 w-4 mr-2"}),"Add Initiator"]})]})})]})]}),e.jsxs(bi,{children:[e.jsx(yi,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(wi,{children:"LUNs (Logical Unit Numbers)"}),e.jsx(nu,{children:"Storage devices exported by this target"})]}),e.jsxs(ct,{variant:"outline",size:"sm",onClick:p=>{p.stopPropagation(),o(!0)},children:[e.jsx(Ks,{className:"h-4 w-4 mr-2"}),"Assign Extent"]})]})}),e.jsx(vi,{children:y.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-[#1a2632]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"LUN #"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Handler"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Device Path"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-secondary uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-card-dark divide-y divide-border-dark",children:y.map(p=>e.jsxs("tr",{className:"hover:bg-[#233648]",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-white",children:p.lun_number}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-text-secondary",children:p.handler}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-mono text-xs text-white",children:p.device_path}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-text-secondary",children:p.device_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${p.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:p.is_active?"Active":"Inactive"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm",children:e.jsx("button",{onClick:v=>{v.stopPropagation(),confirm(`Remove LUN ${p.lun_number} from this target?`)&&h.mutate({targetId:m.id,lunId:p.id})},disabled:h.isPending,className:"p-1.5 hover:bg-red-500/10 rounded text-text-secondary hover:text-red-400 transition-colors disabled:opacity-50",title:"Remove LUN",children:e.jsx(es,{size:16})})})]},p.id))})]})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Ul,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"No LUNs configured"}),e.jsxs(ct,{variant:"outline",onClick:p=>{p.stopPropagation(),o(!0)},children:[e.jsx(Ks,{className:"h-4 w-4 mr-2"}),"Assign First Extent"]})]})})]}),n&&e.jsx(FS,{targetId:m.id,onClose:()=>o(!1),onSuccess:async()=>{o(!1),s.invalidateQueries({queryKey:["scst-target",r]}),s.invalidateQueries({queryKey:["scst-extents"]})}}),l&&e.jsx(ES,{targetId:m.id,onClose:()=>d(!1),onSuccess:()=>{d(!1),s.invalidateQueries({queryKey:["scst-target",r]})}})]})}function FS({targetId:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(""),[l,d]=Ce.useState(0),{data:c=[],isLoading:u}=dt({queryKey:["scst-extents"],queryFn:br.listExtents,staleTime:0,refetchOnMount:!0}),h=c.filter(y=>!y.is_in_use),m=ft({mutationFn:y=>br.addLUN(r,y),onSuccess:async()=>{await s()},onError:y=>{const p=y.response?.data?.error||y.message||"Failed to assign extent";alert(p)}}),x=y=>{if(y.preventDefault(),!n||l<0){alert("Please select an extent and specify LUN number");return}const p=h.find(v=>v.device_name===n);if(!p){alert("Selected extent not found");return}m.mutate({device_name:p.device_name,device_path:p.device_path,handler_type:p.handler_type,lun_number:l})};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"p-6 border-b border-border-dark",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Assign Extent"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Assign an existing extent to this target as a LUN"})]}),e.jsxs("form",{onSubmit:x,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"extent",className:"block text-sm font-medium text-white mb-1",children:"Available Extent *"}),u?e.jsx("div",{className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-text-secondary text-sm",children:"Loading extents..."}):h.length===0?e.jsx("div",{className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-text-secondary text-sm",children:"No available extents. Please create an extent first in the Extents tab."}):e.jsxs("select",{id:"extent",value:n,onChange:y=>o(y.target.value),className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0,children:[e.jsx("option",{value:"",children:"Select an extent..."}),h.map(y=>e.jsxs("option",{value:y.device_name,children:[y.device_name," (",y.handler_type,") - ",y.device_path]},y.device_name))]}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Select an extent that has been created in the Extents tab"})]}),n&&e.jsxs("div",{className:"p-4 bg-[#0f161d] border border-border-dark rounded-lg",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:"Extent Details:"}),(()=>{const y=h.find(p=>p.device_name===n);return y?e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Device Name:"}),e.jsx("span",{className:"text-white font-mono",children:y.device_name})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Handler:"}),e.jsx("span",{className:"text-white",children:y.handler_type})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-text-secondary",children:"Path:"}),e.jsx("span",{className:"text-white font-mono text-xs",children:y.device_path})]})]}):null})()]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"lunNumber",className:"block text-sm font-medium text-white mb-1",children:"LUN Number *"}),e.jsx("input",{id:"lunNumber",type:"number",value:l,onChange:y=>d(parseInt(y.target.value)||0),min:"0",max:"255",className:"w-full px-3 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Logical Unit Number (0-255, typically start from 0)"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:m.isPending||h.length===0,children:m.isPending?"Assigning...":"Assign Extent"})]})]})]})})}function ES({targetId:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(""),l=ft({mutationFn:c=>br.addInitiator(r,c),onSuccess:()=>{s()}}),d=c=>{if(c.preventDefault(),!n){alert("Initiator IQN is required");return}l.mutate({initiator_iqn:n.trim()})};return e.jsxs(bi,{children:[e.jsxs(yi,{children:[e.jsx(wi,{children:"Add Initiator"}),e.jsx(nu,{children:"Allow an iSCSI initiator to access this target"})]}),e.jsx(vi,{children:e.jsxs("form",{onSubmit:d,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"initiatorIqn",className:"block text-sm font-medium text-gray-700 mb-1",children:"Initiator IQN *"}),e.jsx("input",{id:"initiatorIqn",type:"text",value:n,onChange:c=>o(c.target.value),placeholder:"iqn.2024-01.com.client:initiator1",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 font-mono text-sm",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Format: iqn.YYYY-MM.reverse.domain:identifier"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:l.isPending,children:l.isPending?"Adding...":"Add Initiator"})]})]})})]})}function US(){const[r,t]=Ce.useState(!1),[s,n]=Ce.useState(null),[o,l]=Ce.useState(null),[d,c]=Ce.useState(null),[u,h]=Ce.useState("Etc/UTC"),[m,x]=Ce.useState(["pool.ntp.org","time.google.com"]),[y,p]=Ce.useState(!1),[v,N]=Ce.useState(""),[B,g]=Ce.useState(!1),[j,_]=Ce.useState(""),w=Ce.useRef(null),L=Nr(),K=ft({mutationFn:U=>ao.saveNTPSettings(U),onSuccess:()=>{L.invalidateQueries({queryKey:["system","ntp"]}),alert("NTP settings saved successfully!")},onError:U=>{alert(`Failed to save NTP settings: ${U.message||"Unknown error"}`)}}),{data:M=[],isLoading:V}=dt({queryKey:["system","interfaces"],queryFn:()=>ao.listNetworkInterfaces(),refetchInterval:5e3}),{data:T=[],isLoading:ne}=dt({queryKey:["system","services"],queryFn:()=>ao.listServices(),refetchInterval:5e3}),{data:Z}=dt({queryKey:["system","ntp"],queryFn:()=>ao.getNTPSettings()});return Ce.useEffect(()=>{Z&&(h(Z.timezone),x(Z.ntp_servers))},[Z]),Ce.useEffect(()=>{const U=q=>{w.current&&!w.current.contains(q.target)&&n(null)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]),e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden relative bg-background-dark",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b border-border-dark bg-background-dark px-6 lg:px-10 shrink-0 z-10",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ba,{to:"/",className:"text-text-secondary hover:text-white transition-colors",children:"System"}),e.jsx("span",{className:"text-text-secondary",children:"/"}),e.jsx("span",{className:"text-white font-medium",children:"Configuration"})]})}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 px-3 py-1.5 rounded-full bg-green-500/10 border border-green-500/20",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{className:"text-xs font-medium text-green-500",children:"System Healthy"})]}),e.jsx("div",{className:"h-6 w-px bg-border-dark mx-2"}),e.jsxs("button",{className:"flex items-center justify-center gap-2 rounded-lg bg-border-dark px-4 py-2 text-sm font-bold text-white hover:bg-[#2f455a] transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"restart_alt"}),e.jsx("span",{className:"hidden sm:inline",children:"Reboot"})]}),e.jsxs("button",{className:"flex items-center justify-center gap-2 rounded-lg bg-red-500/10 px-4 py-2 text-sm font-bold text-red-500 hover:bg-red-500/20 transition-colors border border-red-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"}),e.jsx("span",{className:"hidden sm:inline",children:"Shutdown"})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-8 lg:px-12 scroll-smooth",children:e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsxs("div",{className:"mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white mb-2",children:"System Configuration"}),e.jsx("p",{className:"text-text-secondary text-sm max-w-2xl",children:"Manage network interfaces, time synchronization, service states, and remote management protocols."})]}),e.jsxs("button",{className:"flex items-center justify-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-blue-600 transition-all shadow-lg shadow-blue-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"save"}),"Save Changes"]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-card-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"verified"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Feature License"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Licensed"})]})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-sm font-bold text-white",children:"License Status"}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Enterprise Edition"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-green-500/10 border border-green-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-green-500 text-[16px]",children:"check_circle"}),e.jsx("span",{className:"text-xs font-bold text-green-500",children:"Active"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"License Key"}),e.jsx("span",{className:"text-xs font-mono text-white",children:"CAL-****-****-****-****-****"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Expires"}),e.jsx("span",{className:"text-xs font-bold text-white",children:"Dec 31, 2025"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Days Remaining"}),e.jsx("span",{className:"text-xs font-bold text-emerald-400",children:"365 days"})]})]}),e.jsxs("div",{className:"border-t border-border-dark pt-4",children:[e.jsx("h3",{className:"text-sm font-bold text-white mb-3",children:"Enabled Features"}),e.jsx("div",{className:"flex flex-col gap-2",children:[{name:"Advanced Replication",enabled:!0},{name:"Encryption at Rest",enabled:!0},{name:"Deduplication",enabled:!0},{name:"Cloud Backup Integration",enabled:!0},{name:"Multi-Site Sync",enabled:!0},{name:"Advanced Monitoring",enabled:!0}].map(U=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-[#111a22]",children:[e.jsx("span",{className:"text-xs text-white",children:U.name}),U.enabled?e.jsx("span",{className:"material-symbols-outlined text-green-500 text-[16px]",children:"check_circle"}):e.jsx("span",{className:"material-symbols-outlined text-text-secondary text-[16px]",children:"cancel"})]},U.name))})]}),e.jsxs("div",{className:"border-t border-border-dark pt-4 flex flex-col gap-2",children:[e.jsxs("button",{onClick:()=>g(!0),className:"w-full flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2.5 text-sm font-bold text-white hover:bg-blue-600 transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"key"}),"Update License Key"]}),e.jsxs("button",{onClick:()=>{alert("Downloading license information...")},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-border-dark px-4 py-2.5 text-sm font-bold text-white hover:bg-[#2f455a] transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"download"}),"Download License Info"]})]})]})]}),e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-card-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"lan"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Network Interfaces"})]}),e.jsx("button",{className:"text-xs font-bold text-primary hover:text-blue-400",children:"CONFIGURE DNS"})]}),e.jsx("div",{className:"p-2",children:V?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("span",{className:"text-text-secondary",children:"Loading interfaces..."})}):M.length===0?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("span",{className:"text-text-secondary",children:"No network interfaces found"})}):M.map(U=>{const q=U.status==="Connected",F=U.role==="ISCSI"?"bg-purple-500/20":"bg-primary/20",le=U.role==="ISCSI"?"text-purple-400":"text-primary";return e.jsxs("div",{className:`group flex items-center justify-between rounded-lg p-3 hover:bg-border-dark/50 transition-colors ${q?"":"opacity-70"}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-border-dark ${q?"text-white":"text-text-secondary"}`,children:e.jsx("span",{className:"material-symbols-outlined",children:"settings_ethernet"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:`font-bold ${q?"text-white":"text-text-secondary"}`,children:U.name}),U.role&&e.jsx("span",{className:`rounded ${F} px-1.5 py-0.5 text-[10px] font-bold ${le} uppercase`,children:U.role})]}),U.ip_address?e.jsxs("p",{className:"font-mono text-xs text-text-secondary",children:[U.ip_address," ",e.jsx("span",{className:"opacity-50 mx-1",children:"/"})," ",U.subnet]}):e.jsx("p",{className:"font-mono text-xs text-text-secondary",children:"No Carrier"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"hidden sm:flex flex-col items-end",children:q?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsx("span",{className:"text-xs font-medium text-white",children:"Connected"})]}),U.speed&&U.speed!=="Unknown"&&e.jsx("span",{className:"text-xs text-text-secondary",children:U.speed})]}):e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-red-500"}),e.jsx("span",{className:"text-xs font-medium text-red-500",children:"Down"})]})}),e.jsxs("div",{className:"relative",ref:w,children:[e.jsx("button",{onClick:()=>n(s===U.name?null:U.name),className:"h-8 w-8 rounded-full hover:bg-border-dark flex items-center justify-center text-text-secondary hover:text-white transition-colors",children:e.jsx("span",{className:"material-symbols-outlined",children:"more_vert"})}),s===U.name&&e.jsxs("div",{className:"absolute right-0 mt-1 w-48 rounded-lg border border-border-dark bg-card-dark shadow-lg z-50",children:[e.jsxs("button",{onClick:()=>{l(U),n(null)},className:"w-full flex items-center gap-2 px-4 py-2.5 text-sm text-white hover:bg-border-dark transition-colors first:rounded-t-lg",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),e.jsx("span",{children:"Edit Connection"})]}),e.jsxs("button",{onClick:()=>{c(U),n(null)},className:"w-full flex items-center gap-2 px-4 py-2.5 text-sm text-white hover:bg-border-dark transition-colors",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"info"}),e.jsx("span",{children:"View Details"})]}),e.jsx("div",{className:"border-t border-border-dark"}),e.jsxs("button",{onClick:()=>{n(null)},className:"w-full flex items-center gap-2 px-4 py-2.5 text-sm text-white hover:bg-border-dark transition-colors last:rounded-b-lg",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:q?"toggle_on":"toggle_off"}),e.jsx("span",{children:q?"Disable":"Enable"})]})]})]})]})]},U.name)})})]}),e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-card-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"memory"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Service Control"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"All Systems Normal"})]})]}),e.jsx("div",{className:"p-4 flex flex-col gap-1",children:ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("span",{className:"text-text-secondary",children:"Loading services..."})}):[{key:"ssh",serviceNames:["ssh","sshd"],displayName:"SSH Service",description:"Remote command line access",icon:"terminal"},{key:"smb",serviceNames:["smbd","samba","smb"],displayName:"SMB / CIFS",description:"Windows file sharing",icon:"folder_shared"},{key:"iscsi",serviceNames:["iscsi-scst","iscsi","scst"],displayName:"iSCSI Target",description:"Block storage sharing",icon:"storage"},{key:"nfs",serviceNames:["nfs-server","nfs","nfsd"],displayName:"NFS Service",description:"Unix file sharing",icon:"share"},{key:"vtl",serviceNames:["mhvtl","vtl"],displayName:"VTL Service",description:"Virtual tape library emulation",icon:"album"}].map(U=>{const q=T.find(se=>{const fe=se.name.toLowerCase();return U.serviceNames.some(ye=>fe.includes(ye.toLowerCase())||ye.toLowerCase().includes(fe))}),F=q?.active_state==="active",le=F?"RUNNING":"STOPPED",ae=F?"bg-green-500/20 text-green-500 border-green-500/20":"bg-yellow-500/20 text-yellow-500 border-yellow-500/20";return e.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-[#111a22] p-3 border border-transparent hover:border-border-dark transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded bg-border-dark/50 text-white",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:U.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-white",children:U.displayName}),e.jsx("p",{className:"text-xs text-text-secondary",children:U.description})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold border ${ae}`,children:le}),e.jsxs("label",{className:"relative inline-block w-10 h-5 mr-2 align-middle select-none cursor-pointer",children:[e.jsx("input",{checked:F,onChange:()=>{q&&ao.restartService(q.name).then(()=>{L.invalidateQueries({queryKey:["system","services"]})}).catch(se=>{alert(`Failed to ${F?"stop":"start"} service: ${se.message||"Unknown error"}`)})},className:"sr-only peer",id:`${U.key}-toggle`,name:"toggle",type:"checkbox"}),e.jsx("span",{className:"absolute inset-0 rounded-full bg-border-dark transition-colors duration-300 peer-checked:bg-primary/20"}),e.jsx("span",{className:"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-white transition-transform duration-300 peer-checked:translate-x-5"})]})]})]},U.key)})})]}),e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-card-dark shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"schedule"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Date & Time"})]}),e.jsxs("button",{onClick:()=>{K.mutate({timezone:u,ntp_servers:m})},disabled:K.isPending,className:"flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-bold text-white hover:bg-blue-600 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"save"}),K.isPending?"Saving...":"Save"]})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"System Timezone"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:u,onChange:U=>h(U.target.value),className:"block w-full rounded-lg border-border-dark bg-[#111a22] py-2.5 pl-3 pr-10 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary appearance-none",children:[e.jsx("option",{children:"Etc/UTC"}),e.jsx("option",{children:"Asia/Jakarta"}),e.jsx("option",{children:"Asia/Singapore"}),e.jsx("option",{children:"Asia/Bangkok"}),e.jsx("option",{children:"Asia/Manila"}),e.jsx("option",{children:"Asia/Tokyo"}),e.jsx("option",{children:"Asia/Shanghai"}),e.jsx("option",{children:"Asia/Hong_Kong"}),e.jsx("option",{children:"Europe/London"}),e.jsx("option",{children:"Europe/Paris"}),e.jsx("option",{children:"America/New_York"}),e.jsx("option",{children:"America/Los_Angeles"})]}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-white",children:e.jsx("span",{className:"material-symbols-outlined text-sm",children:"expand_more"})})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-xs font-medium text-text-secondary uppercase",children:"NTP Servers"}),e.jsxs("button",{onClick:()=>p(!0),className:"text-xs text-primary font-bold hover:text-white flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"add"})," Add Server"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-[#111a22] p-3 border border-border-dark",children:[e.jsx("input",{type:"text",value:v,onChange:U=>N(U.target.value),onKeyDown:U=>{U.key==="Enter"&&v.trim()&&(m.includes(v.trim())||(x([...m,v.trim()]),N(""),p(!1))),U.key==="Escape"&&(N(""),p(!1))},placeholder:"Enter NTP server address (e.g., 0.pool.ntp.org)",className:"flex-1 bg-transparent text-sm text-white placeholder-gray-500 focus:outline-none",autoFocus:!0}),e.jsx("button",{onClick:()=>{v.trim()&&!m.includes(v.trim())&&(x([...m,v.trim()]),N(""),p(!1))},className:"text-green-500 hover:text-green-400",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"check"})}),e.jsx("button",{onClick:()=>{N(""),p(!1)},className:"text-red-500 hover:text-red-400",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}),m.map((U,q)=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-[#111a22] p-3 border border-border-dark",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{className:"text-sm font-mono text-white",children:U})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Stratum 2 • 12ms"}),e.jsx("button",{onClick:()=>{x(m.filter((F,le)=>le!==q))},className:"text-red-500 hover:text-red-400",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"delete"})})]})]},q))]})]})]})]}),e.jsxs("div",{className:"flex flex-col rounded-xl border border-border-dark bg-card-dark shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"hub"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Management"})]})}),e.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-white",children:"SNMP Monitoring"}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Enable Simple Network Management Protocol"})]}),e.jsxs("label",{className:"relative inline-block w-10 h-5 align-middle select-none cursor-pointer",children:[e.jsx("input",{checked:r,onChange:U=>t(U.target.checked),className:"sr-only peer",id:"snmp-toggle",name:"toggle",type:"checkbox"}),e.jsx("span",{className:"absolute inset-0 rounded-full bg-border-dark transition-colors duration-300 peer-checked:bg-primary/20"}),e.jsx("span",{className:"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-white transition-transform duration-300 peer-checked:translate-x-5"})]})]}),e.jsxs("div",{className:`grid grid-cols-1 gap-4 transition-opacity ${r?"opacity-100":"opacity-50 pointer-events-none"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-text-secondary uppercase",children:"Community String"}),e.jsx("input",{className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"e.g. public",type:"text",defaultValue:"public",disabled:!r})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-text-secondary uppercase",children:"Trap Receiver IP"}),e.jsx("input",{className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"e.g. 192.168.1.100",type:"text",disabled:!r})]})]})]}),e.jsxs("div",{className:"border-t border-border-dark pt-4",children:[e.jsx("h3",{className:"text-sm font-bold text-white mb-3",children:"Syslog Forwarding"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"Syslog Server Address (UDP:514)",type:"text"}),e.jsx("button",{className:"rounded-lg bg-border-dark px-4 py-2 text-sm font-bold text-white hover:bg-[#2f455a] transition-colors",children:"Test"})]})]})]})]})]}),e.jsx("div",{className:"h-10"})]})}),o&&e.jsx(QS,{interface:o,onClose:()=>l(null)}),d&&e.jsx(LS,{interface:d,onClose:()=>c(null)}),B&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>g(!1),children:e.jsxs("div",{className:"bg-card-dark rounded-xl border border-border-dark max-w-lg w-full",onClick:U=>U.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-border-dark flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Update License Key"}),e.jsx("button",{onClick:()=>{g(!1),_("")},className:"text-text-secondary hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"License Key"}),e.jsx("textarea",{className:"w-full bg-[#111a22] border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono resize-none",rows:4,placeholder:"Paste your license key here...",value:j,onChange:U=>_(U.target.value)}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Enter your license key to activate or update features. The key will be validated automatically."})]}),e.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-yellow-500 text-[18px]",children:"info"}),e.jsx("span",{className:"text-xs font-bold text-yellow-500",children:"Important"})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Updating the license key will restart the system services. Make sure you have a valid license key before proceeding."})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx("button",{onClick:()=>{g(!1),_("")},className:"px-4 py-2 rounded-lg border border-border-dark text-white hover:bg-border-dark transition-colors text-sm font-bold",children:"Cancel"}),e.jsx("button",{onClick:()=>{if(!j.trim()){alert("Please enter a license key");return}console.log("Updating license key:",j),alert("License key updated successfully!"),g(!1),_("")},className:"px-4 py-2 rounded-lg bg-primary hover:bg-blue-600 text-white transition-colors text-sm font-bold",children:"Update License"})]})]})]})})]})}function QS({interface:r,onClose:t}){const s=Nr(),[n,o]=Ce.useState({ip_address:r.ip_address||"",subnet:r.subnet||"24",gateway:r.gateway||"",dns1:r.dns1||"",dns2:r.dns2||"",role:r.role||""}),l=ft({mutationFn:c=>ao.updateNetworkInterface(r.name,c),onSuccess:()=>{s.invalidateQueries({queryKey:["system","interfaces"]}),t()},onError:c=>{alert(`Failed to update interface: ${c.response?.data?.error||c.message}`)}}),d=c=>{c.preventDefault(),l.mutate({ip_address:n.ip_address,subnet:n.subnet,gateway:n.gateway||void 0,dns1:n.dns1||void 0,dns2:n.dns2||void 0,role:n.role||void 0})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border-dark bg-card-dark shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"settings_ethernet"}),e.jsxs("h2",{className:"text-lg font-bold text-white",children:["Edit Connection - ",r.name]})]}),e.jsx("button",{onClick:t,className:"h-8 w-8 rounded-full hover:bg-border-dark flex items-center justify-center text-text-secondary hover:text-white transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),e.jsxs("form",{onSubmit:d,className:"p-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"IP Address"}),e.jsx("input",{type:"text",value:n.ip_address,onChange:c=>o({...n,ip_address:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"192.168.1.100",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Subnet Mask (CIDR)"}),e.jsx("input",{type:"text",value:n.subnet,onChange:c=>o({...n,subnet:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"24",required:!0}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Enter CIDR notation (e.g., 24 for 255.255.255.0)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Default Gateway"}),e.jsx("input",{type:"text",value:n.gateway,onChange:c=>o({...n,gateway:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"192.168.1.1"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Primary DNS"}),e.jsx("input",{type:"text",value:n.dns1,onChange:c=>o({...n,dns1:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"8.8.8.8"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Secondary DNS"}),e.jsx("input",{type:"text",value:n.dns2,onChange:c=>o({...n,dns2:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] p-2.5 text-sm text-white placeholder-gray-500 focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"8.8.4.4"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Interface Role"}),e.jsxs("select",{value:n.role,onChange:c=>o({...n,role:c.target.value}),className:"block w-full rounded-lg border-border-dark bg-[#111a22] py-2.5 pl-3 pr-10 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary appearance-none",children:[e.jsx("option",{value:"",children:"None"}),e.jsx("option",{value:"Management",children:"Management"}),e.jsx("option",{value:"ISCSI",children:"iSCSI"}),e.jsx("option",{value:"Storage",children:"Storage"})]})]})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-bold text-text-secondary hover:text-white transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:l.isPending,className:"flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-white hover:bg-blue-600 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"save"}),l.isPending?"Saving...":"Save Changes"]})]})]})]})})}function LS({interface:r,onClose:t}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border-dark bg-card-dark shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border-dark px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"info"}),e.jsxs("h2",{className:"text-lg font-bold text-white",children:["Interface Details - ",r.name]})]}),e.jsx("button",{onClick:t,className:"h-8 w-8 rounded-full hover:bg-border-dark flex items-center justify-center text-text-secondary hover:text-white transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`h-3 w-3 rounded-full ${r.status==="Connected"?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-sm font-medium text-text-secondary",children:"Status"})]}),e.jsx("span",{className:`text-sm font-bold ${r.status==="Connected"?"text-green-500":"text-red-500"}`,children:r.status})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"IP Address"}),e.jsx("p",{className:"text-sm font-mono text-white",children:r.ip_address||"Not configured"})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Subnet Mask (CIDR)"}),e.jsxs("p",{className:"text-sm font-mono text-white",children:["/",r.subnet||"N/A"]})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Default Gateway"}),e.jsx("p",{className:"text-sm font-mono text-white",children:r.gateway||"Not configured"})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Link Speed"}),e.jsx("p",{className:"text-sm font-mono text-white",children:r.speed||"Unknown"})]})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-3 block text-xs font-medium text-text-secondary uppercase",children:"DNS Servers"}),e.jsxs("div",{className:"space-y-2",children:[r.dns1?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Primary:"}),e.jsx("span",{className:"text-sm font-mono text-white",children:r.dns1})]}):e.jsx("p",{className:"text-xs text-text-secondary",children:"Primary DNS: Not configured"}),r.dns2?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Secondary:"}),e.jsx("span",{className:"text-sm font-mono text-white",children:r.dns2})]}):e.jsx("p",{className:"text-xs text-text-secondary",children:"Secondary DNS: Not configured"})]})]}),r.role&&e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Interface Role"}),e.jsx("span",{className:`inline-block px-3 py-1 rounded text-xs font-bold uppercase ${r.role==="ISCSI"?"bg-purple-500/20 text-purple-400 border border-purple-500/20":"bg-primary/20 text-primary border border-primary/20"}`,children:r.role})]}),r.ip_address&&r.subnet&&e.jsxs("div",{className:"p-4 rounded-lg bg-[#111a22] border border-border-dark",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-text-secondary uppercase",children:"Full Network Address"}),e.jsxs("p",{className:"text-sm font-mono text-white",children:[r.ip_address,"/",r.subnet]})]})]}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsxs("button",{onClick:t,className:"flex items-center justify-center gap-2 rounded-lg bg-primary px-6 py-2.5 text-sm font-bold text-white hover:bg-blue-600 transition-all",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"}),"Close"]})})]})]})})}const ys={listJobs:async r=>{const t=new URLSearchParams;return r?.status&&t.append("status",r.status),r?.job_type&&t.append("job_type",r.job_type),r?.client_name&&t.append("client_name",r.client_name),r?.job_name&&t.append("job_name",r.job_name),r?.limit&&t.append("limit",r.limit.toString()),r?.offset&&t.append("offset",r.offset.toString()),(await ze.get(`/backup/jobs${t.toString()?`?${t.toString()}`:""}`)).data},getJob:async r=>(await ze.get(`/backup/jobs/${r}`)).data,createJob:async r=>(await ze.post("/backup/jobs",r)).data,executeBconsoleCommand:async r=>(await ze.post("/backup/console/execute",{command:r})).data,listClients:async r=>{const t=new URLSearchParams;return r?.enabled!==void 0&&t.append("enabled",r.enabled.toString()),r?.search&&t.append("search",r.search),r?.category&&t.append("category",r.category),(await ze.get(`/backup/clients${t.toString()?`?${t.toString()}`:""}`)).data},getDashboardStats:async()=>(await ze.get("/backup/dashboard/stats")).data,listStoragePools:async()=>(await ze.get("/backup/storage/pools")).data,listStorageVolumes:async r=>{const t=new URLSearchParams;return r&&t.append("pool_name",r),(await ze.get(`/backup/storage/volumes${t.toString()?`?${t.toString()}`:""}`)).data},listStorageDaemons:async()=>(await ze.get("/backup/storage/daemons")).data,createStoragePool:async r=>(await ze.post("/backup/storage/pools",r)).data,deleteStoragePool:async r=>{await ze.delete(`/backup/storage/pools/${r}`)},createStorageVolume:async r=>(await ze.post("/backup/storage/volumes",r)).data,updateStorageVolume:async(r,t)=>(await ze.put(`/backup/storage/volumes/${r}`,t)).data,deleteStorageVolume:async r=>{await ze.delete(`/backup/storage/volumes/${r}`)},listMedia:async()=>(await ze.get("/backup/media")).data},TS=` + .status-dot { + box-shadow: 0 0 6px currentColor; + } + .checkbox-custom { + appearance: none; + background-color: #1c2936; + border: 1px solid #324d67; + border-radius: 4px; + width: 16px; + height: 16px; + display: inline-flex; + align-items: center; + justify-content: center; + cursor: pointer; + } + .checkbox-custom:checked { + background-color: #137fec; + border-color: #137fec; + } + .checkbox-custom:checked::after { + content: ''; + width: 4px; + height: 8px; + border: solid white; + border-width: 0 2px 2px 0; + transform: rotate(45deg); + margin-bottom: 2px; + } + .agent-item { + position: relative; + } + .agent-item .tree-line-vertical { + position: absolute; + left: 20px; + top: -24px; + bottom: 0; + width: 1px; + background-color: #324d67; + z-index: 0; + } + .agent-item:last-child .tree-line-vertical { + bottom: 50%; + } + .agent-item .tree-line-horizontal { + position: absolute; + left: 20px; + top: 50%; + width: 24px; + height: 1px; + background-color: #324d67; + z-index: 0; + } + .custom-scrollbar::-webkit-scrollbar { + width: 6px; + } + .custom-scrollbar::-webkit-scrollbar-track { + background: transparent; + } + .custom-scrollbar::-webkit-scrollbar-thumb { + background: #324d67; + border-radius: 10px; + } +`;function IS(){const r=Cy(),s=new URLSearchParams(r.search).get("tab"),[n,o]=Ce.useState(s||"dashboard"),[l,d]=Ce.useState(""),c=Nr();Ce.useEffect(()=>{const g=new URLSearchParams(r.search).get("tab");if(g==="pools"||g==="volumes"){const _=new URLSearchParams(r.search);_.set("tab","storage"),g==="volumes"?_.set("view","volumes"):g==="pools"&&_.set("view","pools");const w=`${r.pathname}?${_.toString()}`;window.history.replaceState({},"",w),o("storage");return}const j=g||"dashboard";j!==n&&(j==="dashboard"||j==="jobs"||j==="clients"||j==="storage"||j==="filesets"||j==="console")&&o(j)},[r.search,r.pathname]);const u=g=>{o(g);const j=new URLSearchParams(r.search);g==="dashboard"?j.delete("tab"):j.set("tab",g);const _=`${r.pathname}${j.toString()?"?"+j.toString():""}`;window.history.replaceState({},"",_)},{data:h}=dt({queryKey:["dashboard-stats"],queryFn:()=>ys.getDashboardStats(),enabled:n==="dashboard",refetchInterval:3e4}),{data:m}=dt({queryKey:["dashboard-jobs"],queryFn:()=>ys.listJobs({limit:10}),enabled:n==="dashboard"}),{data:x}=dt({queryKey:["running-jobs"],queryFn:()=>ys.listJobs({status:"Running",limit:10}),enabled:n==="dashboard",refetchInterval:5e3}),y=m?.jobs||[],p=x?.jobs||[],v=g=>{if(g===0)return"0 B";const j=1024,_=["B","KB","MB","GB","TB"],w=Math.floor(Math.log(g)/Math.log(j));return`${(g/Math.pow(j,w)).toFixed(2)} ${_[w]}`},N=g=>{if(!g)return"-";try{const j=new Date(g),w=new Date().getTime()-j.getTime(),L=Math.floor(w/6e4),K=Math.floor(w/36e5),M=Math.floor(w/864e5);return L<1?"Just now":L<60?`${L}m ago`:K<24?`${K}h ago`:M<7?`${M}d ago`:j.toLocaleDateString()}catch{return"-"}},B=g=>{if(!g)return"-";const j=Math.floor(g/3600),_=Math.floor(g%3600/60),w=g%60;return j>0?`${j}:${_.toString().padStart(2,"0")}:${w.toString().padStart(2,"0")}`:`${_}:${w.toString().padStart(2,"0")}`};return e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden bg-slate-50 dark:bg-[#101922]",children:e.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("header",{className:"h-16 flex items-center justify-between px-8 bg-white dark:bg-[#111a22] border-b border-slate-200 dark:border-[#233648] z-10",children:[e.jsxs("div",{className:"flex items-center gap-6 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-10 bg-primary rounded-lg flex items-center justify-center text-white",children:e.jsx("span",{className:"material-symbols-outlined",children:"backup"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold leading-tight",children:"Backup Management"}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-[#92adc9]",children:"Backup Appliance"})]})]}),e.jsxs("div",{className:"relative w-full max-w-md",children:[e.jsx("span",{className:"material-symbols-outlined absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 text-[20px]",children:"search"}),e.jsx("input",{className:"w-full bg-slate-100 dark:bg-[#233648] border-none rounded-lg pl-10 pr-4 py-2 text-sm focus:ring-2 focus:ring-primary/50 transition-all outline-none",placeholder:"Search clients, jobs, or logs...",type:"text",value:l,onChange:g=>d(g.target.value)})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-green-500/10 text-green-500 rounded-full border border-green-500/20",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-tighter",children:h?.director_status==="Active"?"SD Connected":"SD Disconnected"})]}),e.jsxs("button",{className:"p-2 text-slate-500 hover:bg-slate-100 dark:hover:bg-[#233648] rounded-lg relative",children:[e.jsx("span",{className:"material-symbols-outlined",children:"notifications"}),e.jsx("span",{className:"absolute top-2 right-2 w-2 h-2 bg-primary rounded-full border-2 border-white dark:border-[#111a22]"})]}),e.jsx("button",{onClick:()=>{c.invalidateQueries({queryKey:["dashboard-stats"]}),c.invalidateQueries({queryKey:["dashboard-jobs"]}),c.invalidateQueries({queryKey:["running-jobs"]})},className:"p-2 text-slate-500 hover:bg-slate-100 dark:hover:bg-[#233648] rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-8 space-y-8 custom-scrollbar bg-slate-50 dark:bg-[#101922]",children:[n==="dashboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-widest text-slate-500 dark:text-[#92adc9]",children:"Job Statistics (Last 24h)"}),e.jsx("button",{onClick:()=>u("jobs"),className:"text-xs font-medium text-primary cursor-pointer hover:underline",children:"View detailed report"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#324d67] p-6 rounded-xl flex flex-col gap-1 hover:border-primary/50 transition-colors cursor-default",children:[e.jsx("p",{className:"text-slate-500 dark:text-[#92adc9] text-sm font-medium",children:"Successful Backups"}),e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("span",{className:"text-3xl font-bold",children:y.filter(g=>g.status==="Completed").length}),e.jsxs("span",{className:"text-green-500 text-sm font-bold flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"trending_up"}),"+12%"]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#324d67] p-6 rounded-xl flex flex-col gap-1 hover:border-primary/50 transition-colors cursor-default",children:[e.jsx("p",{className:"text-slate-500 dark:text-[#92adc9] text-sm font-medium",children:"Failed Jobs"}),e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("span",{className:"text-3xl font-bold",children:y.filter(g=>g.status==="Failed").length}),e.jsxs("span",{className:"text-red-500 text-sm font-bold flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"trending_down"}),"-5%"]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#324d67] p-6 rounded-xl flex flex-col gap-1 hover:border-primary/50 transition-colors cursor-default",children:[e.jsx("p",{className:"text-slate-500 dark:text-[#92adc9] text-sm font-medium",children:"Currently Running"}),e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("span",{className:"text-3xl font-bold",children:p.length}),e.jsxs("span",{className:"text-primary text-sm font-bold flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"sync"}),"Active"]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#324d67] p-6 rounded-xl flex flex-col gap-1 hover:border-primary/50 transition-colors cursor-default",children:[e.jsx("p",{className:"text-slate-500 dark:text-[#92adc9] text-sm font-medium",children:"Waiting / Queued"}),e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("span",{className:"text-3xl font-bold",children:y.filter(g=>g.status==="Waiting").length}),e.jsx("span",{className:"text-slate-400 text-sm font-bold",children:"No change"})]})]})]})]}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#233648] rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-base font-bold",children:"Storage Pool Utilization"}),e.jsx("span",{className:"material-symbols-outlined text-slate-400",children:"info"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsx("span",{className:"text-slate-500 dark:text-[#92adc9]",children:h?.default_pool?.name||"Default Pool"}),e.jsx("span",{className:"font-bold",children:h?.default_pool?`${v(h.default_pool.used_bytes)} / ${v(h.default_pool.total_bytes)}`:"N/A"})]}),e.jsx("div",{className:"w-full bg-slate-100 dark:bg-[#233648] h-3 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full",style:{width:`${h?.default_pool?Math.min(h.default_pool.usage_percent,100):0}%`}})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsx("span",{className:"text-slate-500 dark:text-[#92adc9]",children:"Offsite Cloud Sync"}),e.jsx("span",{className:"font-bold",children:"1.8 TB / 5.0 TB"})]}),e.jsx("div",{className:"w-full bg-slate-100 dark:bg-[#233648] h-3 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-green-500 h-full rounded-full",style:{width:"36%"}})})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#233648] rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-base font-bold",children:"Resource Summary"}),e.jsx("button",{className:"text-primary text-sm font-semibold",children:"View Hardware"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-slate-50 dark:bg-[#16232e] p-4 rounded-lg",children:[e.jsx("p",{className:"text-xs text-slate-500 dark:text-[#92adc9] uppercase font-bold mb-1",children:"Active Volumes"}),e.jsx("p",{className:"text-xl font-bold",children:"34"})]}),e.jsxs("div",{className:"bg-slate-50 dark:bg-[#16232e] p-4 rounded-lg",children:[e.jsx("p",{className:"text-xs text-slate-500 dark:text-[#92adc9] uppercase font-bold mb-1",children:"Total Clients"}),e.jsx("p",{className:"text-xl font-bold",children:h?.active_jobs_count||0})]}),e.jsxs("div",{className:"bg-slate-50 dark:bg-[#16232e] p-4 rounded-lg",children:[e.jsx("p",{className:"text-xs text-slate-500 dark:text-[#92adc9] uppercase font-bold mb-1",children:"Last Full Backup"}),e.jsx("p",{className:"text-xl font-bold",children:h?.last_job?N(h.last_job.ended_at||h.last_job.started_at):"N/A"})]}),e.jsxs("div",{className:"bg-slate-50 dark:bg-[#16232e] p-4 rounded-lg",children:[e.jsx("p",{className:"text-xs text-slate-500 dark:text-[#92adc9] uppercase font-bold mb-1",children:"Catalog Size"}),e.jsx("p",{className:"text-xl font-bold",children:"12.4 GB"})]})]})]})]}),p.length>0&&e.jsxs("section",{className:"bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#233648] rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-[#233648] flex items-center justify-between",children:[e.jsx("h3",{className:"text-base font-bold",children:"Running Jobs"}),e.jsx("button",{className:"bg-primary text-white text-xs font-bold px-4 py-2 rounded-lg hover:bg-primary/90 transition-colors",children:"Abort All"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 dark:bg-[#16232e] text-[11px] uppercase tracking-wider text-slate-500 dark:text-[#92adc9] font-bold",children:[e.jsx("th",{className:"px-6 py-3",children:"Job ID"}),e.jsx("th",{className:"px-6 py-3",children:"Client Name"}),e.jsx("th",{className:"px-6 py-3",children:"Level"}),e.jsx("th",{className:"px-6 py-3",children:"Progress"}),e.jsx("th",{className:"px-6 py-3",children:"Bytes Processed"}),e.jsx("th",{className:"px-6 py-3",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100 dark:divide-[#233648]",children:p.map(g=>{const j=g.duration_seconds?Math.min(g.duration_seconds/3600*100,100):45;return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-[#16232e] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 text-sm font-mono",children:g.job_id}),e.jsx("td",{className:"px-6 py-4 text-sm font-bold",children:g.client_name}),e.jsx("td",{className:"px-6 py-4 text-sm",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold uppercase border ${g.job_level==="Full"?"bg-purple-500/10 text-purple-500 border-purple-500/20":"bg-blue-500/10 text-blue-500 border-blue-500/20"}`,children:g.job_level})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 bg-slate-200 dark:bg-[#233648] h-1.5 rounded-full overflow-hidden min-w-[100px]",children:e.jsx("div",{className:"bg-primary h-full",style:{width:`${j}%`}})}),e.jsxs("span",{className:"text-xs font-bold",children:[Math.round(j),"%"]})]})}),e.jsx("td",{className:"px-6 py-4 text-sm",children:v(g.bytes_written)}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("button",{className:"text-slate-400 hover:text-red-500 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"cancel"})})})]},g.id)})})]})})]}),e.jsxs("section",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"xl:col-span-2 bg-white dark:bg-[#111a22] border border-slate-200 dark:border-[#233648] rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-[#233648] flex items-center justify-between",children:[e.jsx("h3",{className:"text-base font-bold",children:"Recent Job History"}),e.jsx("button",{onClick:()=>u("jobs"),className:"text-primary text-xs font-bold hover:underline",children:"View All History"})]}),e.jsxs("div",{className:"divide-y divide-slate-100 dark:divide-[#233648]",children:[y.slice(0,5).map(g=>e.jsxs("div",{className:"px-6 py-3 flex items-center justify-between hover:bg-slate-50 dark:hover:bg-[#16232e] transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[g.status==="Completed"?e.jsx("span",{className:"material-symbols-outlined text-green-500",children:"check_circle"}):g.status==="Failed"?e.jsx("span",{className:"material-symbols-outlined text-red-500",children:"error"}):e.jsx("span",{className:"material-symbols-outlined text-primary",children:"sync"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-bold",children:[g.job_name," - ",g.client_name]}),e.jsx("p",{className:"text-[10px] text-slate-500",children:g.status==="Failed"?`Error: ${g.error_message||"Unknown error"}`:`Duration: ${B(g.duration_seconds)} • Size: ${v(g.bytes_written)}`})]})]}),e.jsx("span",{className:"text-xs font-medium text-slate-400",children:g.ended_at?new Date(g.ended_at).toLocaleTimeString():new Date(g.started_at||"").toLocaleTimeString()})]},g.id)),y.length===0&&e.jsx("div",{className:"px-6 py-8 text-center text-slate-500 dark:text-[#92adc9]",children:"No recent jobs found"})]})]}),e.jsxs("div",{className:"bg-black/90 dark:bg-[#080c11] border border-slate-200 dark:border-[#233648] rounded-xl flex flex-col h-[300px] xl:h-auto",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-white/10 flex items-center justify-between bg-white/5",children:[e.jsxs("h3",{className:"text-xs font-bold text-slate-300 uppercase tracking-widest flex items-center gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),"Live Console Log"]}),e.jsx("button",{className:"text-white/40 hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"open_in_new"})})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto custom-scrollbar font-mono text-[11px] space-y-1",children:[e.jsxs("p",{className:"text-blue-400",children:["15:40:12 [Director] Starting JobId ",p[0]?.job_id||"10928"]}),e.jsx("p",{className:"text-slate-400",children:"15:40:15 [SD] Ready to receive data on port 9103"}),e.jsx("p",{className:"text-slate-400",children:"15:40:18 [FD] Sending attribute data for /etc/passwd"}),h?.last_job&&e.jsxs("p",{className:"text-green-400",children:["15:42:01 [Director] JobId ",h.last_job.job_id," finished successfully"]}),e.jsx("p",{className:"text-slate-400",children:'15:42:05 [Catalog] Pruning expired volumes for Pool "Default"'}),e.jsx("p",{className:"text-slate-500",children:"15:43:00 [System] Health check completed - All systems OK"}),e.jsx("p",{className:"text-yellow-400",children:"15:43:45 [SD] Warning: Volume VOL-0045 reached 90% capacity"}),e.jsx("p",{className:"text-blue-400",children:'15:45:10 [Director] Scheduling next job "NightlyAudit"'})]})]})]})]}),n==="jobs"&&e.jsx(DS,{}),n==="clients"&&e.jsx(HS,{}),n==="clients-filesystem"&&e.jsx(MS,{onSwitchToConsole:()=>u("console")}),n==="clients-database"&&e.jsx(PS,{onSwitchToConsole:()=>u("console")}),n==="clients-virtualization"&&e.jsx(KS,{onSwitchToConsole:()=>u("console")}),n==="storage"&&e.jsx(qS,{}),n==="console"&&e.jsx(OS,{})]})]})})}function DS(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState(null),[l,d]=Ce.useState(!1),[c,u]=Ce.useState(new Date),{data:h,isLoading:m,error:x}=dt({queryKey:["backup-jobs",t],queryFn:()=>ys.listJobs({status:t||void 0,limit:50})}),y=h?.jobs||[],p=y.filter(T=>T.status==="Running"),v=y.filter(T=>T.status==="Completed"),N=y.filter(T=>T.status==="Failed"),B=T=>{if(T===0)return"0 B";const ne=1024,Z=["B","KB","MB","GB","TB"],U=Math.floor(Math.log(T)/Math.log(ne));return`${(T/Math.pow(ne,U)).toFixed(2)} ${Z[U]}`},g=T=>{if(!T)return"-";try{const ne=new Date(T),U=new Date().getTime()-ne.getTime(),q=Math.floor(U/6e4),F=Math.floor(q/60),le=Math.floor(F/24);return q<1?"Just now":q<60?`${q}m ago`:F<24?`${F}h ago`:le<7?`${le}d ago`:ne.toLocaleDateString()}catch{return"-"}},j=T=>T.status==="Running"?"N/A":"Today 22:00",_=T=>{switch(T){case"Completed":return{dot:"bg-success",text:"text-success",label:"Success"};case"Running":return{dot:"bg-primary",text:"text-primary",label:"Running"};case"Failed":return{dot:"bg-danger",text:"text-danger",label:"Failed"};case"Canceled":return{dot:"bg-warning",text:"text-warning",label:"Warning"};default:return{dot:"bg-success",text:"text-success",label:"Success"}}},w=T=>{const ne={Full:{bg:"bg-white/10",text:"text-white",border:"border-white/20"},Incremental:{bg:"bg-blue-500/10",text:"text-primary",border:"border-primary/20"},Differential:{bg:"bg-amber-500/10",text:"text-warning",border:"border-warning/20"}},Z=ne[T]||ne.Incremental;return e.jsx("span",{className:`${Z.bg} ${Z.text} px-2 py-0.5 rounded text-[10px] font-black border ${Z.border} uppercase`,children:T==="Incremental"?"Inc":T==="Differential"?"Diff":T})},K=(T=>{const ne=T.getFullYear(),Z=T.getMonth(),U=new Date(ne,Z,1),F=new Date(ne,Z+1,0).getDate(),le=U.getDay(),ae=[];for(let se=0;se0?(v.length/y.length*100).toFixed(1):"100.0";return e.jsxs("div",{className:"flex-1 max-w-[1440px] mx-auto w-full px-6 py-6",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-6 mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-extrabold tracking-tighter mb-2 dark:text-white",children:"Jobs & Schedules"}),e.jsx("p",{className:"text-slate-400 max-w-xl dark:text-slate-400",children:"Configure, monitor, and manage Bacula backup policies and automated job schedules from a unified cockpit."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{className:"bg-[#22252a] dark:bg-[#22252a] hover:bg-[#22252a]/80 px-4 py-2.5 rounded-lg flex items-center gap-2 font-bold text-sm transition-all border border-white/5 text-white",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"settings"}),e.jsx("span",{children:"Config"})]}),e.jsxs("button",{className:"bg-[#22252a] dark:bg-[#22252a] hover:bg-[#22252a]/80 px-4 py-2.5 rounded-lg flex items-center gap-2 font-bold text-sm transition-all border border-white/5 text-white",children:[e.jsx("span",{className:"material-symbols-outlined text-lg text-primary",children:"history"}),e.jsx("span",{children:"Restore"})]}),e.jsxs("button",{onClick:()=>d(!0),className:"bg-primary hover:bg-primary/90 px-5 py-2.5 rounded-lg flex items-center gap-2 font-bold text-sm text-white shadow-lg shadow-primary/20 transition-all",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"add_circle"}),e.jsx("span",{children:"Add New Job"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[e.jsx("button",{onClick:()=>s(""),className:`text-xs font-bold px-4 py-1.5 rounded-full transition-colors ${t?"bg-[#22252a] dark:bg-[#22252a] text-slate-400 hover:text-white":"bg-primary text-white"}`,children:"All Jobs"}),e.jsxs("button",{onClick:()=>s("Running"),className:`text-xs font-bold px-4 py-1.5 rounded-full transition-colors ${t==="Running"?"bg-primary text-white":"bg-[#22252a] dark:bg-[#22252a] text-slate-400 hover:text-white"}`,children:["Running (",p.length,")"]}),e.jsx("button",{onClick:()=>s("Completed"),className:`text-xs font-bold px-4 py-1.5 rounded-full transition-colors ${t==="Completed"?"bg-primary text-white":"bg-[#22252a] dark:bg-[#22252a] text-slate-400 hover:text-white"}`,children:"Completed"}),e.jsx("button",{onClick:()=>s("Failed"),className:`text-xs font-bold px-4 py-1.5 rounded-full transition-colors ${t==="Failed"?"bg-primary text-white":"bg-[#22252a] dark:bg-[#22252a] text-slate-400 hover:text-white"}`,children:"Failed"}),e.jsx("button",{onClick:()=>s("Waiting"),className:`text-xs font-bold px-4 py-1.5 rounded-full transition-colors ${t==="Waiting"?"bg-primary text-white":"bg-[#22252a] dark:bg-[#22252a] text-slate-400 hover:text-white"}`,children:"Idle"}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsx("button",{className:"p-1.5 text-slate-400 hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined",children:"filter_list"})}),e.jsx("button",{className:"p-1.5 text-slate-400 hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined",children:"grid_view"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsx("div",{className:"lg:col-span-8 space-y-4",children:e.jsx("div",{className:"bg-[#1a1d21] dark:bg-[#1a1d21] border border-white/10 rounded-xl overflow-hidden shadow-sm",children:m?e.jsx("div",{className:"p-8 text-center text-slate-400",children:"Loading jobs..."}):x?e.jsx("div",{className:"p-8 text-center text-red-400",children:"Failed to load jobs"}):y.length===0?e.jsx("div",{className:"p-12 text-center text-slate-400",children:"No jobs found"}):e.jsx(e.Fragment,{children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#22252a]/50 text-slate-400 text-[11px] uppercase tracking-widest border-b border-white/10",children:[e.jsx("th",{className:"px-6 py-4 font-bold",children:"Status"}),e.jsx("th",{className:"px-4 py-4 font-bold",children:"Job Name"}),e.jsx("th",{className:"px-4 py-4 font-bold",children:"Level"}),e.jsx("th",{className:"px-4 py-4 font-bold",children:"Last Run"}),e.jsx("th",{className:"px-4 py-4 font-bold",children:"Next Run"}),e.jsx("th",{className:"px-6 py-4 font-bold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:y.slice(0,10).map(T=>{const ne=_(T.status),Z=n===T.id;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:`transition-colors group ${T.status==="Running"?"bg-primary/[0.03] hover:bg-primary/[0.05]":"hover:bg-white/[0.02]"}`,onClick:()=>o(Z?null:T.id),children:[e.jsx("td",{className:"px-6 py-5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${ne.dot} status-dot ${T.status==="Running"?"animate-pulse":""}`}),e.jsx("span",{className:`text-xs font-bold ${ne.text} uppercase`,children:ne.label})]})}),e.jsx("td",{className:"px-4 py-5",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-bold text-sm tracking-tight text-white",children:T.job_name}),e.jsxs("span",{className:"text-[10px] text-slate-500 uppercase tracking-tighter",children:["SD: ",T.storage_name||"N/A"," | Pool: ",T.pool_name||"N/A"]})]})}),e.jsx("td",{className:"px-4 py-5",children:w(T.job_level)}),e.jsx("td",{className:`px-4 py-5 text-sm ${T.status==="Running"?"text-primary font-bold":"text-slate-300"}`,children:T.status==="Running"?"Active":g(T.ended_at||T.started_at)}),e.jsx("td",{className:"px-4 py-5 text-sm text-slate-300 font-medium",children:j(T)}),e.jsx("td",{className:"px-6 py-5 text-right",children:T.status==="Running"?e.jsx("button",{className:"bg-danger/20 hover:bg-danger text-danger hover:text-white px-3 py-1 rounded-md text-[11px] font-bold transition-all uppercase",children:"Stop"}):e.jsx("button",{className:"bg-primary/20 hover:bg-primary text-primary hover:text-white px-3 py-1 rounded-md text-[11px] font-bold transition-all",children:"RUN"})})]},T.id),Z&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-5 bg-[#22252a]/20 border-t border-white/5",children:e.jsxs("div",{className:"flex items-start gap-8",children:[e.jsxs("div",{className:"space-y-4 flex-1",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Live Stats"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[#121416]/50 p-3 rounded border border-white/5",children:[e.jsx("p",{className:"text-[10px] text-slate-500 font-bold uppercase",children:"Files Tracked"}),e.jsx("p",{className:"text-xl font-bold font-display text-white",children:T.files_written.toLocaleString()})]}),e.jsxs("div",{className:"bg-[#121416]/50 p-3 rounded border border-white/5",children:[e.jsx("p",{className:"text-[10px] text-slate-500 font-bold uppercase",children:"Storage Used"}),e.jsx("p",{className:"text-xl font-bold font-display text-white",children:B(T.bytes_written)})]}),e.jsxs("div",{className:"bg-[#121416]/50 p-3 rounded border border-white/5",children:[e.jsx("p",{className:"text-[10px] text-slate-500 font-bold uppercase",children:"Duration"}),e.jsx("p",{className:"text-xl font-bold font-display text-white",children:T.duration_seconds?`${Math.floor(T.duration_seconds/60)}m`:"-"})]})]})]}),e.jsxs("div",{className:"w-64 space-y-3",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-widest text-slate-400",children:"Job Details"}),e.jsxs("ul",{className:"text-xs space-y-2",children:[e.jsxs("li",{className:"flex justify-between border-b border-white/5 pb-1",children:[e.jsx("span",{className:"text-slate-500",children:"Client"}),e.jsx("span",{className:"font-bold text-white",children:T.client_name})]}),e.jsxs("li",{className:"flex justify-between border-b border-white/5 pb-1",children:[e.jsx("span",{className:"text-slate-500",children:"Type"}),e.jsx("span",{className:"font-bold text-white",children:T.job_type})]}),e.jsxs("li",{className:"flex justify-between border-b border-white/5 pb-1",children:[e.jsx("span",{className:"text-slate-500",children:"Job ID"}),e.jsx("span",{className:"font-bold text-white",children:T.job_id})]})]})]})]})})})]})})})]})})})}),e.jsxs("div",{className:"lg:col-span-4 space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1d21] dark:bg-[#1a1d21] border border-white/10 rounded-xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h3",{className:"font-bold text-sm tracking-tight flex items-center gap-2 text-white",children:[e.jsx("span",{className:"material-symbols-outlined text-primary text-xl",children:"calendar_month"}),"Backup Window Schedule"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>u(new Date(c.getFullYear(),c.getMonth()-1,1)),className:"p-1 hover:bg-white/10 rounded",children:e.jsx("span",{className:"material-symbols-outlined text-sm text-slate-400",children:"chevron_left"})}),e.jsx("button",{onClick:()=>u(new Date(c.getFullYear(),c.getMonth()+1,1)),className:"p-1 hover:bg-white/10 rounded",children:e.jsx("span",{className:"material-symbols-outlined text-sm text-slate-400",children:"chevron_right"})})]})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1 text-center mb-4",children:[["S","M","T","W","T","F","S"].map((T,ne)=>e.jsx("div",{className:"text-[10px] font-bold text-slate-500 uppercase",children:T},ne)),K.map((T,ne)=>{if(T===null)return e.jsx("div",{className:"aspect-square flex items-center justify-center text-[11px] opacity-20"},ne);const Z=T===M&&c.getMonth()===new Date().getMonth(),U=Math.random()>.7;return e.jsxs("div",{className:`aspect-square flex items-center justify-center text-[11px] relative ${Z?"bg-primary text-white rounded font-bold":"text-white"}`,children:[T,U&&!Z&&e.jsx("div",{className:"absolute bottom-1 w-1 h-1 bg-primary rounded-full"})]},ne)})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-white/5 space-y-4",children:[e.jsx("h4",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest",children:"Upcoming Jobs"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"bg-[#22252a] rounded px-2 py-1 text-center min-w-[48px]",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Today"}),e.jsx("p",{className:"text-xs font-black text-white",children:"22:00"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-bold leading-none mb-1 tracking-tight text-white",children:"Cloud_Incremental"}),e.jsx("p",{className:"text-[10px] text-slate-500 uppercase",children:"Priority: 10"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"bg-[#22252a] rounded px-2 py-1 text-center min-w-[48px]",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Today"}),e.jsx("p",{className:"text-xs font-black text-white",children:"23:30"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-bold leading-none mb-1 tracking-tight text-white",children:"VM_Snapshot_Cluster"}),e.jsx("p",{className:"text-[10px] text-slate-500 uppercase",children:"Priority: 15"})]})]})]})]}),e.jsxs("div",{className:"bg-primary/5 border border-[#1f5c9c]/30 rounded-xl p-5 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-primary/5 rounded-full -mr-16 -mt-16 blur-3xl"}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("span",{className:"material-symbols-outlined text-primary mb-3",children:"verified"}),e.jsx("h4",{className:"font-bold text-sm tracking-tight mb-2 text-white",children:"Backup Health Score"}),e.jsxs("div",{className:"flex items-end gap-2 mb-4",children:[e.jsxs("span",{className:"text-3xl font-black text-primary leading-none",children:[V,"%"]}),e.jsx("span",{className:"text-[10px] text-success font-bold pb-1",children:"+0.4% this week"})]}),e.jsx("div",{className:"w-full bg-white/5 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full",style:{width:`${V}%`}})}),e.jsxs("p",{className:"text-[11px] text-slate-400 mt-4 leading-relaxed italic",children:["The last ",y.length," jobs completed. ",N.length," job",N.length!==1?"s":""," required manual intervention."]})]})]})]})]}),e.jsxs("footer",{className:"mt-8 border-t border-white/5 bg-[#121416]/80 px-6 py-2 flex justify-between items-center text-[10px] text-slate-500 font-medium",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})," Director: Online"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})," Storage: Online"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})," Database: 0.1ms"]})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx("span",{children:"v13.0.2 Bacula Community"}),e.jsx("span",{children:"Up: 12d 4h 12m"})]})]}),l&&e.jsx(RS,{onClose:()=>d(!1),onSuccess:async()=>{d(!1),await r.invalidateQueries({queryKey:["backup-jobs"]}),await r.refetchQueries({queryKey:["backup-jobs"]})}})]})}function RS({onClose:r,onSuccess:t}){const[s,n]=Ce.useState({job_name:"",client_name:"",job_type:"Backup",job_level:"Full",storage_name:"",pool_name:""}),[o,l]=Ce.useState(null),d=ft({mutationFn:ys.createJob,onSuccess:()=>{t()},onError:u=>{l(u.response?.data?.error||"Failed to create job")}}),c=u=>{u.preventDefault(),l(null);const h={job_name:s.job_name,client_name:s.client_name,job_type:s.job_type,job_level:s.job_level};s.storage_name&&(h.storage_name=s.storage_name),s.pool_name&&(h.pool_name=s.pool_name),d.mutate(h)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Create Backup Job"}),e.jsx("button",{onClick:r,className:"text-text-secondary hover:text-white transition-colors",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[o&&e.jsx("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-lg text-red-400 text-sm",children:o}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-white text-sm font-semibold mb-2",children:["Job Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{type:"text",required:!0,value:s.job_name,onChange:u=>n({...s,job_name:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., DailyBackup"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-white text-sm font-semibold mb-2",children:["Client Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{type:"text",required:!0,value:s.client_name,onChange:u=>n({...s,client_name:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., filesrv-02"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-white text-sm font-semibold mb-2",children:["Job Type ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs("select",{required:!0,value:s.job_type,onChange:u=>n({...s,job_type:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none cursor-pointer",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 0.75rem center",paddingRight:"2.5rem"},children:[e.jsx("option",{value:"Backup",children:"Backup"}),e.jsx("option",{value:"Restore",children:"Restore"}),e.jsx("option",{value:"Verify",children:"Verify"}),e.jsx("option",{value:"Copy",children:"Copy"}),e.jsx("option",{value:"Migrate",children:"Migrate"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-white text-sm font-semibold mb-2",children:["Job Level ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs("select",{required:!0,value:s.job_level,onChange:u=>n({...s,job_level:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent appearance-none cursor-pointer",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 0.75rem center",paddingRight:"2.5rem"},children:[e.jsx("option",{value:"Full",children:"Full"}),e.jsx("option",{value:"Incremental",children:"Incremental"}),e.jsx("option",{value:"Differential",children:"Differential"}),e.jsx("option",{value:"Since",children:"Since"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-semibold mb-2",children:"Storage Name (Optional)"}),e.jsx("input",{type:"text",value:s.storage_name,onChange:u=>n({...s,storage_name:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., backup-srv-01"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-semibold mb-2",children:"Pool Name (Optional)"}),e.jsx("input",{type:"text",value:s.pool_name,onChange:u=>n({...s,pool_name:u.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., Default"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 bg-[#111a22] border border-border-dark rounded-lg text-white text-sm font-semibold hover:bg-[#1c2936] transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:d.isPending,className:"px-4 py-2 bg-primary text-white rounded-lg text-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d.isPending?"Creating...":"Create Job"})]})]})]})})}function OS(){const[r,t]=Ce.useState([]),[s,n]=Ce.useState(""),[o,l]=Ce.useState(!1),d=Ce.useRef(null),c=Ce.useRef(null);Ce.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),Ce.useEffect(()=>{c.current&&c.current.focus()},[]);const u=ft({mutationFn:x=>ys.executeBconsoleCommand(x),onSuccess:(x,y)=>{t(p=>[...p,{command:y,output:x.output,timestamp:new Date}]),n(""),l(!1),setTimeout(()=>{c.current&&c.current.focus()},100)},onError:x=>{t(y=>[...y,{command:s,output:x?.response?.data?.output||x?.response?.data?.details||x.message||"Error executing command",timestamp:new Date}]),n(""),l(!1),setTimeout(()=>{c.current&&c.current.focus()},100)}}),h=x=>{x.preventDefault();const y=s.trim();!y||o||(l(!0),u.mutate(y))},m=x=>{x.ctrlKey&&x.key==="l"&&(x.preventDefault(),t([]))};return e.jsxs("div",{className:"flex flex-col h-full bg-[#0a0f14] border border-border-dark rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex-none px-4 py-3 bg-[#161f29] border-b border-border-dark flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-base text-primary",children:"terminal"}),e.jsx("h3",{className:"text-white text-sm font-bold",children:"Console View"})]}),e.jsx("button",{onClick:()=>t([]),className:"text-xs text-text-secondary hover:text-white transition-colors",children:"Clear"})]}),e.jsxs("div",{ref:d,className:"flex-1 overflow-y-auto p-4 bg-[#0a0f14] custom-scrollbar",style:{minHeight:"400px"},children:[r.length===0?e.jsxs("div",{className:"text-text-secondary",children:[e.jsx("div",{className:"mb-2",children:"Console View - Type commands below"}),e.jsxs("div",{className:"text-xs opacity-70",children:[e.jsx("div",{children:"Common commands:"}),e.jsxs("div",{className:"ml-4 mt-1",children:[e.jsx("div",{children:"• list jobs"}),e.jsx("div",{children:"• list clients"}),e.jsx("div",{children:"• list pools"}),e.jsx("div",{children:"• status director"}),e.jsx("div",{children:"• help"})]})]})]}):r.map((x,y)=>e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"text-primary mb-2 font-mono text-sm",children:[e.jsx("span",{className:"text-text-secondary",children:"$"})," ",e.jsx("span",{className:"text-white",children:x.command})]}),e.jsx("div",{className:"text-green-400 font-mono text-xs leading-relaxed whitespace-pre overflow-x-auto",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',lineHeight:"1.6",tabSize:2},children:x.output})]},y)),o&&e.jsx("div",{className:"text-text-secondary",children:e.jsx("span",{className:"animate-pulse",children:"Executing..."})})]}),e.jsx("div",{className:"flex-none border-t border-border-dark bg-[#161f29]",children:e.jsxs("form",{onSubmit:h,className:"flex items-center",children:[e.jsx("span",{className:"px-4 text-primary font-mono text-sm",children:"$"}),e.jsx("input",{ref:c,"data-console-input":!0,type:"text",value:s,onChange:x=>n(x.target.value),onKeyDown:m,disabled:o,placeholder:"Enter bconsole command...",className:"flex-1 bg-transparent text-white font-mono text-sm py-3 focus:outline-none disabled:opacity-50"}),e.jsx("button",{type:"submit",disabled:!s.trim()||o,className:"px-4 py-3 text-primary hover:text-white disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-base",children:"send"})})]})})]})}function HS(){const{data:r}=dt({queryKey:["backup-clients-all"],queryFn:()=>ys.listClients()}),t=r?.clients||[],s=r?.total||0,n=t.filter(h=>h.category==="File"||!h.category).length,o=t.filter(h=>h.category==="Database").length,l=t.filter(h=>h.category==="Virtual").length,c=(()=>{const h=[],m=new Date;for(let x=5;x>=0;x--){const p=new Date(m.getFullYear(),m.getMonth()-x,1).toLocaleDateString("en-US",{month:"short"}),v=Math.max(0,Math.round(n*(.3+(5-x)*.14))),N=Math.max(0,Math.round(o*(.2+(5-x)*.16))),B=Math.max(0,Math.round(l*(.25+(5-x)*.15)));h.push({month:p,Filesystem:v,Database:N,Virtualization:B})}return h})(),u=h=>{const m=new URLSearchParams(window.location.search);m.set("tab",h),window.history.replaceState({},"",`${window.location.pathname}?${m.toString()}`),window.location.reload()};return e.jsxs("div",{className:"flex flex-col gap-6 flex-1",children:[e.jsx("header",{className:"flex flex-wrap justify-between items-end gap-4 border-b border-slate-200 dark:border-[#233648] pb-6",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-white dark:text-white text-3xl md:text-4xl font-black leading-tight tracking-tight",children:"Client Management"}),e.jsxs("span",{className:"flex h-6 px-2 items-center rounded-full bg-primary/20 border border-primary/30 text-xs font-bold text-primary",children:[s," Total"]})]}),e.jsx("p",{className:"text-text-secondary dark:text-slate-400 text-base font-normal max-w-2xl",children:"Monitor and manage backup clients across filesystem, database, and virtualization platforms."})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("button",{onClick:()=>u("clients-filesystem"),className:"bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 rounded-xl p-6 hover:shadow-lg transition-all text-left group",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"p-3 bg-blue-500/10 dark:bg-blue-500/20 rounded-lg group-hover:bg-blue-500/20 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-blue-500 text-2xl",children:"folder"})}),e.jsx("span",{className:"material-symbols-outlined text-slate-400 group-hover:text-primary transition-colors",children:"arrow_forward"})]}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:n}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 font-medium",children:"Filesystem Clients"}),e.jsx("p",{className:"text-xs text-slate-400 dark:text-slate-500 mt-2",children:"Local file system backups"})]}),e.jsxs("button",{onClick:()=>u("clients-database"),className:"bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 rounded-xl p-6 hover:shadow-lg transition-all text-left group",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"p-3 bg-indigo-500/10 dark:bg-indigo-500/20 rounded-lg group-hover:bg-indigo-500/20 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-indigo-500 text-2xl",children:"database"})}),e.jsx("span",{className:"material-symbols-outlined text-slate-400 group-hover:text-primary transition-colors",children:"arrow_forward"})]}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:o}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 font-medium",children:"Database & Application Clients"}),e.jsx("p",{className:"text-xs text-slate-400 dark:text-slate-500 mt-2",children:"MySQL, PostgreSQL, Oracle, SAP HANA"})]}),e.jsxs("button",{onClick:()=>u("clients-virtualization"),className:"bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 rounded-xl p-6 hover:shadow-lg transition-all text-left group",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"p-3 bg-purple-500/10 dark:bg-purple-500/20 rounded-lg group-hover:bg-purple-500/20 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-purple-500 text-2xl",children:"dns"})}),e.jsx("span",{className:"material-symbols-outlined text-slate-400 group-hover:text-primary transition-colors",children:"arrow_forward"})]}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:l}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 font-medium",children:"Virtualization Clients"}),e.jsx("p",{className:"text-xs text-slate-400 dark:text-slate-500 mt-2",children:"VM backups and snapshots"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 rounded-xl p-6 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 dark:text-white mb-1",children:"Client Growth Trend"}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Client count growth over the last 6 months"})]})}),e.jsx("div",{className:"h-80 w-full",children:e.jsx(Cl,{width:"100%",height:"100%",children:e.jsxs(f4,{data:c,margin:{top:10,right:30,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorFilesystem",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorDatabase",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorVirtualization",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#a855f7",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#a855f7",stopOpacity:0})]})]}),e.jsx(Nc,{strokeDasharray:"3 3",stroke:"#334155",opacity:.3}),e.jsx(Bc,{dataKey:"month",stroke:"#64748b",style:{fontSize:"12px"},tick:{fill:"#64748b"}}),e.jsx(jc,{stroke:"#64748b",style:{fontSize:"12px"},tick:{fill:"#64748b"},allowDecimals:!1}),e.jsx(Sl,{contentStyle:{backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",color:"#fff"},labelStyle:{color:"#cbd5e1",fontSize:"12px",marginBottom:"4px"},itemStyle:{color:"#fff",fontSize:"12px"},formatter:h=>[h,"Clients"]}),e.jsx(Qh,{wrapperStyle:{fontSize:"12px",color:"#64748b",paddingTop:"20px"},iconType:"circle"}),e.jsx(vh,{type:"monotone",dataKey:"Filesystem",stroke:"#3b82f6",strokeWidth:2,fill:"url(#colorFilesystem)",name:"Filesystem"}),e.jsx(vh,{type:"monotone",dataKey:"Database",stroke:"#6366f1",strokeWidth:2,fill:"url(#colorDatabase)",name:"Database"}),e.jsx(vh,{type:"monotone",dataKey:"Virtualization",stroke:"#a855f7",strokeWidth:2,fill:"url(#colorVirtualization)",name:"Virtualization"})]})})})]})]})}function MS({onSwitchToConsole:r}){const[t,s]=Ce.useState(""),[n,o]=Ce.useState("all"),[l,d]=Ce.useState(new Set),[c,u]=Ce.useState(new Set),{data:h,isLoading:m,error:x}=dt({queryKey:["backup-clients-filesystem",n,t],queryFn:()=>ys.listClients({category:"File",enabled:n==="all"?void 0:n==="enabled",search:t||void 0})}),y=h?.clients||[],p=h?.total||0,v=g=>{if(!g)return"-";try{const j=new Date(g),w=new Date().getTime()-j.getTime(),L=Math.floor(w/6e4),K=Math.floor(w/36e5),M=Math.floor(w/864e5);return L<1?"Just now":L<60?`${L}m ago`:K<24?`${K}h ago`:M<7?`${M}d ago`:j.toLocaleDateString()}catch{return"-"}},N=g=>{d(j=>{const _=new Set(j);return _.has(g)?_.delete(g):_.add(g),_})},B=g=>{const j=new URLSearchParams(window.location.search);j.set("tab",g),window.history.replaceState({},"",`${window.location.pathname}?${j.toString()}`),window.location.reload()};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:TS}),e.jsxs("div",{className:"max-w-[1400px] mx-auto p-6 space-y-8",children:[e.jsxs("header",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>B("clients"),className:"flex items-center justify-center w-10 h-10 rounded-lg border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors text-white",title:"Back to Client Dashboard",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"arrow_back"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white",children:"Filesystem Client Management"}),e.jsxs("span",{className:"bg-primary/20 text-primary text-xs font-semibold px-2.5 py-0.5 rounded-full border border-primary/30",children:[p," Clients"]})]}),e.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Manage filesystem backup clients, configure local agents, and monitor data integrity."})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>r?.(),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium border border-slate-200 dark:border-slate-700 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors text-white",children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"terminal"}),"Console"]}),e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 text-sm font-medium bg-primary text-white rounded-lg hover:bg-blue-600 transition-colors shadow-lg shadow-primary/20",children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"add"}),"Add New FS Client"]})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 items-center justify-between",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 w-full lg:w-auto",children:[e.jsxs("div",{className:"relative w-full lg:w-80",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-slate-400",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"search"})}),e.jsx("input",{className:"block w-full pl-10 pr-3 py-2 border border-slate-200 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-900 text-sm focus:ring-2 focus:ring-primary focus:border-transparent transition-all outline-none text-white",placeholder:"Search clients by name, IP...",type:"text",value:t,onChange:g=>s(g.target.value)})]}),e.jsxs("div",{className:"flex p-1 bg-slate-100 dark:bg-slate-800/50 rounded-lg border border-slate-200 dark:border-slate-700",children:[e.jsx("button",{onClick:()=>o("all"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${n==="all"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:"All"}),e.jsx("button",{onClick:()=>o("enabled"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${n==="enabled"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:"Online"}),e.jsx("button",{onClick:()=>o("offline"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${n==="offline"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:"Offline"})]})]}),e.jsxs("button",{className:"flex items-center gap-2 px-3 py-2 text-xs font-medium border border-slate-200 dark:border-slate-700 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors text-white ml-auto lg:ml-0",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"sort"}),"Sort: Status"]})]}),e.jsx("div",{className:"bg-white dark:bg-card-dark border border-slate-200 dark:border-slate-800 rounded-xl overflow-hidden shadow-sm",children:m?e.jsx("div",{className:"p-8 text-center text-slate-400",children:"Loading clients..."}):x?e.jsx("div",{className:"p-8 text-center text-red-400",children:"Failed to load clients"}):y.length===0?e.jsx("div",{className:"p-12 text-center text-slate-400",children:"No filesystem clients found"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[11px] font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wider border-b border-slate-200 dark:border-slate-800",children:[e.jsx("th",{className:"px-6 py-4 w-12 text-center",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox"})}),e.jsx("th",{className:"px-6 py-4",children:"Client Name"}),e.jsx("th",{className:"px-6 py-4",children:"Category"}),e.jsx("th",{className:"px-6 py-4",children:"Connection"}),e.jsx("th",{className:"px-6 py-4",children:"Status"}),e.jsx("th",{className:"px-6 py-4",children:"Last Backup"}),e.jsx("th",{className:"px-6 py-4",children:"Version"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-800",children:y.map(g=>{const j=l.has(g.client_id),_=g.status==="online";return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"group hover:bg-slate-50 dark:hover:bg-slate-800/30 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox",checked:c.has(g.client_id),onChange:w=>{const L=new Set(c);w.target.checked?L.add(g.client_id):L.delete(g.client_id),u(L)}})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>N(g.client_id),className:"text-slate-400 hover:text-primary transition-colors cursor-pointer",children:e.jsx("span",{className:"material-symbols-outlined",children:j?"keyboard_arrow_down":"keyboard_arrow_right"})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-slate-100 dark:bg-slate-800 rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined text-slate-600 dark:text-slate-400",children:"dns"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:g.name}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"13.0.4 (12Feb24) x86_64-pc-linux-gnu"})]})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-[11px] font-medium bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border border-blue-100 dark:border-blue-800",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"folder"}),"File"]})}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:"192.168.10.25"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"Port: 9102"})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-semibold ${_?"bg-emerald-50 dark:bg-emerald-900/20 text-emerald-600 dark:text-emerald-400 border border-emerald-100 dark:border-emerald-800/30":"bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-700"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${_?"bg-emerald-500":"bg-slate-400"} ${_?"animate-pulse":""}`}),_?"Online":"Offline"]})}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight",children:"Success"})]}),e.jsxs("div",{className:"text-[11px] text-slate-500",children:[v(g.last_backup_at)," (Daily)"]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"text-xs font-mono text-slate-500 dark:text-slate-400 bg-slate-100 dark:bg-slate-800 px-2 py-0.5 rounded",children:"v22.4.1"})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined",children:"more_vert"})})})]},g.client_id),j&&e.jsx("tr",{className:"bg-slate-50/50 dark:bg-slate-900/50",children:e.jsx("td",{className:"p-0",colSpan:8,children:e.jsxs("div",{className:"px-16 py-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-bold text-slate-400 uppercase tracking-widest border-b border-slate-200 dark:border-slate-800 pb-2",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"extension"}),"Installed Agents & Plugins"]}),e.jsx("div",{className:"space-y-4 ml-8 relative",children:e.jsx("div",{className:"relative tree-line",children:e.jsxs("div",{className:"flex items-center justify-between p-4 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/20 text-primary rounded-lg",children:e.jsx("span",{className:"material-symbols-outlined",children:"folder_managed"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Standard File Daemon"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Core Bacula Client Engine"})]})]}),e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tighter",children:"Ver"}),e.jsx("span",{className:"text-sm font-mono ml-2 text-white",children:"22.4.1"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-emerald-50 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400 rounded-lg text-xs font-semibold border border-emerald-100 dark:border-emerald-800/30",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),"Active"]})]})]})})})]})})})]})})})]})}),e.jsxs("div",{className:"px-6 py-4 bg-slate-50/50 dark:bg-slate-900/20 border-t border-slate-200 dark:border-slate-800 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:["Showing 1 to ",p," of ",p," clients"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:"p-1 rounded-md hover:bg-slate-200 dark:hover:bg-slate-800 text-slate-400 disabled:opacity-30",disabled:!0,children:e.jsx("span",{className:"material-symbols-outlined",children:"chevron_left"})}),e.jsx("button",{className:"p-1 rounded-md hover:bg-slate-200 dark:hover:bg-slate-800 text-slate-400",children:e.jsx("span",{className:"material-symbols-outlined",children:"chevron_right"})})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2 text-white",children:[e.jsx("span",{className:"material-symbols-outlined text-slate-400",children:"terminal"}),"Console Log ",e.jsx("span",{className:"text-xs font-normal text-slate-500",children:"(tail -f)"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold text-emerald-500",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Connected"]})]}),e.jsxs("div",{className:"bg-black/90 dark:bg-slate-950 rounded-xl border border-slate-200 dark:border-slate-800 p-4 font-mono text-xs leading-relaxed h-48 overflow-y-auto scrollbar-thin shadow-2xl",children:[e.jsxs("div",{className:"text-slate-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:01]"})," ",e.jsx("span",{className:"text-slate-100",children:"bareos-dir: Connected to Storage at backup-srv-01:9103"})]}),e.jsxs("div",{className:"text-slate-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:02]"})," ",e.jsx("span",{className:"text-slate-100",children:'bareos-sd: Volume "Vol-0012" selected for appending'})]}),e.jsxs("div",{className:"text-slate-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:05]"})," ",e.jsxs("span",{className:"text-slate-100",children:['bareos-fd: Client "',y[0]?.name||"client",'" starting backup of /var/www/html']})]}),e.jsxs("div",{className:"text-amber-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:10]"})," warning: /var/www/html/cache/tmp locked by another process, skipping"]}),e.jsxs("div",{className:"text-slate-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:45]"})," ",e.jsx("span",{className:"text-slate-100",children:"bareos-dir: JobId 10423: Sending Accurate information."})]}),e.jsxs("div",{className:"text-slate-400 mb-1",children:[e.jsx("span",{className:"text-blue-400",children:"[14:25:12]"})," ",e.jsx("span",{className:"text-emerald-400",children:"bareos-dir: Backup completed successfully."})]}),e.jsx("div",{className:"flex items-center gap-1 animate-pulse border-l-2 border-primary pl-2 ml-1 mt-2",children:e.jsx("span",{className:"text-slate-500",children:"_"})})]})]})]})]})}function PS({onSwitchToConsole:r}){const[t,s]=Ce.useState(""),[n,o]=Ce.useState("all"),[l,d]=Ce.useState("all"),[c,u]=Ce.useState(new Set),{data:h,isLoading:m,error:x}=dt({queryKey:["backup-clients-database",n,t,l],queryFn:()=>ys.listClients({category:"Database",enabled:n==="all"?void 0:n==="enabled",search:t||void 0})}),y=[{client_id:1001,name:"postgres-prod-01",engine:"PostgreSQL",engine_version:"15",ip:"172.24.10.45",port:"9102",status:"online",last_backup_at:new Date(Date.now()-7200*1e3).toISOString(),version:"23.1.2",os:"Debian 12 (Bookworm) x64-pc-linux",backup_type:"WAL Archiving",plugin:{name:"PostgreSQL Backup Plugin",version:"23.1.2-b",description:"Support for PITR and Incremental Dumps"}},{client_id:1002,name:"mysql-webapp-db",engine:"MySQL",engine_version:"8.0",ip:"192.168.1.100",port:"9102",status:"online",last_backup_at:new Date(Date.now()-300*60*1e3).toISOString(),version:"22.4.1",os:"Ubuntu 22.04 LTS x64-pc-linux",backup_type:"Binary Log Replication",plugin:{name:"MySQL Backup Plugin",version:"22.4.1-m",description:"Binary log streaming and point-in-time recovery"}},{client_id:1003,name:"oracle-erp-db",engine:"Oracle",engine_version:"19c",ip:"10.50.20.15",port:"9102",status:"online",last_backup_at:new Date(Date.now()-1440*60*1e3).toISOString(),version:"22.3.5",os:"Oracle Linux 8 x64-pc-linux",backup_type:"RMAN Integration",plugin:{name:"Oracle RMAN Plugin",version:"22.3.5-o",description:"RMAN integration for Oracle database backups"}},{client_id:1004,name:"sap-hana-prod",engine:"SAP HANA",engine_version:"2.0",ip:"172.16.5.30",port:"9102",status:"online",last_backup_at:new Date(Date.now()-10800*1e3).toISOString(),version:"22.5.0",os:"SUSE Linux Enterprise Server 15 x64-pc-linux",backup_type:"Backint Integration",plugin:{name:"SAP HANA Backint Plugin",version:"22.5.0-h",description:"SAP HANA Backint interface integration"}}],p=h?.clients||[],v=h?.total||0,N=p.length===0?y:p,B=p.length===0?y.length:v,g=w=>{if(!w)return"-";try{const L=new Date(w),M=new Date().getTime()-L.getTime(),V=Math.floor(M/6e4),T=Math.floor(M/36e5);return V<1?"Just now":V<60?`${V}m ago`:T<24?`${T}h ago`:L.toLocaleDateString()}catch{return"-"}},j=w=>{u(L=>{const K=new Set(L);return K.has(w)?K.delete(w):K.add(w),K})},_=w=>{const L=new URLSearchParams(window.location.search);L.set("tab",w),window.history.replaceState({},"",`${window.location.pathname}?${L.toString()}`),window.location.reload()};return e.jsxs("div",{className:"max-w-[1600px] mx-auto p-6 space-y-8",children:[e.jsxs("header",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>_("clients"),className:"flex items-center justify-center w-10 h-10 rounded-lg border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors text-white",title:"Back to Client Dashboard",children:e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"arrow_back"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white",children:"App & DB Management"}),e.jsxs("span",{className:"px-2.5 py-0.5 rounded-full bg-primary/10 text-primary text-sm font-semibold border border-primary/20",children:[B," Clients"]})]}),e.jsx("p",{className:"mt-1 text-slate-500 dark:text-slate-400",children:"Monitor database engines, application instances, and specialized backup agents."})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>r?.(),className:"flex items-center gap-2 px-4 py-2 bg-slate-200 dark:bg-slate-800 hover:bg-slate-300 dark:hover:bg-slate-700 transition-colors rounded-lg font-medium border border-slate-300 dark:border-slate-700 text-white",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"terminal"}),"Console"]}),e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 transition-colors text-white rounded-lg font-medium shadow-lg shadow-primary/20",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"add"}),"Add New App/DB Client"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"relative flex-grow max-w-md",children:[e.jsx("span",{className:"absolute inset-y-0 left-3 flex items-center pointer-events-none text-slate-400",children:e.jsx("span",{className:"material-symbols-rounded",children:"search"})}),e.jsx("input",{className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"Search clients by name, IP, or engine...",type:"text",value:t,onChange:w=>s(w.target.value)})]}),e.jsxs("div",{className:"flex bg-slate-100 dark:bg-slate-800/50 p-1 rounded-lg border border-slate-200 dark:border-slate-700",children:[e.jsx("button",{onClick:()=>o("all"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="all"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"All"}),e.jsx("button",{onClick:()=>o("enabled"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="enabled"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"Online"}),e.jsx("button",{onClick:()=>o("offline"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="offline"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"Offline"})]}),e.jsxs("div",{className:"flex bg-slate-100 dark:bg-slate-800/50 p-1 rounded-lg border border-slate-200 dark:border-slate-700",children:[e.jsx("button",{onClick:()=>d("all"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${l==="all"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"All Types"}),e.jsx("button",{onClick:()=>d("mysql"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${l==="mysql"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"MySQL"}),e.jsx("button",{onClick:()=>d("postgresql"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${l==="postgresql"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"PostgreSQL"}),e.jsx("button",{onClick:()=>d("oracle"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${l==="oracle"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"Oracle"})]}),e.jsxs("button",{className:"ml-auto flex items-center gap-2 px-4 py-2 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg text-sm font-medium text-white",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"sort"}),"Sort: Status"]})]}),e.jsx("div",{className:"overflow-hidden border border-slate-200 dark:border-slate-800 rounded-xl bg-white dark:bg-slate-900 shadow-sm",children:m?e.jsx("div",{className:"p-8 text-center text-slate-400",children:"Loading clients..."}):x?e.jsx("div",{className:"p-8 text-center text-red-400",children:"Failed to load clients"}):N.length===0?e.jsx("div",{className:"p-12 text-center text-slate-400",children:"No database clients found"}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 dark:bg-slate-800/50 text-slate-500 dark:text-slate-400 text-xs font-bold uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 w-12",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox"})}),e.jsx("th",{className:"px-6 py-4",children:"Client Name"}),e.jsx("th",{className:"px-6 py-4",children:"Engine"}),e.jsx("th",{className:"px-6 py-4",children:"Connection"}),e.jsx("th",{className:"px-6 py-4",children:"Status"}),e.jsx("th",{className:"px-6 py-4",children:"Last Backup"}),e.jsx("th",{className:"px-6 py-4",children:"Version"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-800",children:N.map(w=>{const L=c.has(w.client_id),K=w.status==="online",M=w.engine==="PostgreSQL"?"bg-blue-500":w.engine==="MySQL"?"bg-orange-500":w.engine==="Oracle"?"bg-red-500":w.engine==="SAP HANA"?"bg-purple-500":"bg-blue-400";return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"group hover:bg-slate-50/50 dark:hover:bg-slate-800/30 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox"})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>j(w.client_id),className:"text-slate-400 hover:text-primary transition-colors cursor-pointer",children:e.jsx("span",{className:"material-symbols-rounded",children:L?"keyboard_arrow_down":"keyboard_arrow_right"})}),e.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-500/10 flex items-center justify-center text-indigo-500",children:e.jsx("span",{className:"material-symbols-rounded",children:"database"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-slate-100",children:w.name}),e.jsx("div",{className:"text-xs text-slate-500",children:w.os||"Debian 12 (Bookworm) x64-pc-linux"})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-slate-100 dark:bg-slate-800 text-xs font-medium border border-slate-200 dark:border-slate-700",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${M}`}),w.engine," ",w.engine_version||w.engineVersion||""]})}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"text-sm text-white",children:w.ip||"172.24.10.45"}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:["Port: ",w.port||"9102"]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${K?"bg-emerald-500 animate-pulse":"bg-slate-400"}`}),e.jsx("span",{className:`text-sm font-medium ${K?"text-emerald-500":"text-slate-400"}`,children:K?"Online":"Offline"})]})}),e.jsxs("td",{className:"px-6 py-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-500 font-medium",children:[e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"check_circle"}),"Success"]}),e.jsxs("div",{className:"text-xs text-slate-500",children:[g(w.last_backup_at)," (",w.backup_type||"WAL Archiving",")"]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:"px-2 py-1 bg-slate-100 dark:bg-slate-800 rounded text-xs font-mono border border-slate-200 dark:border-slate-700 text-white",children:["v",w.version||"23.1.2"]})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"p-2 hover:bg-slate-100 dark:hover:bg-slate-700 rounded-full transition-colors text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",children:e.jsx("span",{className:"material-symbols-rounded",children:"more_vert"})})})]},w.client_id),L&&e.jsx("tr",{className:"bg-slate-50/50 dark:bg-slate-800/20",children:e.jsx("td",{className:"px-6 py-6 border-t border-slate-100 dark:border-slate-800",colSpan:8,children:e.jsxs("div",{className:"relative pl-12",children:[e.jsx("div",{className:"absolute left-[20px] top-0 bottom-6 w-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"absolute left-[20px] top-1/2 -translate-y-1/2 w-4 h-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"mb-4 text-xs font-bold text-slate-400 uppercase tracking-widest",children:"Installed Agents & Database Plugins"}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"flex items-center justify-between p-4 bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-xl shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-500/10 flex items-center justify-center text-emerald-500",children:e.jsx("span",{className:"material-symbols-rounded",children:"storage"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-slate-100 text-sm",children:w.plugin?.name||`${w.engine} Backup Plugin`}),e.jsx("div",{className:"text-xs text-slate-500",children:w.plugin?.description||"Database backup and recovery integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"VER"}),e.jsx("span",{className:"font-mono ml-1 text-slate-700 dark:text-slate-300",children:w.plugin?.version||w.version||"23.1.2-b"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-500 text-xs font-bold uppercase tracking-wider",children:[e.jsx("span",{className:"material-symbols-rounded text-[18px]",children:"check_circle"}),"Active"]})]})]})})]})})})]})})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-slate-200 dark:border-slate-800 flex items-center justify-between text-sm text-slate-500",children:[e.jsxs("div",{children:["Showing 1 - ",B," of ",B," clients"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",disabled:!0,children:e.jsx("span",{className:"material-symbols-rounded",children:"chevron_left"})}),e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",disabled:!0,children:e.jsx("span",{className:"material-symbols-rounded",children:"chevron_right"})})]})]})]})}),e.jsxs("section",{className:"bg-slate-950 rounded-xl border border-slate-800 overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"px-6 py-3 border-b border-slate-800 flex items-center justify-between bg-slate-900/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-amber-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-emerald-500/80"})]}),e.jsx("span",{className:"text-xs font-mono text-slate-400 ml-4",children:"Console Log (tail -f)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"}),e.jsx("span",{className:"text-[10px] font-bold text-emerald-500 uppercase tracking-widest",children:"Connected"})]})]}),e.jsxs("div",{className:"p-6 h-48 overflow-y-auto custom-scrollbar font-mono text-[13px] leading-relaxed",children:[e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:01]"})," bareos-dir: Connected to Storage at backup-srv-01:9103"]}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:02]"}),' bareos-sd: Volume "Vol-0012" selected for appending']}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:05]"}),' bareos-fd: Client "',N[0]?.name||"client",'" starting backup of /var/lib/postgresql/15/main']}),e.jsxs("div",{className:"text-amber-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:10]"})," warning: /var/lib/postgresql/15/main/base/16384/2601 locked by another process, skipping..."]}),e.jsxs("div",{className:"text-emerald-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:45]"})," bareos-dir: JobId 10423: Sending Accurate information."]}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:24:12]"})," bareos-fd: Backup successful. Sent 2.4GB to Storage."]}),e.jsx("div",{className:"text-slate-500 italic mt-2 animate-pulse",children:"Waiting for next event..."})]})]})]})}function KS({onSwitchToConsole:r}){const[t,s]=Ce.useState(""),[n,o]=Ce.useState("all"),[l,d]=Ce.useState(new Set),[c,u]=Ce.useState(!1),h=Nr(),{data:m,isLoading:x,error:y}=dt({queryKey:["backup-clients-virtualization",n,t],queryFn:()=>ys.listClients({category:"Virtual",enabled:n==="all"?void 0:n==="enabled",search:t||void 0})}),p={client_id:999,name:"Proxmox Cluster (pve-cluster-01)",ip:"10.0.40.10",hypervisor:"Proxmox VE",version:"8.1",status:"online",last_backup_at:new Date().toISOString(),vms:[{id:101,name:"Ubuntu-Server-Prod",status:"running",last_backup:"Today, 03:00 AM",protection:"protected",node:"pve-01"},{id:102,name:"Win2022-DC",status:"running",last_backup:"Yesterday, 11:45 PM",protection:"protected",node:"pve-01"},{id:105,name:"vm-staging-test",status:"stopped",last_backup:"Never",protection:"unprotected",node:"pve-01"}],total_vms:5,showing_vms:3},v=m?.clients||[],N=m?.total||0,B=v.length===0?[p]:v,g=v.length===0?1:N,j=L=>{if(!L)return"-";try{const K=new Date(L),V=new Date().getTime()-K.getTime(),T=Math.floor(V/6e4),ne=Math.floor(V/36e5);return T<1?"Just now":T<60?`${T}m ago`:ne<24?`${ne}h ago`:K.toLocaleDateString()}catch{return"-"}},_=L=>{d(K=>{const M=new Set(K);return M.has(L)?M.delete(L):M.add(L),M})},w=L=>{const K=new URLSearchParams(window.location.search);K.set("tab",L),window.history.replaceState({},"",`${window.location.pathname}?${K.toString()}`),window.location.reload()};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"max-w-[1600px] mx-auto p-6 space-y-8",children:[e.jsxs("header",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>w("clients"),className:"flex items-center justify-center w-10 h-10 rounded-lg border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors text-white",title:"Back to Client Dashboard",children:e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"arrow_back"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white",children:"Virtualization Client Management"}),e.jsxs("span",{className:"px-2.5 py-0.5 rounded-full bg-primary/10 text-primary text-sm font-semibold border border-primary/20",children:[g," Clients"]})]}),e.jsx("p",{className:"mt-1 text-slate-500 dark:text-slate-400",children:"Monitor virtual machine backups, hypervisor integrations, and VM snapshot management."})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>r?.(),className:"flex items-center gap-2 px-4 py-2 bg-slate-200 dark:bg-slate-800 hover:bg-slate-300 dark:hover:bg-slate-700 transition-colors rounded-lg font-medium border border-slate-300 dark:border-slate-700 text-white",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"terminal"}),"Console"]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 transition-colors text-white rounded-lg font-medium shadow-lg shadow-primary/20",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"add"}),"Add New VM Client"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"relative flex-grow max-w-md",children:[e.jsx("span",{className:"absolute inset-y-0 left-3 flex items-center pointer-events-none text-slate-400",children:e.jsx("span",{className:"material-symbols-rounded",children:"search"})}),e.jsx("input",{className:"w-full pl-10 pr-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"Search clients by name, IP, or hypervisor...",type:"text",value:t,onChange:L=>s(L.target.value)})]}),e.jsxs("div",{className:"flex bg-slate-100 dark:bg-slate-800/50 p-1 rounded-lg border border-slate-200 dark:border-slate-700",children:[e.jsx("button",{onClick:()=>o("all"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="all"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"All"}),e.jsx("button",{onClick:()=>o("enabled"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="enabled"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"Online"}),e.jsx("button",{onClick:()=>o("offline"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${n==="offline"?"bg-white dark:bg-slate-700 shadow-sm text-slate-900 dark:text-white":"text-slate-500 hover:text-slate-900 dark:hover:text-slate-100"}`,children:"Offline"})]}),e.jsxs("button",{className:"ml-auto flex items-center gap-2 px-4 py-2 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg text-sm font-medium text-white",children:[e.jsx("span",{className:"material-symbols-rounded text-[20px]",children:"sort"}),"Sort: Status"]})]}),e.jsx("div",{className:"overflow-hidden border border-slate-200 dark:border-slate-800 rounded-xl bg-white dark:bg-slate-900 shadow-sm",children:x?e.jsx("div",{className:"p-8 text-center text-slate-400",children:"Loading clients..."}):y?e.jsx("div",{className:"p-8 text-center text-red-400",children:"Failed to load clients"}):B.length===0?e.jsx("div",{className:"p-12 text-center text-slate-400",children:"No virtualization clients found"}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 dark:bg-slate-800/50 text-slate-500 dark:text-slate-400 text-xs font-bold uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 w-12",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox"})}),e.jsx("th",{className:"px-6 py-4",children:"Client Name"}),e.jsx("th",{className:"px-6 py-4",children:"Hypervisor"}),e.jsx("th",{className:"px-6 py-4",children:"Connection"}),e.jsx("th",{className:"px-6 py-4",children:"Status"}),e.jsx("th",{className:"px-6 py-4",children:"Last Backup"}),e.jsx("th",{className:"px-6 py-4",children:"Version"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-800",children:B.map(L=>{const K=l.has(L.client_id),M=L.status==="online",V=L.hypervisor==="Proxmox VE"||L.name?.includes("Proxmox");return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"group hover:bg-slate-50/50 dark:hover:bg-slate-800/30 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("input",{className:"rounded border-slate-300 dark:border-slate-600 bg-transparent text-primary focus:ring-primary",type:"checkbox"})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>_(L.client_id),className:"text-slate-400 hover:text-primary transition-colors cursor-pointer",children:e.jsx("span",{className:"material-symbols-rounded",children:K?"keyboard_arrow_down":"keyboard_arrow_right"})}),V?e.jsx("div",{className:"w-10 h-10 rounded-lg bg-orange-500/20 flex items-center justify-center text-orange-500 border border-orange-500/30",children:e.jsx("span",{className:"text-lg font-bold",children:"P"})}):e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center text-purple-500",children:e.jsx("span",{className:"material-symbols-rounded",children:"dns"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-slate-100",children:L.name}),e.jsx("div",{className:"text-xs text-slate-500",children:L.ip?`${L.ip} • ${L.hypervisor||"VM Host"} ${L.version||""}`.trim():"VM Host / Hypervisor"})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full ${V?"bg-orange-500/10 border-orange-500/30":"bg-slate-100 dark:bg-slate-800 border-slate-200 dark:border-slate-700"} text-xs font-medium border`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${V?"bg-orange-500":"bg-purple-500"}`}),L.hypervisor||"VMware vSphere"]})}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"text-sm text-white",children:L.ip||"10.0.50.112"}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:["Port: ",L.port||"9102"]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${M?"bg-emerald-500 animate-pulse":"bg-slate-400"}`}),e.jsx("span",{className:`text-sm font-medium ${M?"text-emerald-500":"text-slate-400"}`,children:M?"CONNECTED":"Offline"})]})}),e.jsxs("td",{className:"px-6 py-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-500 font-medium",children:[e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"check_circle"}),"Success"]}),e.jsxs("div",{className:"text-xs text-slate-500",children:[j(L.last_backup_at)," (Snapshot)"]})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"px-2 py-1 bg-slate-100 dark:bg-slate-800 rounded text-xs font-mono border border-slate-200 dark:border-slate-700 text-white",children:L.version?`v${L.version}`:"v22.4.1"})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"p-2 hover:bg-slate-100 dark:hover:bg-slate-700 rounded-full transition-colors text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",children:e.jsx("span",{className:"material-symbols-rounded",children:"more_vert"})})})]},L.client_id),K&&e.jsx(e.Fragment,{children:V&&L.vms?e.jsx("tr",{className:"bg-slate-50/50 dark:bg-slate-800/20",children:e.jsx("td",{className:"px-6 py-6 border-t border-slate-100 dark:border-slate-800",colSpan:8,children:e.jsxs("div",{className:"relative pl-12",children:[e.jsx("div",{className:"absolute left-[20px] top-0 bottom-6 w-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"absolute left-[20px] top-1/2 -translate-y-1/2 w-4 h-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"mb-4 text-xs font-bold text-slate-400 uppercase tracking-widest",children:"Virtual Machines"}),e.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-xl overflow-hidden",children:[e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 dark:bg-slate-800/50 text-slate-500 dark:text-slate-400 text-xs font-bold uppercase tracking-wider",children:[e.jsx("th",{className:"px-4 py-3",children:"VM ID"}),e.jsx("th",{className:"px-4 py-3",children:"Name"}),e.jsx("th",{className:"px-4 py-3",children:"Status"}),e.jsx("th",{className:"px-4 py-3",children:"Last Backup"}),e.jsx("th",{className:"px-4 py-3",children:"Protection"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-800",children:L.vms.map(T=>e.jsxs("tr",{className:"hover:bg-slate-50/50 dark:hover:bg-slate-800/30 transition-colors",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"font-mono text-sm text-white",children:T.id})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[T.name.includes("Win")?e.jsx("span",{className:"material-symbols-rounded text-slate-400",children:"desktop_windows"}):e.jsx("span",{className:"material-symbols-rounded text-slate-400",children:"folder"}),e.jsx("span",{className:`font-medium text-white ${T.name.includes("staging")?"italic":""}`,children:T.name})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${T.status==="running"?"bg-emerald-500":"bg-slate-400"}`}),e.jsx("span",{className:`text-sm font-medium ${T.status==="running"?"text-emerald-500":"text-slate-400"}`,children:T.status==="running"?"RUNNING":"STOPPED"})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-sm text-white",children:T.last_backup})}),e.jsx("td",{className:"px-4 py-3",children:T.protection==="protected"?e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-500 text-sm font-medium",children:[e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"check_circle"}),"Protected"]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-amber-500 text-sm font-medium",children:[e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"warning"}),"Unprotected"]})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{className:"p-1.5 hover:bg-slate-100 dark:hover:bg-slate-700 rounded transition-colors text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",children:e.jsx("span",{className:"material-symbols-rounded text-[18px]",children:"more_vert"})})})]},T.id))})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 dark:border-slate-800 flex items-center justify-between text-xs text-slate-500 bg-slate-50 dark:bg-slate-900/50",children:[e.jsxs("div",{children:["Showing ",L.showing_vms||L.vms.length," of ",L.total_vms||L.vms.length," VMs found on node ",L.vms[0]?.node||"pve-01"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",disabled:!0,children:e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"chevron_left"})}),e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",children:e.jsx("span",{className:"material-symbols-rounded text-[16px]",children:"chevron_right"})})]})]})]})]})})}):e.jsx("tr",{className:"bg-slate-50/50 dark:bg-slate-800/20",children:e.jsx("td",{className:"px-6 py-6 border-t border-slate-100 dark:border-slate-800",colSpan:8,children:e.jsxs("div",{className:"relative pl-12",children:[e.jsx("div",{className:"absolute left-[20px] top-0 bottom-6 w-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"absolute left-[20px] top-1/2 -translate-y-1/2 w-4 h-px bg-slate-300 dark:bg-slate-700"}),e.jsx("div",{className:"mb-4 text-xs font-bold text-slate-400 uppercase tracking-widest",children:"Installed Agents & Virtualization Plugins"}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"flex items-center justify-between p-4 bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-xl shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center text-purple-500",children:e.jsx("span",{className:"material-symbols-rounded",children:"cloud"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-slate-100 text-sm",children:"VMware vSphere Plugin"}),e.jsx("div",{className:"text-xs text-slate-500",children:"VM snapshot and backup integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"VER"}),e.jsx("span",{className:"font-mono ml-1 text-slate-700 dark:text-slate-300",children:"22.4.1-vm"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-500 text-xs font-bold uppercase tracking-wider",children:[e.jsx("span",{className:"material-symbols-rounded text-[18px]",children:"check_circle"}),"Active"]})]})]})})]})})})})]})})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-slate-200 dark:border-slate-800 flex items-center justify-between text-sm text-slate-500",children:[e.jsxs("div",{children:["Showing 1 - ",g," of ",g," clients"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",disabled:!0,children:e.jsx("span",{className:"material-symbols-rounded",children:"chevron_left"})}),e.jsx("button",{className:"p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-800 disabled:opacity-50",disabled:!0,children:e.jsx("span",{className:"material-symbols-rounded",children:"chevron_right"})})]})]})]})}),e.jsxs("section",{className:"bg-slate-950 rounded-xl border border-slate-800 overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"px-6 py-3 border-b border-slate-800 flex items-center justify-between bg-slate-900/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-amber-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-emerald-500/80"})]}),e.jsx("span",{className:"text-xs font-mono text-slate-400 ml-4",children:"Console Log (tail -f)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"}),e.jsx("span",{className:"text-[10px] font-bold text-emerald-500 uppercase tracking-widest",children:"Connected"})]})]}),e.jsxs("div",{className:"p-6 h-48 overflow-y-auto custom-scrollbar font-mono text-[13px] leading-relaxed",children:[e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:01]"})," bareos-dir: Connected to Storage at backup-srv-01:9103"]}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:02]"}),' bareos-sd: Volume "Vol-0012" selected for appending']}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:22:05]"}),' bareos-fd: Client "',B[0]?.name||"Proxmox Cluster",'" starting VM snapshot backup']}),e.jsxs("div",{className:"text-amber-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:10]"}),' warning: VM "Ubuntu-Server-Prod" is currently powered on, creating snapshot...']}),e.jsxs("div",{className:"text-emerald-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:23:45]"})," bareos-dir: JobId 10423: VM snapshot created successfully."]}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:24:12]"})," bareos-fd: Backup successful. Sent 5.2GB to Storage."]}),e.jsxs("div",{className:"text-slate-400",children:[e.jsx("span",{className:"text-blue-400",children:"[14:25:01]"})," bareos-dir: Found ",B[0]?.total_vms||5," VMs on node pve-01"]}),e.jsx("div",{className:"text-slate-500 italic mt-2 animate-pulse",children:"Waiting for next event..."})]})]})]}),c&&e.jsx(zS,{onClose:()=>u(!1),onSuccess:()=>{u(!1),h.invalidateQueries({queryKey:["backup-clients-virtualization"]})}})]})}function zS({onClose:r,onSuccess:t}){const[s,n]=Ce.useState({clientName:"",ipAddress:"",port:"443",hypervisorType:"vmware",authMethod:"creds",username:"",password:"",retentionPolicy:"standard",storagePool:"pool-01"}),[o]=Ce.useState(1),{data:l}=dt({queryKey:["storage-pools"],queryFn:()=>ys.listStoragePools()}),d=l?.pools||[],c=h=>{h.preventDefault(),console.log("Form submitted:",s),t()},u=()=>{console.log("Testing connection to:",s.ipAddress),alert("Connection test feature coming soon")};return e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-[#161d27] w-full max-w-2xl rounded-xl shadow-2xl border border-slate-200 dark:border-[#2d3748] overflow-hidden flex flex-col max-h-[90vh]",children:[e.jsx("style",{children:` + select option { + background-color: #161d27 !important; + color: white !important; + } + select option:hover, + select option:checked, + select option:focus { + background-color: #1d72f2 !important; + color: white !important; + } + `}),e.jsxs("div",{className:"px-6 py-5 border-b border-slate-200 dark:border-[#2d3748] flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight text-white",children:"Add New VM Client"}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mt-1",children:"Configure a new virtualization client for backup operations."})]}),e.jsx("button",{onClick:r,className:"text-slate-400 hover:text-slate-600 dark:hover:text-white transition-colors",children:e.jsx("span",{className:"material-symbols-rounded",children:"close"})})]}),e.jsx("div",{className:"px-6 py-4 bg-slate-50 dark:bg-slate-900/50 border-b border-slate-200 dark:border-[#2d3748] overflow-x-auto",children:e.jsxs("div",{className:"flex items-center space-x-8 text-sm font-medium whitespace-nowrap",children:[e.jsxs("div",{className:`flex items-center ${o===1?"text-primary":"text-slate-400"}`,children:[e.jsx("span",{className:`w-6 h-6 rounded-full ${o===1?"bg-primary/10 border border-primary":"border border-slate-300 dark:border-slate-700"} flex items-center justify-center text-xs mr-2`,children:"1"}),"Client Details"]}),e.jsxs("div",{className:`flex items-center ${o===2?"text-primary":"text-slate-400"}`,children:[e.jsx("span",{className:`w-6 h-6 rounded-full ${o===2?"bg-primary/10 border border-primary":"border border-slate-300 dark:border-slate-700"} flex items-center justify-center text-xs mr-2`,children:"2"}),"Hypervisor"]}),e.jsxs("div",{className:`flex items-center ${o===3?"text-primary":"text-slate-400"}`,children:[e.jsx("span",{className:`w-6 h-6 rounded-full ${o===3?"bg-primary/10 border border-primary":"border border-slate-300 dark:border-slate-700"} flex items-center justify-center text-xs mr-2`,children:"3"}),"Authentication"]}),e.jsxs("div",{className:`flex items-center ${o===4?"text-primary":"text-slate-400"}`,children:[e.jsx("span",{className:`w-6 h-6 rounded-full ${o===4?"bg-primary/10 border border-primary":"border border-slate-300 dark:border-slate-700"} flex items-center justify-center text-xs mr-2`,children:"4"}),"Settings"]})]})}),e.jsx("div",{className:"p-6 overflow-y-auto flex-1",children:e.jsxs("form",{onSubmit:c,className:"space-y-8",children:[e.jsxs("section",{children:[e.jsxs("h3",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider mb-4 flex items-center",children:[e.jsx("span",{className:"material-symbols-rounded text-sm mr-2",children:"info"}),"Client Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Client Name"}),e.jsx("input",{type:"text",value:s.clientName,onChange:h=>n({...s,clientName:h.target.value}),className:"w-full bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-[#2d3748] rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all placeholder:text-slate-500 text-white",placeholder:"e.g. production-vcenter",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"col-span-2 space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"IP Address / FQDN"}),e.jsx("input",{type:"text",value:s.ipAddress,onChange:h=>n({...s,ipAddress:h.target.value}),className:"w-full bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-[#2d3748] rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"192.168.1.50",required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Port"}),e.jsx("input",{type:"text",value:s.port,onChange:h=>n({...s,port:h.target.value}),className:"w-full bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-[#2d3748] rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"443",required:!0})]})]})]})]}),e.jsxs("section",{children:[e.jsxs("h3",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider mb-4 flex items-center",children:[e.jsx("span",{className:"material-symbols-rounded text-sm mr-2",children:"storage"}),"Hypervisor & Auth"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Hypervisor Type"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s.hypervisorType,onChange:h=>n({...s,hypervisorType:h.target.value}),className:"w-full bg-primary/10 dark:bg-primary/20 border border-primary/30 dark:border-primary/40 rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary outline-none appearance-none cursor-pointer transition-all text-white pr-8 [&>option]:bg-[#161d27] [&>option]:text-white",children:[e.jsx("option",{value:"vmware",className:"bg-[#161d27] text-white",children:"VMware vSphere"}),e.jsx("option",{value:"proxmox",className:"bg-[#161d27] text-white",children:"Proxmox VE"}),e.jsx("option",{value:"ovirt",className:"bg-[#161d27] text-white",children:"oVirt / Red Hat Virtualization"})]}),e.jsx("span",{className:"material-symbols-rounded absolute right-2 top-2 pointer-events-none text-primary",children:"expand_more"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Authentication Method"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s.authMethod,onChange:h=>n({...s,authMethod:h.target.value}),className:"w-full bg-primary/10 dark:bg-primary/20 border border-primary/30 dark:border-primary/40 rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary outline-none appearance-none cursor-pointer transition-all text-white pr-8 [&>option]:bg-[#161d27] [&>option]:text-white",children:[e.jsx("option",{value:"creds",className:"bg-[#161d27] text-white",children:"Username / Password"}),e.jsx("option",{value:"token",className:"bg-[#161d27] text-white",children:"API Token"})]}),e.jsx("span",{className:"material-symbols-rounded absolute right-2 top-2 pointer-events-none text-primary",children:"expand_more"})]})]})]}),e.jsx("div",{className:"mt-4 p-4 rounded-lg bg-slate-50 dark:bg-slate-900/30 border border-slate-200 dark:border-[#2d3748] space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Username"}),e.jsx("input",{type:"text",value:s.username,onChange:h=>n({...s,username:h.target.value}),className:"w-full bg-white dark:bg-[#161d27] border border-slate-200 dark:border-[#2d3748] rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"administrator@vsphere.local",required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Password"}),e.jsx("input",{type:"password",value:s.password,onChange:h=>n({...s,password:h.target.value}),className:"w-full bg-white dark:bg-[#161d27] border border-slate-200 dark:border-[#2d3748] rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all text-white",placeholder:"••••••••••••",required:!0})]})]})})]}),e.jsxs("section",{children:[e.jsxs("h3",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider mb-4 flex items-center",children:[e.jsx("span",{className:"material-symbols-rounded text-sm mr-2",children:"settings_backup_restore"}),"Backup Settings"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Retention Policy"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:s.retentionPolicy,onChange:h=>n({...s,retentionPolicy:h.target.value}),className:"w-full bg-primary/10 dark:bg-primary/20 border border-primary/30 dark:border-primary/40 rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary outline-none appearance-none cursor-pointer transition-all text-white pr-8 [&>option]:bg-[#161d27] [&>option]:text-white",children:[e.jsx("option",{value:"standard",className:"bg-[#161d27] text-white",children:"Standard (30 Days)"}),e.jsx("option",{value:"long",className:"bg-[#161d27] text-white",children:"Long Term (1 Year)"}),e.jsx("option",{value:"short",className:"bg-[#161d27] text-white",children:"Critical (7 Days)"})]}),e.jsx("span",{className:"material-symbols-rounded absolute right-2 top-2 pointer-events-none text-primary",children:"expand_more"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Target Storage Pool"}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:s.storagePool,onChange:h=>n({...s,storagePool:h.target.value}),className:"w-full bg-primary/10 dark:bg-primary/20 border border-primary/30 dark:border-primary/40 rounded-md px-3 py-2 focus:ring-2 focus:ring-primary focus:border-primary outline-none appearance-none cursor-pointer transition-all text-white pr-8 [&>option]:bg-[#161d27] [&>option]:text-white",children:d.length>0?d.map(h=>e.jsx("option",{value:h.name,className:"bg-[#161d27] text-white",children:h.name},h.pool_id)):e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"pool-01",className:"bg-[#161d27] text-white",children:"SSD-Fast-Pool-01"}),e.jsx("option",{value:"pool-02",className:"bg-[#161d27] text-white",children:"HDD-Archive-Pool-02"})]})}),e.jsx("span",{className:"material-symbols-rounded absolute right-2 top-2 pointer-events-none text-primary",children:"expand_more"})]})]})]})]})]})}),e.jsxs("div",{className:"px-6 py-4 bg-slate-50 dark:bg-slate-900/50 border-t border-slate-200 dark:border-[#2d3748] flex items-center justify-between",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-md transition-all",children:"Cancel"}),e.jsxs("div",{className:"flex space-x-3",children:[e.jsxs("button",{type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-md transition-all flex items-center",children:[e.jsx("span",{className:"material-symbols-rounded text-sm mr-1.5",children:"check_circle"}),"Test Connection"]}),e.jsxs("button",{type:"submit",onClick:c,className:"bg-primary hover:bg-primary/90 text-white px-6 py-2 rounded-md font-medium text-sm flex items-center shadow-lg shadow-primary/20 transition-all",children:[e.jsx("span",{className:"material-symbols-rounded text-sm mr-1.5",children:"add"}),"Add Client"]})]})]})]})})}function qS(){const r=Cy(),s=new URLSearchParams(r.search).get("view"),[n,o]=Ce.useState(s||"pools");Ce.useEffect(()=>{const V=new URLSearchParams(r.search).get("view")||"pools";V!==n&&(V==="pools"||V==="volumes"||V==="daemons")&&o(V)},[r.search]);const l=M=>{o(M);const V=new URLSearchParams(r.search);V.set("tab","storage"),M==="pools"?V.delete("view"):V.set("view",M);const T=`${r.pathname}?${V.toString()}`;window.history.replaceState({},"",T)},[d,c]=Ce.useState("list"),[u,h]=Ce.useState(!1),[m,x]=Ce.useState(null),y=Nr(),{data:p,isLoading:v}=dt({queryKey:["storage-pools"],queryFn:()=>ys.listStoragePools()}),N=ft({mutationFn:ys.createStoragePool,onSuccess:()=>{y.invalidateQueries({queryKey:["storage-pools"]}),c("list")}}),B=ft({mutationFn:ys.deleteStoragePool,onSuccess:()=>{y.invalidateQueries({queryKey:["storage-pools"]}),h(!1),x(null)}}),{data:g,isLoading:j}=dt({queryKey:["storage-daemons"],queryFn:()=>ys.listStorageDaemons(),enabled:n==="daemons"}),_=p?.pools||[],w=g?.daemons||[],L=M=>{if(M===0)return"0 B";const V=1024,T=["B","KB","MB","GB","TB"],ne=Math.floor(Math.log(M)/Math.log(V));return`${(M/Math.pow(V,ne)).toFixed(2)} ${T[ne]}`},K=M=>{const T={Full:{bg:"bg-green-500/10",text:"text-green-400",border:"border-green-500/20"},Append:{bg:"bg-blue-500/10",text:"text-blue-400",border:"border-blue-500/20"},Used:{bg:"bg-yellow-500/10",text:"text-yellow-400",border:"border-yellow-500/20"},Error:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/20"},Online:{bg:"bg-green-500/10",text:"text-green-400",border:"border-green-500/20"},Offline:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/20"}}[M]||{bg:"bg-gray-500/10",text:"text-gray-400",border:"border-gray-500/20"};return e.jsx("span",{className:`inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs font-medium ${T.bg} ${T.text} border ${T.border}`,children:M})};return e.jsxs("div",{className:"flex flex-col gap-6 flex-1",children:[e.jsx("header",{className:"flex flex-wrap justify-between items-end gap-4 border-b border-border-dark pb-6",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-white text-3xl md:text-4xl font-black leading-tight tracking-tight",children:"Storage Management"}),e.jsxs("span",{className:"flex h-6 px-2 items-center rounded-full bg-surface-highlight border border-border-dark text-xs font-bold text-primary",children:[_.length," Pools"]})]}),e.jsx("p",{className:"text-text-secondary text-base font-normal max-w-2xl",children:"Manage storage pools, volumes, and storage daemons for backup operations."})]})}),e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("div",{className:"flex border-b border-border-dark gap-8 min-w-max",children:[e.jsxs("button",{onClick:()=>l("pools"),className:`flex items-center gap-2 border-b-[3px] pb-3 pt-2 transition-colors ${n==="pools"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base",children:"hard_drive"}),e.jsx("p",{className:"text-sm font-bold tracking-wide",children:"Pools"})]}),e.jsxs("button",{onClick:()=>l("volumes"),className:`flex items-center gap-2 border-b-[3px] pb-3 pt-2 transition-colors ${n==="volumes"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base",children:"storage"}),e.jsx("p",{className:"text-sm font-bold tracking-wide",children:"Volumes"})]}),e.jsxs("button",{onClick:()=>l("daemons"),className:`flex items-center gap-2 border-b-[3px] pb-3 pt-2 transition-colors ${n==="daemons"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base",children:"dns"}),e.jsx("p",{className:"text-sm font-bold tracking-wide",children:"Storage Daemons"})]})]})}),n==="pools"&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4 border-b border-border-dark pb-4",children:[e.jsxs("button",{onClick:()=>c("list"),className:`px-4 py-2 rounded-lg text-sm font-bold transition-colors ${d==="list"?"bg-primary text-white":"bg-surface-highlight text-text-secondary hover:text-white hover:bg-[#2a3c50]"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-2 align-middle",children:"list"}),"List Current Pools"]}),e.jsxs("button",{onClick:()=>c("add"),className:`px-4 py-2 rounded-lg text-sm font-bold transition-colors ${d==="add"?"bg-primary text-white":"bg-surface-highlight text-text-secondary hover:text-white hover:bg-[#2a3c50]"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-2 align-middle",children:"add"}),"Add Pool"]}),e.jsxs("button",{onClick:()=>c("delete"),className:`px-4 py-2 rounded-lg text-sm font-bold transition-colors ${d==="delete"?"bg-primary text-white":"bg-surface-highlight text-text-secondary hover:text-white hover:bg-[#2a3c50]"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-2 align-middle",children:"delete"}),"Delete Pool"]})]}),d==="list"&&e.jsx("div",{className:"rounded-lg border border-border-dark bg-surface-highlight overflow-hidden shadow-sm",children:v?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading pools..."}):_.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No storage pools found"})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-dark border-b border-border-dark text-text-secondary text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Pool Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Type"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Volumes"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Usage"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Capacity"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Options"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:_.map(M=>e.jsxs("tr",{className:"hover:bg-surface-dark/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded bg-surface-dark flex items-center justify-center text-primary border border-border-dark",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"hard_drive"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-bold",children:M.name}),M.label_format&&e.jsx("p",{className:"text-text-secondary text-xs",children:M.label_format})]})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.pool_type||"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.volume_count}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("span",{className:"text-white text-xs font-bold",children:[Math.round(M.usage_percent),"%"]})}),e.jsx("div",{className:"w-full bg-[#111a22] h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-primary to-blue-400 h-full rounded-full",style:{width:`${Math.min(M.usage_percent,100)}%`}})})]})}),e.jsxs("td",{className:"px-6 py-4 text-text-secondary font-mono text-xs",children:[L(M.used_bytes)," / ",L(M.total_bytes)]}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[M.recycle&&e.jsx("span",{className:"text-xs text-text-secondary",children:"Recycle"}),M.auto_prune&&e.jsx("span",{className:"text-xs text-text-secondary",children:"Auto-Prune"})]})})]},M.pool_id))})]})})})}),d==="add"&&e.jsxs("div",{className:"rounded-lg border border-border-dark bg-surface-highlight p-6",children:[e.jsx("h3",{className:"text-white text-xl font-bold mb-4",children:"Create New Storage Pool"}),e.jsx("p",{className:"text-text-secondary text-sm mb-6",children:"Pools define the set of storage Volumes to be used by Bacula. Configure different pools to organize your backup data."}),e.jsx(GS,{onSubmit:M=>{N.mutate(M)},isLoading:N.isPending,onCancel:()=>c("list")})]}),d==="delete"&&e.jsx("div",{className:"rounded-lg border border-border-dark bg-surface-highlight overflow-hidden shadow-sm",children:v?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading pools..."}):_.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No storage pools found"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 border-b border-border-dark",children:e.jsx("p",{className:"text-text-secondary text-sm mb-4",children:"Select a pool to delete. Pools with volumes cannot be deleted."})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-dark border-b border-border-dark text-text-secondary text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Pool Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Type"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Volumes"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Usage"}),e.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:_.map(M=>e.jsxs("tr",{className:"hover:bg-surface-dark/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded bg-surface-dark flex items-center justify-center text-primary border border-border-dark",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"hard_drive"})}),e.jsx("p",{className:"text-white font-bold",children:M.name})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.pool_type||"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.volume_count}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-white text-xs font-bold",children:[Math.round(M.usage_percent),"%"]}),e.jsx("div",{className:"w-24 bg-[#111a22] h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-primary to-blue-400 h-full rounded-full",style:{width:`${Math.min(M.usage_percent,100)}%`}})})]})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("button",{onClick:()=>{x(M),h(!0)},disabled:M.volume_count>0,className:`px-4 py-2 rounded-lg text-sm font-bold transition-colors ${M.volume_count>0?"bg-gray-500/20 text-gray-500 cursor-not-allowed":"bg-red-500/10 text-red-400 hover:bg-red-500/20 border border-red-500/20"}`,title:M.volume_count>0?"Cannot delete pool with volumes":"Delete pool",children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-1 align-middle",children:"delete"}),"Delete"]})})]},M.pool_id))})]})})]})})]}),n==="volumes"&&e.jsx(VS,{pools:_}),n==="daemons"&&e.jsx("div",{className:"rounded-lg border border-border-dark bg-surface-highlight overflow-hidden shadow-sm",children:j?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading storage daemons..."}):w.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No storage daemons found"})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-dark border-b border-border-dark text-text-secondary text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Address"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Port"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Device"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Media Type"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:w.map(M=>e.jsxs("tr",{className:"hover:bg-surface-dark/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded bg-surface-dark flex items-center justify-center text-primary border border-border-dark",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"dns"})}),e.jsx("p",{className:"text-white font-bold",children:M.name})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary font-mono text-xs",children:M.address}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.port}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.device_name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:M.media_type}),e.jsx("td",{className:"px-6 py-4",children:K(M.status)})]},M.storage_id))})]})})})}),u&&m&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-surface-highlight border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsx("h3",{className:"text-white text-xl font-bold mb-2",children:"Delete Storage Pool"}),e.jsxs("p",{className:"text-text-secondary text-sm mb-4",children:["Are you sure you want to delete pool ",e.jsx("span",{className:"text-white font-bold",children:m.name}),"?"]}),m.volume_count>0&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3 mb-4",children:e.jsxs("p",{className:"text-red-400 text-sm",children:["⚠️ This pool contains ",m.volume_count," volume(s). Pools with volumes cannot be deleted."]})}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:()=>{h(!1),x(null)},className:"px-4 py-2 rounded-lg bg-surface-dark border border-border-dark text-white text-sm font-bold hover:bg-[#2a3c50] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{m.volume_count===0&&B.mutate(m.pool_id)},disabled:m.volume_count>0||B.isPending,className:"px-4 py-2 rounded-lg bg-red-500 text-white text-sm font-bold hover:bg-red-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:B.isPending?"Deleting...":"Delete Pool"})]})]})})]})}function GS({onSubmit:r,isLoading:t,onCancel:s}){const[n,o]=Ce.useState({name:"",pool_type:"Backup",label_format:"",recycle:!1,auto_prune:!1}),l=d=>{d.preventDefault(),r({name:n.name,pool_type:n.pool_type,label_format:n.label_format||void 0,recycle:n.recycle||void 0,auto_prune:n.auto_prune||void 0})};return e.jsxs("form",{onSubmit:l,className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:["Pool Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{type:"text",required:!0,value:n.name,onChange:d=>o({...n,name:d.target.value}),placeholder:"e.g., Full-Backup, Incremental-Backup",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Unique name for the storage pool"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:["Pool Type ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs("select",{value:n.pool_type,onChange:d=>o({...n,pool_type:d.target.value}),className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"Backup",children:"Backup"}),e.jsx("option",{value:"Scratch",children:"Scratch"}),e.jsx("option",{value:"Recycle",children:"Recycle"})]}),e.jsxs("p",{className:"text-text-secondary text-xs mt-1",children:[n.pool_type==="Backup"&&"Contains volumes for backup data with retention periods",n.pool_type==="Scratch"&&"Contains volumes that can be used by any pool when needed",n.pool_type==="Recycle"&&"Contains volumes that have been purged and are ready for reuse"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Label Format"}),e.jsx("input",{type:"text",value:n.label_format,onChange:d=>o({...n,label_format:d.target.value}),placeholder:"e.g., Vol-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-${Counter:4}",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Format string for automatic volume labeling"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.recycle||!1,onChange:d=>o({...n,recycle:d.target.checked}),className:"checkbox-custom"}),e.jsx("span",{className:"text-text-secondary text-sm",children:"Recycle"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.auto_prune||!1,onChange:d=>o({...n,auto_prune:d.target.checked}),className:"checkbox-custom"}),e.jsx("span",{className:"text-text-secondary text-sm",children:"Auto-Prune"})]})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 rounded-lg bg-surface-dark border border-border-dark text-white text-sm font-bold hover:bg-[#2a3c50] transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:t||!n.name,className:"px-4 py-2 rounded-lg bg-primary text-white text-sm font-bold hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:t?"Creating...":"Create Pool"})]})]})}function VS({pools:r}){const[t,s]=Ce.useState("list"),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(!1),[c,u]=Ce.useState(null),[h,m]=Ce.useState(null),[x,y]=Ce.useState(new Set),[p,v]=Ce.useState(""),[N,B]=Ce.useState(null),[g,j]=Ce.useState(1),_=5,w=Nr(),{data:L,isLoading:K}=dt({queryKey:["backup-media"],queryFn:()=>ys.listMedia(),enabled:t==="list",refetchOnWindowFocus:!1}),{data:M,isLoading:V}=dt({queryKey:["storage-volumes"],queryFn:()=>ys.listStorageVolumes(),enabled:t!=="list"}),T=ft({mutationFn:ys.createStorageVolume,onSuccess:()=>{w.invalidateQueries({queryKey:["storage-volumes"]}),s("list")}}),ne=ft({mutationFn:({volumeId:te,data:J})=>ys.updateStorageVolume(te,J),onSuccess:()=>{w.invalidateQueries({queryKey:["storage-volumes"]}),d(!1),m(null)}}),Z=ft({mutationFn:ys.deleteStorageVolume,onSuccess:()=>{w.invalidateQueries({queryKey:["storage-volumes"]}),o(!1),u(null)}}),U=L?.media||[],q=M?.volumes||[],F=te=>{if(te===0)return"0 B";const J=1024,O=["B","KB","MB","GB","TB"],H=Math.floor(Math.log(te)/Math.log(J));return`${(te/Math.pow(J,H)).toFixed(2)} ${O[H]}`},le=te=>{const O={Full:{bg:"bg-green-500/10",text:"text-green-400",border:"border-green-500/20"},Append:{bg:"bg-blue-500/10",text:"text-blue-400",border:"border-blue-500/20"},Used:{bg:"bg-yellow-500/10",text:"text-yellow-400",border:"border-yellow-500/20"},Error:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/20"},Recycle:{bg:"bg-gray-500/10",text:"text-gray-400",border:"border-gray-500/20"},Purged:{bg:"bg-gray-500/10",text:"text-gray-400",border:"border-gray-500/20"},Online:{bg:"bg-green-500/10",text:"text-green-400",border:"border-green-500/20"},Offline:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/20"}}[te]||{bg:"bg-gray-500/10",text:"text-gray-400",border:"border-gray-500/20"};return e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${O.bg} ${O.text} border ${O.border}`,children:te})},ae=U.filter(te=>{if(!p)return!0;const J=p.toLowerCase();return te.volume_name.toLowerCase().includes(J)||te.pool_name.toLowerCase().includes(J)||te.status.toLowerCase().includes(J)||te.media_type.toLowerCase().includes(J)}),se=Math.ceil(ae.length/_),fe=(g-1)*_,ye=fe+_,_e=ae.slice(fe,ye),xe=te=>{if(!te)return"-";try{return new Date(te).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return te}},D=te=>{y(te?new Set(_e.map(J=>J.media_id)):new Set)},$=(te,J)=>{const O=new Set(x);J?O.add(te):O.delete(te),y(O)},X=U.find(te=>te.media_id===N);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[e.jsxs("button",{onClick:()=>s("list"),className:"bg-primary hover:bg-primary/90 text-white px-5 py-2 rounded shadow-sm flex items-center gap-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",children:[e.jsx("span",{className:"material-symbols-outlined text-lg",children:"format_list_bulleted"}),"List Current Volumes"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>s("add"),className:"bg-[#1c2936] border border-border-dark text-white hover:bg-[#2a3c50] px-4 py-2 rounded flex items-center gap-2 text-sm font-medium transition-colors shadow-sm",children:[e.jsx("span",{className:"material-symbols-outlined text-lg text-green-500",children:"add"}),"Add Volume"]}),e.jsxs("button",{onClick:()=>s("delete"),className:"bg-[#1c2936] border border-border-dark text-white hover:bg-[#2a3c50] px-4 py-2 rounded flex items-center gap-2 text-sm font-medium transition-colors shadow-sm group",children:[e.jsx("span",{className:"material-symbols-outlined text-lg text-red-500 group-hover:text-red-400",children:"delete_outline"}),"Delete Volume"]}),e.jsxs("button",{onClick:()=>s("update"),className:"bg-[#1c2936] border border-border-dark text-white hover:bg-[#2a3c50] px-4 py-2 rounded flex items-center gap-2 text-sm font-medium transition-colors shadow-sm",children:[e.jsx("span",{className:"material-symbols-outlined text-lg text-text-secondary",children:"edit"}),"Update Volume"]})]}),e.jsxs("div",{className:"md:ml-auto relative",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3",children:e.jsx("span",{className:"material-symbols-outlined text-text-secondary text-lg",children:"search"})}),e.jsx("input",{type:"text",value:p,onChange:te=>{v(te.target.value),j(1)},className:"w-full md:w-64 bg-[#1c2936] border border-border-dark text-white text-sm rounded pl-10 pr-3 py-2 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary placeholder-text-secondary shadow-sm",placeholder:"Filter volumes..."})]})]}),t==="list"&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-border-dark bg-[#1c2936] flex justify-between items-center",children:[e.jsx("h2",{className:"text-sm font-bold uppercase tracking-wider text-text-secondary",children:"Volume Inventory"}),e.jsx("div",{className:"flex gap-2 text-xs",children:e.jsxs("span",{className:"text-text-secondary",children:["Showing ",e.jsx("span",{className:"font-medium",children:fe+1})," to ",e.jsx("span",{className:"font-medium",children:Math.min(ye,ae.length)})," of"," ",e.jsx("span",{className:"font-medium",children:ae.length})," items"]})})]}),K?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading media..."}):ae.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No media found"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm whitespace-nowrap",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-dark bg-[#1c2936]",children:[e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary w-10",children:e.jsx("input",{type:"checkbox",checked:_e.length>0&&_e.every(te=>x.has(te.media_id)),onChange:te=>D(te.target.checked),className:"rounded border-border-dark text-primary focus:ring-primary bg-[#1c2936]"})}),e.jsxs("th",{className:"px-6 py-3 font-semibold text-text-secondary cursor-pointer hover:text-primary group",children:["Volume Name ",e.jsx("span",{className:"material-symbols-outlined text-xs align-middle opacity-0 group-hover:opacity-100",children:"arrow_downward"})]}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary",children:"Pool"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary",children:"Status"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary",children:"Library"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary text-right",children:"Capacity"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary text-right",children:"Used"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary",children:"Retention"}),e.jsx("th",{className:"px-6 py-3 font-semibold text-text-secondary text-right",children:"Last Written"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:_e.map(te=>{const J=N===te.media_id;return e.jsxs("tr",{onClick:()=>B(J?null:te.media_id),className:`hover:bg-[#2a3c50] transition-colors cursor-pointer border-l-4 ${J?"bg-primary/10 border-l-primary":"border-l-transparent"}`,children:[e.jsx("td",{className:"px-6 py-4",onClick:O=>O.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:J||x.has(te.media_id),onChange:O=>{$(te.media_id,O.target.checked),O.target.checked&&B(te.media_id)},onClick:O=>O.stopPropagation(),className:"rounded border-border-dark text-primary focus:ring-primary bg-[#1c2936]"})}),e.jsxs("td",{className:"px-6 py-4 font-medium text-white flex items-center gap-2",children:[e.jsx("span",{className:`material-symbols-outlined text-lg ${J?"text-primary":"text-text-secondary"}`,children:"hard_drive"}),te.volume_name]}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:te.pool_name}),e.jsx("td",{className:"px-6 py-4",children:le(te.status)}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:te.media_type&&(te.media_type.toLowerCase().includes("lto")||te.media_type.toLowerCase().includes("tape"))&&te.in_changer&&te.in_changer>0?e.jsxs("span",{children:[te.library_name||"Unknown"," ",te.slot&&te.slot>0?`(Slot ${te.slot})`:""]}):e.jsx("span",{className:"text-text-secondary/50",children:"-"})}),e.jsx("td",{className:"px-6 py-4 text-right text-text-secondary",children:F(te.max_vol_bytes)}),e.jsx("td",{className:"px-6 py-4 text-right text-white font-medium",children:F(te.vol_bytes)}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:te.max_vol_bytes>0&&te.vol_bytes>0?"30 Days":"-"}),e.jsx("td",{className:"px-6 py-4 text-right text-text-secondary text-xs",children:xe(te.last_written)})]},te.media_id)})})]})}),e.jsxs("div",{className:"px-6 py-3 border-t border-border-dark bg-[#1c2936] flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-text-secondary",children:["Showing ",e.jsx("span",{className:"font-medium",children:fe+1})," to ",e.jsx("span",{className:"font-medium",children:Math.min(ye,ae.length)})," of"," ",e.jsx("span",{className:"font-medium",children:ae.length})," results"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>j(te=>Math.max(1,te-1)),disabled:g===1,className:"p-1 rounded hover:bg-[#2a3c50] text-text-secondary disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"chevron_left"})}),e.jsx("button",{onClick:()=>j(te=>Math.min(se,te+1)),disabled:g>=se,className:"p-1 rounded hover:bg-[#2a3c50] text-text-secondary disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"chevron_right"})})]})]})]})]}),X&&e.jsxs("div",{className:"mt-8 bg-[#1c2936] border border-border-dark rounded shadow-sm",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-border-dark flex justify-between items-center",children:[e.jsxs("h3",{className:"text-lg font-bold text-white font-display flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-primary",children:"info"}),"Volume Details: ",X.volume_name]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"text-xs text-primary hover:underline font-medium",children:"View Jobs"}),e.jsx("span",{className:"text-text-secondary",children:"|"}),e.jsx("button",{className:"text-xs text-primary hover:underline font-medium",children:"Prune Volume"})]})]}),e.jsxs("div",{className:"p-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-semibold text-text-secondary uppercase tracking-wider mb-1",children:"Volume ID"}),e.jsx("span",{className:"text-sm text-white",children:X.media_id})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-semibold text-text-secondary uppercase tracking-wider mb-1",children:"Media Type"}),e.jsx("span",{className:"text-sm text-white",children:X.media_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-semibold text-text-secondary uppercase tracking-wider mb-1",children:"Label Date"}),e.jsx("span",{className:"text-sm text-white",children:xe(X.last_written)||"-"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-semibold text-text-secondary uppercase tracking-wider mb-1",children:"Storage Device"}),e.jsx("span",{className:"text-sm text-white",children:X.pool_name})]}),e.jsxs("div",{className:"col-span-1 md:col-span-2 lg:col-span-4 border-t border-border-dark pt-4 mt-2",children:[e.jsx("span",{className:"block text-xs font-semibold text-text-secondary uppercase tracking-wider mb-2",children:"Capacity Usage"}),e.jsx("div",{className:"w-full bg-[#2a3c50] rounded-full h-2.5 mb-1",children:e.jsx("div",{className:"bg-primary h-2.5 rounded-full",style:{width:`${X.max_vol_bytes>0?Math.min(100,X.vol_bytes/X.max_vol_bytes*100):0}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-text-secondary",children:[e.jsxs("span",{children:[F(X.vol_bytes)," Used"]}),e.jsxs("span",{children:[F(X.max_vol_bytes)," Total"]})]})]})]}),e.jsxs("div",{className:"px-6 py-4 bg-[#1c2936] border-t border-border-dark flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>B(null),className:"px-4 py-2 text-sm font-medium text-text-secondary hover:text-white transition-colors",children:"Close"}),e.jsx("button",{onClick:()=>{m({volume_id:X.media_id}),d(!0)},className:"bg-primary hover:bg-primary/90 text-white px-4 py-2 rounded text-sm font-medium transition-colors shadow-sm",children:"Edit Properties"})]})]})]}),t==="add"&&e.jsxs("div",{className:"rounded-lg border border-border-dark bg-surface-highlight p-6",children:[e.jsx("h3",{className:"text-white text-xl font-bold mb-4",children:"Create New Storage Volume"}),e.jsx("p",{className:"text-text-secondary text-sm mb-6",children:"Volumes are archive units where Bacula stores backed up data. Each volume belongs to a Pool and can be a tape or a disk file."}),e.jsx(WS,{pools:r,onSubmit:te=>{T.mutate(te)},isLoading:T.isPending,onCancel:()=>s("list")})]}),t==="delete"&&e.jsx("div",{className:"rounded-lg border border-border-dark bg-surface-highlight overflow-hidden shadow-sm",children:V?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading volumes..."}):q.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No volumes found"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 border-b border-border-dark",children:e.jsx("p",{className:"text-text-secondary text-sm mb-4",children:"Select a volume to delete. Volumes with data cannot be deleted."})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-dark border-b border-border-dark text-text-secondary text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Volume Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Pool"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Size"}),e.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:q.map(te=>e.jsxs("tr",{className:"hover:bg-surface-dark/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 text-white font-medium",children:te.volume_name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:te.pool_name}),e.jsx("td",{className:"px-6 py-4",children:le(te.vol_status)}),e.jsxs("td",{className:"px-6 py-4 text-text-secondary font-mono text-xs",children:[F(te.vol_bytes)," / ",F(te.max_vol_bytes)]}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("button",{onClick:()=>{u(te),o(!0)},disabled:te.vol_bytes>0,className:`px-4 py-2 rounded-lg text-sm font-bold transition-colors ${te.vol_bytes>0?"bg-gray-500/20 text-gray-500 cursor-not-allowed":"bg-red-500/10 text-red-400 hover:bg-red-500/20 border border-red-500/20"}`,title:te.vol_bytes>0?"Cannot delete volume with data":"Delete volume",children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-1 align-middle",children:"delete"}),"Delete"]})})]},te.volume_id))})]})})]})}),t==="update"&&e.jsx("div",{className:"rounded-lg border border-border-dark bg-surface-highlight overflow-hidden shadow-sm",children:V?e.jsx("div",{className:"p-8 text-center text-text-secondary",children:"Loading volumes..."}):q.length===0?e.jsx("div",{className:"p-12 text-center",children:e.jsx("p",{className:"text-text-secondary",children:"No volumes found"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 border-b border-border-dark",children:e.jsx("p",{className:"text-text-secondary text-sm mb-4",children:"Select a volume to update its meta-data (Max Volume Bytes, Retention Period)."})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-dark border-b border-border-dark text-text-secondary text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Volume Name"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Pool"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Status"}),e.jsx("th",{className:"px-6 py-4 font-semibold",children:"Max Size"}),e.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark text-sm",children:q.map(te=>e.jsxs("tr",{className:"hover:bg-surface-dark/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 text-white font-medium",children:te.volume_name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:te.pool_name}),e.jsx("td",{className:"px-6 py-4",children:le(te.vol_status)}),e.jsx("td",{className:"px-6 py-4 text-text-secondary font-mono text-xs",children:F(te.max_vol_bytes)}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("button",{onClick:()=>{m(te),d(!0)},className:"px-4 py-2 rounded-lg text-sm font-bold transition-colors bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-base mr-1 align-middle",children:"edit"}),"Update"]})})]},te.volume_id))})]})})]})}),n&&c&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-surface-highlight border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsx("h3",{className:"text-white text-xl font-bold mb-2",children:"Delete Storage Volume"}),e.jsxs("p",{className:"text-text-secondary text-sm mb-4",children:["Are you sure you want to delete volume ",e.jsx("span",{className:"text-white font-bold",children:c.volume_name}),"?"]}),c.vol_bytes>0&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3 mb-4",children:e.jsxs("p",{className:"text-red-400 text-sm",children:["⚠️ This volume contains ",F(c.vol_bytes)," of data. Volumes with data cannot be deleted."]})}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:()=>{o(!1),u(null)},className:"px-4 py-2 rounded-lg bg-surface-dark border border-border-dark text-white text-sm font-bold hover:bg-[#2a3c50] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{c.vol_bytes===0&&Z.mutate(c.volume_id)},disabled:c.vol_bytes>0||Z.isPending,className:"px-4 py-2 rounded-lg bg-red-500 text-white text-sm font-bold hover:bg-red-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:Z.isPending?"Deleting...":"Delete Volume"})]})]})}),l&&h&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-surface-highlight border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsx("h3",{className:"text-white text-xl font-bold mb-2",children:"Update Storage Volume"}),e.jsxs("p",{className:"text-text-secondary text-sm mb-4",children:["Update meta-data for volume ",e.jsx("span",{className:"text-white font-bold",children:h.volume_name})]}),e.jsx(XS,{volume:h,onSubmit:te=>{ne.mutate({volumeId:h.volume_id,data:te})},isLoading:ne.isPending,onCancel:()=>{d(!1),m(null)}})]})})]})}function WS({pools:r,onSubmit:t,isLoading:s,onCancel:n}){const[o,l]=Ce.useState({volume_name:"",pool_name:"",media_type:"File",max_vol_bytes:"",vol_retention:""}),d=c=>{c.preventDefault(),t({volume_name:o.volume_name,pool_name:o.pool_name,media_type:o.media_type,max_vol_bytes:o.max_vol_bytes?parseInt(o.max_vol_bytes)*1024*1024*1024:void 0,vol_retention:o.vol_retention?parseInt(o.vol_retention):void 0})};return e.jsxs("form",{onSubmit:d,className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:["Volume Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{type:"text",required:!0,value:o.volume_name,onChange:c=>l({...o,volume_name:c.target.value}),placeholder:"e.g., Vol-001, MyBackup-001",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Unique name for the storage volume"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:["Pool ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs("select",{required:!0,value:o.pool_name,onChange:c=>l({...o,pool_name:c.target.value}),className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"",children:"Select a pool"}),r.map(c=>e.jsx("option",{value:c.name,children:c.name},c.pool_id))]}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Pool where this volume will be stored"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Media Type"}),e.jsxs("select",{value:o.media_type,onChange:c=>l({...o,media_type:c.target.value}),className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"File",children:"File (Disk)"}),e.jsx("option",{value:"Tape",children:"Tape"})]}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Type of storage media"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Maximum Volume Size (GB)"}),e.jsx("input",{type:"number",value:o.max_vol_bytes,onChange:c=>l({...o,max_vol_bytes:c.target.value}),placeholder:"e.g., 100",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Maximum size in GB (optional, for disk volumes)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Retention Period (Days)"}),e.jsx("input",{type:"number",value:o.vol_retention,onChange:c=>l({...o,vol_retention:c.target.value}),placeholder:"e.g., 30",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Number of days to retain the volume (optional)"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 rounded-lg bg-surface-dark border border-border-dark text-white text-sm font-bold hover:bg-[#2a3c50] transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:s||!o.volume_name||!o.pool_name,className:"px-4 py-2 rounded-lg bg-primary text-white text-sm font-bold hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s?"Creating...":"Create Volume"})]})]})}function XS({volume:r,onSubmit:t,isLoading:s,onCancel:n}){const[o,l]=Ce.useState({max_vol_bytes:r.max_vol_bytes>0?(r.max_vol_bytes/1073741824).toString():"",vol_retention:""}),d=c=>{c.preventDefault(),t({max_vol_bytes:o.max_vol_bytes?parseInt(o.max_vol_bytes)*1024*1024*1024:void 0,vol_retention:o.vol_retention?parseInt(o.vol_retention):void 0})};return e.jsxs("form",{onSubmit:d,className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Maximum Volume Size (GB)"}),e.jsx("input",{type:"number",value:o.max_vol_bytes,onChange:c=>l({...o,max_vol_bytes:c.target.value}),placeholder:"e.g., 100",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsxs("p",{className:"text-text-secondary text-xs mt-1",children:["Current: ",r.max_vol_bytes>0?`${(r.max_vol_bytes/(1024*1024*1024)).toFixed(2)} GB`:"Not set"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-text-secondary text-sm font-medium mb-2",children:"Retention Period (Days)"}),e.jsx("input",{type:"number",value:o.vol_retention,onChange:c=>l({...o,vol_retention:c.target.value}),placeholder:"e.g., 30",className:"w-full bg-surface-dark border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Number of days to retain the volume"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4 border-t border-border-dark",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 rounded-lg bg-surface-dark border border-border-dark text-white text-sm font-bold hover:bg-[#2a3c50] transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:s||!o.max_vol_bytes&&!o.vol_retention,className:"px-4 py-2 rounded-lg bg-primary text-white text-sm font-bold hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s?"Updating...":"Update Volume"})]})]})}const Fv={listClients:async()=>(await ze.get("/bacula/clients")).data,getClient:async r=>(await ze.get(`/bacula/clients/${r}`)).data,registerClient:async r=>(await ze.post("/bacula/clients/register",r)).data,updateCapabilities:async(r,t)=>(await ze.post(`/bacula/clients/${r}/capabilities`,t)).data,getPendingUpdate:async r=>{const t=await ze.get(`/bacula/clients/${r}/pending-update`);return t.status===204?null:t.data},ping:async(r,t)=>{await ze.post(`/bacula/clients/${r}/ping`,{status:t})}},YS=[{label:"Files",value:"files"},{label:"Database",value:"database"},{label:"Application",value:"application"},{label:"Exchange",value:"exchange"},{label:"Mail",value:"mail"}];function Ev(r){return r?new Date(r).toLocaleString():"Never"}function JS(){const r=Nr(),{data:t,isLoading:s,error:n}=dt({queryKey:["bacula-clients"],queryFn:()=>Fv.listClients()}),[o,l]=Ce.useState(null),[d,c]=Ce.useState([]),[u,h]=Ce.useState(""),[m,x]=Ce.useState(""),y=ft({mutationFn:({id:B,backupTypes:g,notes:j})=>Fv.updateCapabilities(B,{backup_types:g,notes:j}),onSuccess:()=>{r.invalidateQueries({queryKey:["bacula-clients"]}),x("Capability update requested. The agent will pull changes shortly.")},onError:()=>{x("Failed to request capability update. Please try again.")}}),p=t?.find(B=>B.id===o)??null;Ce.useEffect(()=>{if(!p){c([]),h("");return}c(p.pending_backup_types?.length?p.pending_backup_types:p.backup_types),h(p.pending_notes??"")},[p]);const v=B=>{c(g=>g.includes(B)?g.filter(j=>j!==B):[...g,B])},N=B=>{B.preventDefault(),p&&y.mutate({id:p.id,backupTypes:d,notes:u})};return s?e.jsx("p",{className:"text-white",children:"Loading Bacula clients..."}):n?e.jsx("p",{className:"text-red-400",children:"Failed to load Bacula clients."}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Bacula Client Management"}),e.jsx("p",{className:"text-sm text-text-secondary",children:"Register agents, monitor their capabilities, and push updates."})]}),e.jsxs("section",{className:"bg-card-dark border border-border-dark rounded-xl p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-text-secondary",children:"Edit capabilities"}),e.jsx("p",{className:"text-lg font-bold text-white",children:p?p.hostname:"Select a client from the list"})]}),m&&e.jsx("p",{className:"text-xs text-primary",children:m})]}),e.jsxs("form",{className:"space-y-4",onSubmit:N,children:[e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"text-sm font-semibold text-white",children:"Backup types"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:YS.map(B=>e.jsxs("label",{className:"flex items-center gap-2 rounded-lg border border-border-dark px-3 py-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:d.includes(B.value),onChange:()=>v(B.value),className:"h-4 w-4 rounded border-border-dark text-primary focus:ring-primary",disabled:!p}),e.jsx("span",{className:"text-white",children:B.label})]},B.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",htmlFor:"notes",children:"Notes for agent"}),e.jsx("textarea",{id:"notes",rows:3,value:u,onChange:B=>h(B.target.value),className:"w-full rounded-lg border border-border-dark bg-[#111a22] px-3 py-2 text-sm text-white placeholder:text-text-secondary focus:border-primary focus:outline-none",placeholder:"Optional context for the capability update",disabled:!p})]}),e.jsx("button",{type:"submit",className:"inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-black",disabled:!p||d.length===0||y.isPending,children:y.isPending?"Requesting...":"Push capabilities"})]})]}),e.jsx("section",{className:"space-y-4",children:t?.map(B=>e.jsxs("article",{className:"rounded-xl border border-border-dark bg-card-dark p-5 text-sm text-white",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold text-white",children:B.hostname}),e.jsx("p",{className:"text-xs text-text-secondary",children:B.agent_version||"Unknown version"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs uppercase tracking-wide text-text-secondary",children:"Status"}),e.jsx("span",{className:"text-sm font-semibold text-primary",children:B.status})]}),e.jsx("button",{className:"rounded-lg border border-border-dark px-3 py-1 text-xs font-semibold text-white",onClick:()=>l(B.id),children:"Edit capabilities"})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-xs",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-text-secondary",children:"Backup types"}),e.jsx("p",{className:"text-sm text-white",children:B.backup_types.join(", ")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-text-secondary",children:"Pending push"}),e.jsx("p",{className:"text-sm text-white",children:B.pending_backup_types?.length?B.pending_backup_types.join(", "):"None"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-text-secondary",children:"Last seen"}),e.jsx("p",{className:"text-sm text-white",children:Ev(B.last_seen)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-text-secondary",children:"Registered by"}),e.jsx("p",{className:"text-sm text-white",children:B.registered_by})]})]}),e.jsxs("div",{className:"mt-4 space-y-2 text-xs",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-text-secondary",children:"Capability history"}),e.jsxs("ul",{className:"space-y-1",children:[B.capability_history?.slice(0,3).map(g=>e.jsxs("li",{className:"flex justify-between text-white",children:[e.jsxs("span",{children:[g.source.toUpperCase()," • ",g.backup_types.join(", ")]}),e.jsx("span",{className:"text-text-secondary",children:Ev(g.requested_at)})]},`${B.id}-${g.requested_at}`)),!B.capability_history?.length&&e.jsx("li",{className:"text-text-secondary",children:"No history yet."})]})]})]},B.id))})]})}function ZS(){const[r,t]=Ce.useState([]),[s,n]=Ce.useState(""),[o,l]=Ce.useState(!1),[d,c]=Ce.useState("system"),u=Ce.useRef(null),h=Ce.useRef(null);Ce.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[r]),Ce.useEffect(()=>{h.current&&h.current.focus()},[]);const m=ft({mutationFn:async N=>(await ze.post("/system/execute",{command:N,service:d})).data,onSuccess:(N,B)=>{t(g=>[...g,{command:B,output:N.output||N.error||"Command executed",timestamp:new Date,error:!!N.error,service:d}]),n(""),l(!1),setTimeout(()=>{h.current&&h.current.focus()},100)},onError:N=>{t(B=>[...B,{command:s,output:N?.response?.data?.error||N?.response?.data?.output||N.message||"Error executing command",timestamp:new Date,error:!0,service:d}]),n(""),l(!1),setTimeout(()=>{h.current&&h.current.focus()},100)}}),x=N=>{N.preventDefault();const B=s.trim();!B||o||(l(!0),m.mutate(B))},y=N=>{N.ctrlKey&&N.key==="l"&&(N.preventDefault(),confirm("Clear terminal history?")&&t([])),N.key==="ArrowUp"&&N.preventDefault()},p=()=>{confirm("Clear terminal history?")&&t([])},v=N=>({system:["ls -la","df -h","free -h","systemctl status scst","scstadmin -list_target","scstadmin -list_device","ip addr show","journalctl -u calypso-api -n 50","ps aux | grep calypso","netstat -tulpn | grep 8080"],scst:["scstadmin -list_target","scstadmin -list_device","scstadmin -list_handler","scstadmin -list_driver","scstadmin -list_group","scstadmin -list","cat /etc/scst.conf","systemctl status scst","systemctl status iscsi-scst"],storage:["zfs list","zpool status","zpool list","lsblk","df -h","zfs get all","zpool get all"],backup:['bconsole -c "list jobs"','bconsole -c "list clients"','bconsole -c "list pools"',"systemctl status bacula-director","systemctl status bacula-sd","systemctl status bacula-fd"],tape:["lsscsi -g","mtx -f /dev/sgX status","sg_inq /dev/sgX","systemctl status mhvtl"]})[N]||[];return e.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto flex flex-col gap-6 h-full",children:[e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("h1",{className:"text-white text-3xl font-extrabold leading-tight tracking-tight flex items-center gap-3",children:[e.jsx(Uh,{className:"text-primary",size:32}),"Terminal Console"]}),e.jsx("p",{className:"text-text-secondary text-base font-normal",children:"Execute shell commands and manage all appliance services"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(ct,{variant:"outline",onClick:p,className:"flex items-center gap-2",children:[e.jsx(es,{size:16}),e.jsx("span",{children:"Clear"})]})})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card-dark border border-border-dark rounded-lg",children:[e.jsx("span",{className:"text-text-secondary text-sm font-medium",children:"Service:"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:["system","scst","storage","backup","tape"].map(N=>e.jsx("button",{onClick:()=>c(N),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${d===N?"bg-primary text-white":"bg-[#0f161d] text-text-secondary hover:text-white hover:bg-white/5"}`,children:N.charAt(0).toUpperCase()+N.slice(1)},N))})]}),e.jsxs("div",{className:"flex-1 flex flex-col bg-[#0a0f14] border border-border-dark rounded-lg overflow-hidden min-h-[600px]",children:[e.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 custom-scrollbar",style:{minHeight:"400px"},children:[r.length===0?e.jsxs("div",{className:"text-text-secondary",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(Uh,{className:"text-primary",size:20}),e.jsx("span",{className:"text-white font-semibold",children:"Terminal Console"}),e.jsx("span",{className:"text-xs px-2 py-0.5 bg-primary/20 text-primary rounded",children:d})]}),e.jsx("div",{className:"mb-2",children:"Type commands below to execute shell commands"}),e.jsxs("div",{className:"text-xs opacity-70 mt-4",children:[e.jsxs("div",{className:"font-semibold mb-2",children:["Common commands for ",d,":"]}),e.jsx("div",{className:"ml-4 space-y-1",children:v(d).map((N,B)=>e.jsxs("div",{children:["• ",e.jsx("span",{className:"text-primary font-mono",children:N})]},B))})]})]}):r.map((N,B)=>e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"text-primary mb-2 font-mono text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-text-secondary",children:"$"}),e.jsx("span",{className:"text-white",children:N.command}),N.service&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-primary/20 text-primary rounded",children:N.service}),e.jsx("span",{className:"text-text-secondary text-xs ml-auto",children:new Date(N.timestamp).toLocaleTimeString()})]}),e.jsx("div",{className:`font-mono text-xs leading-relaxed whitespace-pre overflow-x-auto ${N.error?"text-red-400":"text-green-400"}`,style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',lineHeight:"1.6",tabSize:2},children:N.output})]},B)),o&&e.jsxs("div",{className:"text-text-secondary flex items-center gap-2",children:[e.jsx(Cn,{size:16,className:"animate-spin"}),e.jsx("span",{children:"Executing command..."})]})]}),e.jsx("div",{className:"flex-none border-t border-border-dark bg-[#161f29]",children:e.jsxs("form",{onSubmit:x,className:"flex items-center",children:[e.jsxs("div",{className:"px-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-primary font-mono text-sm",children:"$"}),e.jsx("span",{className:"text-xs text-text-secondary px-1.5 py-0.5 bg-primary/20 text-primary rounded",children:d})]}),e.jsx("input",{ref:h,type:"text",value:s,onChange:N=>n(N.target.value),onKeyDown:y,disabled:o,placeholder:`Enter ${d} command...`,className:"flex-1 bg-transparent text-white font-mono text-sm py-3 focus:outline-none disabled:opacity-50"}),e.jsx("button",{type:"submit",disabled:!s.trim()||o,className:"px-4 py-3 text-primary hover:text-white disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:e.jsx(C6,{size:16,className:o?"animate-spin":""})})]})})]}),e.jsxs("div",{className:"flex-none px-6 py-3 border-t border-border-dark bg-[#141d26] flex items-center justify-between text-xs text-text-secondary",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{children:"Terminal Console - Command Execution"}),e.jsxs("span",{children:["• ",r.length," commands executed"]})]}),e.jsxs("div",{children:["Press ",e.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#0a0f14] border border-border-dark rounded text-xs",children:"Ctrl+L"})," to clear"]})]})]})})}const rg={listShares:async()=>(await ze.get("/shares")).data.shares||[],getShare:async r=>(await ze.get(`/shares/${r}`)).data,createShare:async r=>(await ze.post("/shares",r)).data,updateShare:async(r,t)=>(await ze.put(`/shares/${r}`,t)).data,deleteShare:async r=>{await ze.delete(`/shares/${r}`)}};function $S(){const r=Nr(),[t,s]=Ce.useState(null),[n,o]=Ce.useState(""),[l,d]=Ce.useState(!1),[c,u]=Ce.useState("configuration"),[h,m]=Ce.useState(!1),[x,y]=Ce.useState({dataset_id:"",nfs_enabled:!1,nfs_options:"rw,sync,no_subtree_check",nfs_clients:[],smb_enabled:!1,smb_share_name:"",smb_comment:"",smb_guest_ok:!1,smb_read_only:!1,smb_browseable:!0}),[p,v]=Ce.useState(""),{data:N=[],isLoading:B}=dt({queryKey:["shares"],queryFn:rg.listShares,refetchInterval:5e3,staleTime:0}),{data:g=[]}=dt({queryKey:["storage","zfs","pools"],queryFn:sn.listPools}),[j,_]=Ce.useState([]);Ce.useEffect(()=>{const U=async()=>{const q=[];for(const F of g)try{const ae=(await sn.listDatasets(F.id)).filter(se=>se.type==="filesystem");q.push(...ae)}catch(le){console.error(`Failed to fetch datasets for pool ${F.id}:`,le)}_(q)};g.length>0&&U()},[g]);const w=ft({mutationFn:rg.createShare,onSuccess:()=>{r.invalidateQueries({queryKey:["shares"]}),d(!1),y({dataset_id:"",nfs_enabled:!1,nfs_options:"rw,sync,no_subtree_check",nfs_clients:[],smb_enabled:!1,smb_share_name:"",smb_comment:"",smb_guest_ok:!1,smb_read_only:!1,smb_browseable:!0}),alert("Share created successfully!")},onError:U=>{const q=U?.response?.data?.error||U?.message||"Failed to create share";alert(`Error: ${q}`),console.error("Failed to create share:",U)}}),L=ft({mutationFn:({id:U,data:q})=>rg.updateShare(U,q),onSuccess:()=>{r.invalidateQueries({queryKey:["shares"]})}}),K=N.filter(U=>U.dataset_name.toLowerCase().includes(n.toLowerCase())||U.mount_point.toLowerCase().includes(n.toLowerCase())),M=U=>{if(U?.preventDefault(),U?.stopPropagation(),console.log("Creating share with data:",x),!x.dataset_id){alert("Please select a dataset");return}if(!x.nfs_enabled&&!x.smb_enabled){alert("At least one protocol (NFS or SMB) must be enabled");return}const q={dataset_id:x.dataset_id,nfs_enabled:x.nfs_enabled,smb_enabled:x.smb_enabled};x.nfs_enabled&&(q.nfs_options=x.nfs_options||"rw,sync,no_subtree_check",q.nfs_clients=x.nfs_clients||[]),x.smb_enabled&&(q.smb_share_name=x.smb_share_name||"",q.smb_comment=x.smb_comment||"",q.smb_guest_ok=x.smb_guest_ok||!1,q.smb_read_only=x.smb_read_only||!1,q.smb_browseable=x.smb_browseable!==void 0?x.smb_browseable:!0),console.log("Submitting share data:",q),w.mutate(q)},V=U=>{L.mutate({id:U.id,data:{nfs_enabled:!U.nfs_enabled}})},T=U=>{L.mutate({id:U.id,data:{smb_enabled:!U.smb_enabled}})},ne=U=>{if(!p.trim())return;const q=[...U.nfs_clients||[],p.trim()];L.mutate({id:U.id,data:{nfs_clients:q}}),v("")},Z=(U,q)=>{const F=(U.nfs_clients||[]).filter(le=>le!==q);L.mutate({id:U.id,data:{nfs_clients:F}})};return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col bg-background-dark",children:[e.jsx("div",{className:"flex-shrink-0 border-b border-border-dark bg-background-dark/95 backdrop-blur z-10",children:e.jsxs("div",{className:"flex flex-col gap-4 p-6 pb-4",children:[e.jsxs("div",{className:"flex flex-wrap justify-between gap-3 items-center",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-white text-3xl font-black leading-tight tracking-[-0.033em]",children:"Shares Management"}),e.jsxs("div",{className:"flex items-center gap-2 text-text-secondary text-sm",children:[e.jsx("span",{children:"Storage"}),e.jsx(Ka,{size:14}),e.jsx("span",{children:"Shares"}),e.jsx(Ka,{size:14}),e.jsx("span",{className:"text-white",children:"Overview"})]})]}),e.jsxs(ct,{onClick:()=>d(!0),className:"flex items-center gap-2 px-4 h-10 rounded-lg bg-primary hover:bg-blue-600 text-white text-sm font-bold",children:[e.jsx(Ks,{size:20}),e.jsx("span",{children:"Create New Share"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-lg p-4 border border-border-dark bg-surface-dark/50",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-xs font-bold uppercase tracking-wider",children:"SMB Service"}),e.jsx("div",{className:"size-2 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"})]}),e.jsx("p",{className:"text-white text-xl font-bold leading-tight",children:"Running"}),e.jsx("p",{className:"text-emerald-500 text-xs mt-1",children:"Port 445 Active"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-lg p-4 border border-border-dark bg-surface-dark/50",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-xs font-bold uppercase tracking-wider",children:"NFS Service"}),e.jsx("div",{className:"size-2 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"})]}),e.jsx("p",{className:"text-white text-xl font-bold leading-tight",children:"Running"}),e.jsx("p",{className:"text-emerald-500 text-xs mt-1",children:"Port 2049 Active"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-lg p-4 border border-border-dark bg-surface-dark/50",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-xs font-bold uppercase tracking-wider",children:"Throughput"}),e.jsx(S6,{className:"text-text-secondary",size:20})]}),e.jsx("p",{className:"text-white text-xl font-bold leading-tight",children:"565 MB/s"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"14 Clients Connected"})]})]})]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-full lg:w-[400px] flex flex-col border-r border-border-dark bg-background-dark flex-shrink-0",children:[e.jsx("div",{className:"p-4 border-b border-border-dark bg-background-dark sticky top-0 z-10",children:e.jsxs("div",{className:"relative",children:[e.jsx(io,{className:"absolute left-3 top-2.5 text-text-secondary",size:18}),e.jsx("input",{className:"w-full bg-surface-dark border border-border-dark rounded-lg pl-10 pr-4 py-2.5 text-sm text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary placeholder-text-secondary",placeholder:"Filter shares...",value:n,onChange:U=>o(U.target.value)})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:B?e.jsx("div",{className:"p-4 text-center text-text-secondary text-sm",children:"Loading shares..."}):K.length===0?e.jsx("div",{className:"p-4 text-center text-text-secondary text-sm",children:"No shares found"}):K.map(U=>e.jsx("div",{onClick:()=>s(U),className:`group flex flex-col border-b border-border-dark/50 cursor-pointer transition-colors ${t?.id===U.id?"bg-primary/10 border-l-4 border-l-primary":"hover:bg-surface-dark"}`,children:e.jsxs("div",{className:`px-4 py-3 flex items-start gap-3 ${t?.id===U.id?"pl-3":""}`,children:[t?.id===U.id?e.jsx(Tb,{className:"text-primary mt-1",size:20}):e.jsx(au,{className:"text-text-secondary mt-1",size:20}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex justify-between items-center mb-1",children:e.jsx("h3",{className:`text-sm truncate ${t?.id===U.id?"font-bold text-white":"font-medium text-white"}`,children:U.dataset_name})}),e.jsx("p",{className:`text-xs truncate mb-2 ${t?.id===U.id?"text-primary/80":"text-text-secondary"}`,children:U.mount_point||"No mount point"}),e.jsxs("div",{className:"flex gap-2",children:[U.smb_enabled?e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold border ${t?.id===U.id?"bg-surface-dark text-text-secondary border-border-dark":"bg-emerald-500/10 text-emerald-500 border-emerald-500/20"}`,children:"SMB"}):null,U.nfs_enabled&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-bold bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:"NFS"})]})]}),t?.id!==U.id&&e.jsx(Ka,{className:"text-text-secondary text-[18px]",size:18})]})},U.id))}),e.jsx("div",{className:"p-4 border-t border-border-dark bg-background-dark text-center",children:e.jsxs("p",{className:"text-xs text-text-secondary",children:["Showing ",K.length," of ",N.length," shares"]})})]}),e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden bg-background-light dark:bg-[#0d141c]",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-6 pb-0 flex flex-col gap-6",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"bg-primary p-2 rounded-lg text-white",children:e.jsx(Tb,{size:20})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:t.dataset_name.split("/").pop()||t.dataset_name}),e.jsx("p",{className:"text-text-secondary text-sm font-mono",children:t.dataset_name})]})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ct,{variant:"outline",className:"flex items-center justify-center rounded-lg h-9 px-4 border border-border-dark text-white text-sm font-medium hover:bg-surface-dark transition-colors",children:[e.jsx(hp,{size:18,className:"mr-2"}),"Revert"]}),e.jsxs(ct,{className:"flex items-center justify-center rounded-lg h-9 px-4 bg-primary text-white text-sm font-bold shadow-lg shadow-primary/20 hover:bg-blue-600 transition-colors",children:[e.jsx(up,{size:18,className:"mr-2"}),"Save Changes"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-xl border ${t.smb_enabled?"border-primary/50 bg-primary/5":"border-border-dark bg-surface-dark/40"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${t.smb_enabled?"bg-primary/20 text-primary":"bg-surface-dark text-text-secondary"}`,children:e.jsx(Ib,{size:20})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-bold text-white",children:"SMB Protocol"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Windows File Sharing"})]})]}),e.jsxs("button",{onClick:()=>T(t),className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background-dark ${t.smb_enabled?"bg-primary":"bg-slate-700"}`,children:[e.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${t.smb_enabled?"translate-x-5":"translate-x-0"}`})]})]}),e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-xl border ${t.nfs_enabled?"border-primary/50 bg-primary/5":"border-border-dark bg-surface-dark/40"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${t.nfs_enabled?"bg-primary/20 text-primary":"bg-surface-dark text-text-secondary"}`,children:e.jsx(_6,{size:20})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-bold text-white",children:"NFS Protocol"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Unix/Linux File Sharing"})]})]}),e.jsxs("button",{onClick:()=>V(t),className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background-dark ${t.nfs_enabled?"bg-primary":"bg-slate-700"}`,children:[e.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${t.nfs_enabled?"translate-x-5":"translate-x-0"}`})]})]})]}),e.jsx("div",{className:"border-b border-border-dark mt-2",children:e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("button",{onClick:()=>u("configuration"),className:`pb-3 border-b-2 text-sm flex items-center gap-2 transition-colors ${c==="configuration"?"border-primary text-primary font-bold":"border-transparent text-text-secondary hover:text-white font-medium"}`,children:[e.jsx(vc,{size:18}),"Configuration"]}),e.jsxs("button",{onClick:()=>u("permissions"),className:`pb-3 border-b-2 text-sm flex items-center gap-2 transition-colors ${c==="permissions"?"border-primary text-primary font-bold":"border-transparent text-text-secondary hover:text-white font-medium"}`,children:[e.jsx(Xm,{size:18}),"Permissions (ACL)"]}),e.jsxs("button",{onClick:()=>u("clients"),className:`pb-3 border-b-2 text-sm flex items-center gap-2 transition-colors ${c==="clients"?"border-primary text-primary font-bold":"border-transparent text-text-secondary hover:text-white font-medium"}`,children:[e.jsx(ya,{size:18}),"Connected Clients",e.jsx("span",{className:"bg-surface-dark text-white text-[10px] px-1.5 py-0.5 rounded-full ml-1",children:"8"})]})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"max-w-4xl flex flex-col gap-6",children:[c==="configuration"&&e.jsxs(e.Fragment,{children:[t.nfs_enabled&&e.jsxs("div",{className:"rounded-xl border border-border-dark bg-surface-dark overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-border-dark flex justify-between items-center bg-[#1c2a39]",children:[e.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(ya,{className:"text-primary",size:20}),"NFS Configuration"]}),e.jsx("span",{className:"text-xs text-emerald-500 font-medium px-2 py-1 bg-emerald-500/10 rounded border border-emerald-500/20",children:"Active"})]}),e.jsxs("div",{className:"p-5 flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Allowed Subnets / IPs"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary font-mono",type:"text",placeholder:"192.168.10.0/24",value:p,onChange:U=>v(U.target.value),onKeyPress:U=>{U.key==="Enter"&&ne(t)}}),e.jsx("button",{onClick:()=>ne(t),className:"p-2 bg-surface-dark hover:bg-border-dark border border-border-dark rounded-lg text-white",children:e.jsx(Ks,{size:18})})]}),e.jsx("p",{className:"text-xs text-text-secondary",children:"CIDR notation supported. Use comma for multiple entries."}),t.nfs_clients&&t.nfs_clients.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.nfs_clients.map(U=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary/20 text-primary text-xs rounded border border-primary/30",children:[U,e.jsx("button",{onClick:()=>Z(t,U),className:"hover:text-red-400",children:e.jsx(Zs,{size:14})})]},U))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Map Root User"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary appearance-none",children:[e.jsx("option",{children:"root (User ID 0)"}),e.jsx("option",{children:"admin"}),e.jsx("option",{children:"nobody"})]}),e.jsx(wh,{className:"absolute right-3 top-2.5 text-text-secondary pointer-events-none",size:18})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Security Profile"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("label",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border-dark bg-background-dark cursor-pointer flex-1",children:[e.jsx("input",{checked:!0,className:"text-primary focus:ring-primary bg-surface-dark border-border-dark",name:"sec",type:"radio"}),e.jsx("span",{className:"text-sm text-white",children:"sys (Default)"})]}),e.jsxs("label",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border-dark bg-background-dark cursor-pointer flex-1",children:[e.jsx("input",{className:"text-primary focus:ring-primary bg-surface-dark border-border-dark",name:"sec",type:"radio"}),e.jsx("span",{className:"text-sm text-white",children:"krb5"})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Sync Mode"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary appearance-none",children:[e.jsx("option",{children:"Standard"}),e.jsx("option",{children:"Always Sync"}),e.jsx("option",{children:"Disabled (Async)"})]}),e.jsx(wh,{className:"absolute right-3 top-2.5 text-text-secondary pointer-events-none",size:18})]})]})]})]})]}),t.smb_enabled&&e.jsxs("div",{className:"rounded-xl border border-border-dark bg-surface-dark overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-border-dark flex justify-between items-center bg-[#1c2a39]",children:[e.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(Ib,{className:"text-primary",size:20}),"SMB Configuration"]}),e.jsx("span",{className:"text-xs text-emerald-500 font-medium px-2 py-1 bg-emerald-500/10 rounded border border-emerald-500/20",children:"Active"})]}),e.jsxs("div",{className:"p-5 flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Share Name"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary",type:"text",value:t.smb_share_name||"",onChange:U=>{L.mutate({id:t.id,data:{smb_share_name:U.target.value}})}})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Path"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary font-mono",type:"text",value:t.smb_path||t.mount_point||"",readOnly:!0})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-text-secondary uppercase",children:"Comment"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary",type:"text",value:t.smb_comment||"",onChange:U=>{L.mutate({id:t.id,data:{smb_comment:U.target.value}})}})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.smb_guest_ok,onChange:U=>{L.mutate({id:t.id,data:{smb_guest_ok:U.target.checked}})},className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Allow Guest Access"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.smb_read_only,onChange:U=>{L.mutate({id:t.id,data:{smb_read_only:U.target.checked}})},className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Read Only"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.smb_browseable,onChange:U=>{L.mutate({id:t.id,data:{smb_browseable:U.target.checked}})},className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Browseable"})]})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-surface-dark overflow-hidden",children:[e.jsxs("button",{onClick:()=>m(!h),className:"w-full px-5 py-4 flex justify-between items-center hover:bg-[#1c2a39] transition-colors text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(vc,{className:"text-text-secondary",size:20}),"Advanced Attributes"]}),e.jsx(wh,{className:`text-text-secondary transition-transform ${h?"rotate-180":""}`,size:20})]}),h&&e.jsxs("div",{className:"p-5 border-t border-border-dark flex flex-wrap gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Read Only"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{checked:!0,type:"checkbox",className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Enable Compression (LZ4)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"rounded border-border-dark bg-background-dark text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Enable Deduplication"})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsx("h3",{className:"text-base font-bold text-white",children:"Top Active Clients"}),e.jsx("a",{className:"text-sm text-primary hover:text-blue-400 font-medium cursor-pointer",href:"#",children:"View all clients"})]}),e.jsx("div",{className:"rounded-lg border border-border-dark overflow-hidden bg-surface-dark",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-background-dark text-text-secondary font-medium border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"IP Address"}),e.jsx("th",{className:"px-4 py-3",children:"User"}),e.jsx("th",{className:"px-4 py-3",children:"Protocol"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Throughput"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Action"})]})}),e.jsxs("tbody",{className:"text-white divide-y divide-border-dark",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-4 py-3 font-mono",children:"192.168.10.105"}),e.jsx("td",{className:"px-4 py-3",children:"esxi-host-01"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs font-bold",children:"NFS"})}),e.jsx("td",{className:"px-4 py-3 text-right font-mono text-text-secondary",children:"420 MB/s"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{className:"text-text-secondary hover:text-red-400",title:"Disconnect",children:e.jsx(zf,{size:18})})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-4 py-3 font-mono",children:"192.168.10.106"}),e.jsx("td",{className:"px-4 py-3",children:"esxi-host-02"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs font-bold",children:"NFS"})}),e.jsx("td",{className:"px-4 py-3 text-right font-mono text-text-secondary",children:"105 MB/s"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{className:"text-text-secondary hover:text-red-400",title:"Disconnect",children:e.jsx(zf,{size:18})})})]})]})]})})]})]}),c==="permissions"&&e.jsxs("div",{className:"rounded-xl border border-border-dark bg-surface-dark p-8 text-center",children:[e.jsx(Xm,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Permissions (ACL) configuration coming soon"})]}),c==="clients"&&e.jsxs("div",{className:"rounded-xl border border-border-dark bg-surface-dark overflow-hidden",children:[e.jsx("div",{className:"px-5 py-4 border-b border-border-dark flex justify-between items-center bg-[#1c2a39]",children:e.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(ya,{className:"text-primary",size:20}),"Connected Clients"]})}),e.jsx("div",{className:"p-5",children:e.jsx("div",{className:"rounded-lg border border-border-dark overflow-hidden bg-surface-dark",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-background-dark text-text-secondary font-medium border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"IP Address"}),e.jsx("th",{className:"px-4 py-3",children:"User"}),e.jsx("th",{className:"px-4 py-3",children:"Protocol"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Throughput"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Action"})]})}),e.jsxs("tbody",{className:"text-white divide-y divide-border-dark",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-4 py-3 font-mono",children:"192.168.10.105"}),e.jsx("td",{className:"px-4 py-3",children:"esxi-host-01"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs font-bold",children:"NFS"})}),e.jsx("td",{className:"px-4 py-3 text-right font-mono text-text-secondary",children:"420 MB/s"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{className:"text-text-secondary hover:text-red-400",title:"Disconnect",children:e.jsx(zf,{size:18})})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-4 py-3 font-mono",children:"192.168.10.106"}),e.jsx("td",{className:"px-4 py-3",children:"esxi-host-02"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs font-bold",children:"NFS"})}),e.jsx("td",{className:"px-4 py-3 text-right font-mono text-text-secondary",children:"105 MB/s"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{className:"text-text-secondary hover:text-red-400",title:"Disconnect",children:e.jsx(zf,{size:18})})})]})]})]})})})]})]})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-text-secondary",children:e.jsxs("div",{className:"text-center",children:[e.jsx(au,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-sm",children:"Select a share to view details"})]})})})]}),l&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>d(!1),children:e.jsxs("div",{className:"bg-surface-dark rounded-xl border border-border-dark max-w-2xl w-full max-h-[90vh] overflow-y-auto",onClick:U=>U.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-border-dark flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Create New Share"}),e.jsx("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Dataset"}),e.jsxs("select",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary",value:x.dataset_id,onChange:U=>y({...x,dataset_id:U.target.value}),children:[e.jsx("option",{value:"",children:"Select a dataset"}),j.map(U=>e.jsxs("option",{value:U.id,children:[U.name," ",U.mount_point&&U.mount_point!=="none"?`(${U.mount_point})`:""]},U.id))]})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border-dark bg-surface-dark/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ya,{className:"text-text-secondary",size:20}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-sm font-bold text-white",children:"Enable NFS"})})]}),e.jsx("input",{type:"checkbox",checked:x.nfs_enabled,onChange:U=>y({...x,nfs_enabled:U.target.checked}),className:"h-4 w-4 rounded border-border-dark bg-background-dark text-primary focus:ring-primary"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border-dark bg-surface-dark/40",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k6,{className:"text-text-secondary",size:20}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-sm font-bold text-white",children:"Enable SMB"})})]}),e.jsx("input",{type:"checkbox",checked:x.smb_enabled,onChange:U=>y({...x,smb_enabled:U.target.checked}),className:"h-4 w-4 rounded border-border-dark bg-background-dark text-primary focus:ring-primary"})]})]}),x.nfs_enabled&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"NFS Options"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary font-mono",type:"text",value:x.nfs_options,onChange:U=>y({...x,nfs_options:U.target.value})})]}),x.smb_enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"SMB Share Name"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary",type:"text",value:x.smb_share_name,onChange:U=>y({...x,smb_share_name:U.target.value})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Comment"}),e.jsx("input",{className:"w-full bg-background-dark border border-border-dark rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary",type:"text",value:x.smb_comment,onChange:U=>y({...x,smb_comment:U.target.value})})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(ct,{onClick:()=>d(!1),variant:"outline",className:"px-4 h-10",children:"Cancel"}),e.jsx(ct,{type:"button",onClick:M,disabled:w.isPending,className:"px-4 h-10 bg-primary hover:bg-blue-600",children:w.isPending?"Creating...":"Create Share"})]})]})]})})]})}const Zr={listUsers:async()=>(await ze.get("/iam/users")).data.users||[],getUser:async r=>(await ze.get(`/iam/users/${r}`)).data,createUser:async r=>(await ze.post("/iam/users",r)).data,updateUser:async(r,t)=>{await ze.put(`/iam/users/${r}`,t)},deleteUser:async r=>{await ze.delete(`/iam/users/${r}`)},listGroups:async()=>(await ze.get("/iam/groups")).data.groups||[],getGroup:async r=>(await ze.get(`/iam/groups/${r}`)).data,createGroup:async r=>(await ze.post("/iam/groups",r)).data,updateGroup:async(r,t)=>{await ze.put(`/iam/groups/${r}`,t)},deleteGroup:async r=>{await ze.delete(`/iam/groups/${r}`)},addUserToGroup:async(r,t)=>{await ze.post(`/iam/groups/${r}/users`,{user_id:t})},removeUserFromGroup:async(r,t)=>{await ze.delete(`/iam/groups/${r}/users/${t}`)},assignRoleToUser:async(r,t)=>{await ze.post(`/iam/users/${r}/roles`,{role_name:t})},removeRoleFromUser:async(r,t)=>{await ze.delete(`/iam/users/${r}/roles?role_name=${encodeURIComponent(t)}`)},assignGroupToUser:async(r,t)=>{await ze.post(`/iam/users/${r}/groups`,{group_name:t})},removeGroupFromUser:async(r,t)=>{await ze.delete(`/iam/users/${r}/groups?group_name=${encodeURIComponent(t)}`)},listRoles:async()=>(await ze.get("/iam/roles")).data.roles,getRole:async r=>(await ze.get(`/iam/roles/${r}`)).data,createRole:async r=>(await ze.post("/iam/roles",r)).data,updateRole:async(r,t)=>{await ze.put(`/iam/roles/${r}`,t)},deleteRole:async r=>{await ze.delete(`/iam/roles/${r}`)},getRolePermissions:async r=>(await ze.get(`/iam/roles/${r}/permissions`)).data.permissions,assignPermissionToRole:async(r,t)=>{await ze.post(`/iam/roles/${r}/permissions`,{permission_name:t})},removePermissionFromRole:async(r,t)=>{await ze.delete(`/iam/roles/${r}/permissions?permission_name=${encodeURIComponent(t)}`)},listPermissions:async()=>(await ze.get("/iam/permissions")).data.permissions};function e_(){const[r,t]=Ce.useState("users"),[s,n]=Ce.useState(""),[o,l]=Ce.useState(!1),[d,c]=Ce.useState(!1),[u,h]=Ce.useState(null),[m,x]=Ce.useState(null),y=Nr(),{data:p,isLoading:v,error:N}=dt({queryKey:["iam-users"],queryFn:Zr.listUsers,refetchOnWindowFocus:!0});N&&console.error("Failed to load users:",N);const B=(p||[]).filter(K=>K.username.toLowerCase().includes(s.toLowerCase())||K.full_name&&K.full_name.toLowerCase().includes(s.toLowerCase())||K.email&&K.email.toLowerCase().includes(s.toLowerCase())||K.roles&&K.roles.some(M=>M.toLowerCase().includes(s.toLowerCase()))||K.groups&&K.groups.some(M=>M.toLowerCase().includes(s.toLowerCase()))),g=K=>{if(!K||K.length===0)return{bg:"bg-slate-700",text:"text-slate-300",border:"border-slate-600",icon:Bn,Icon:Bn,label:"No Role"};const M=K[0],T={admin:{bg:"bg-purple-500/10",text:"text-purple-400",border:"border-purple-500/20",icon:E6,label:"Admin"},operator:{bg:"bg-blue-500/10",text:"text-blue-400",border:"border-blue-500/20",icon:F6,label:"Operator"},auditor:{bg:"bg-yellow-500/10",text:"text-yellow-500",border:"border-yellow-500/20",icon:Db,label:"Auditor"},storage_admin:{bg:"bg-teal-500/10",text:"text-teal-500",border:"border-teal-500/20",icon:Ul,label:"Storage Admin"},service:{bg:"bg-slate-700",text:"text-slate-300",border:"border-slate-600",icon:Bn,label:"Service"}}[M.toLowerCase()]||{bg:"bg-slate-700",text:"text-slate-300",border:"border-slate-600",icon:Bn,label:M},ne=T.icon;return{...T,Icon:ne}},j=K=>K.toLowerCase()==="admin"?"bg-gradient-to-br from-blue-500 to-indigo-600":"bg-slate-700",_=ft({mutationFn:Zr.deleteUser,onSuccess:()=>{y.invalidateQueries({queryKey:["iam-users"]}),y.refetchQueries({queryKey:["iam-users"]})},onError:K=>{console.error("Failed to delete user:",K);const M=K.response?.data?.error||K.message||"Failed to delete user";alert(M)}}),w=K=>{_.mutate(K)},L=K=>{if(!K)return"Never";const M=new Date(K),T=new Date().getTime()-M.getTime(),ne=Math.floor(T/6e4),Z=Math.floor(T/36e5),U=Math.floor(T/864e5);return ne<1?"Just now":ne<60?`${ne} minute${ne>1?"s":""} ago`:Z<24?`${Z} hour${Z>1?"s":""} ago`:U<7?`${U} day${U>1?"s":""} ago`:M.toLocaleDateString()};return e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar h-full",children:e.jsxs("div",{className:"max-w-[1200px] mx-auto w-full p-8 flex flex-col gap-6",children:[e.jsxs("header",{className:"flex flex-wrap justify-between items-end gap-4 border-b border-border-dark pb-6",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("nav",{className:"flex items-center gap-2 text-sm text-text-secondary mb-1",children:[e.jsx("span",{children:"System"}),e.jsx(Ka,{size:16}),e.jsx("span",{className:"text-white",children:"Access Control"})]}),e.jsx("h1",{className:"text-3xl font-black text-white leading-tight",children:"User & Access Management"}),e.jsx("p",{className:"text-text-secondary text-base max-w-2xl",children:"Manage local accounts, define RBAC roles, and configure directory services (LDAP/AD) integration."})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs(ct,{variant:"outline",className:"flex items-center justify-center gap-2 px-4 py-2 bg-card-dark border border-border-dark rounded-lg text-white hover:bg-border-dark transition-colors font-semibold",children:[e.jsx(hp,{size:20}),e.jsx("span",{children:"Audit Log"})]})})]}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex border-b border-border-dark gap-8",children:[e.jsxs("button",{onClick:()=>t("users"),className:`flex items-center gap-2 pb-3 border-b-[3px] transition-colors ${r==="users"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white hover:border-slate-600"}`,children:[e.jsx(Bn,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Local Users"})]}),e.jsxs("button",{onClick:()=>t("groups"),className:`flex items-center gap-2 pb-3 border-b-[3px] transition-colors ${r==="groups"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white hover:border-slate-600"}`,children:[e.jsx(ya,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Groups"})]}),e.jsxs("button",{onClick:()=>t("roles"),className:`flex items-center gap-2 pb-3 border-b-[3px] transition-colors ${r==="roles"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white hover:border-slate-600"}`,children:[e.jsx(Bn,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Roles"})]}),e.jsxs("button",{onClick:()=>t("directory"),className:`flex items-center gap-2 pb-3 border-b-[3px] transition-colors ${r==="directory"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white hover:border-slate-600"}`,children:[e.jsx(ya,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Directory Services"})]}),e.jsxs("button",{onClick:()=>t("auth"),className:`flex items-center gap-2 pb-3 border-b-[3px] transition-colors ${r==="auth"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white hover:border-slate-600"}`,children:[e.jsx(Xm,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Authentication & SSO"})]})]}),r==="users"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 max-w-xl gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search users by name, role, or group...",value:s,onChange:K=>n(K.target.value),className:"w-full bg-card-dark border border-border-dark rounded-lg pl-10 pr-4 py-2.5 text-white placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-sm"})]}),e.jsxs(ct,{variant:"outline",className:"flex items-center gap-2 px-4 py-2.5 bg-card-dark border border-border-dark rounded-lg text-text-secondary hover:text-white hover:border-slate-500 transition-colors",children:[e.jsx(fp,{size:20}),e.jsx("span",{className:"text-sm font-medium",children:"Filter"})]})]}),e.jsxs(ct,{onClick:()=>l(!0),className:"flex items-center gap-2 bg-primary hover:bg-blue-600 text-white px-5 py-2.5 rounded-lg font-bold shadow-lg shadow-blue-500/20 transition-all",children:[e.jsx(mp,{size:20}),e.jsx("span",{children:"Create User"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-[#111a22] overflow-hidden shadow-sm",children:[e.jsx("div",{className:"overflow-x-auto custom-scrollbar",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-card-dark border-b border-border-dark text-left",children:[e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider w-24",children:"Status"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Username"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Full Name"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Role"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Groups"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Last Login"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:v?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-6 py-8 text-center text-text-secondary",children:"Loading users..."})}):N?e.jsx("tr",{children:e.jsxs("td",{colSpan:7,className:"px-6 py-8 text-center text-red-400",children:["Error loading users: ",N instanceof Error?N.message:"Unknown error"]})}):B.length>0?B.map(K=>{const M=g(K.roles),V=M.Icon,T=K.full_name?K.full_name.split(" ").map(ne=>ne[0]).join("").substring(0,2).toUpperCase():K.username.substring(0,2).toUpperCase();return e.jsxs("tr",{className:"group hover:bg-card-dark transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:K.is_active?e.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-full bg-green-500/10 text-green-500 text-xs font-bold border border-green-500/20",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),"Active"]}):e.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-full bg-red-500/10 text-red-500 text-xs font-bold border border-red-500/20",children:[e.jsx(Xm,{size:14}),"Locked"]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-full ${j(K.username)} flex items-center justify-center text-white text-xs font-bold`,children:T}),e.jsx("span",{className:"text-white font-medium",children:K.username})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:K.full_name||"-"}),e.jsx("td",{className:"px-6 py-4",children:K.roles&&K.roles.length>0?e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-md ${M.bg} ${M.text} border ${M.border}`,children:[e.jsx(V,{size:14}),M.label]}):e.jsx("span",{className:"text-text-secondary text-xs",children:"No role"})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:K.groups&&K.groups.length>0?K.groups.join(", "):"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:L(K.last_login_at)}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:ne=>{ne.stopPropagation(),x(m===K.id?null:K.id)},className:"p-2 text-text-secondary hover:text-white hover:bg-border-dark rounded-lg transition-colors",children:e.jsx(pp,{size:20})}),m===K.id&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>x(null)}),e.jsx("div",{className:"absolute right-0 mt-1 w-48 bg-card-dark border border-border-dark rounded-lg shadow-xl z-20",children:e.jsxs("div",{className:"py-1",children:[e.jsxs("button",{onClick:ne=>{ne.stopPropagation(),h(K),c(!0),x(null)},className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-[#233648] flex items-center gap-2 transition-colors",children:[e.jsx(Wd,{size:16}),"Edit User"]}),e.jsxs("button",{onClick:ne=>{ne.stopPropagation(),window.location.href=`/profile/${K.id}`},className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-[#233648] flex items-center gap-2 transition-colors",children:[e.jsx(o4,{size:16}),"View Profile"]}),!K.is_system&&e.jsxs("button",{onClick:ne=>{ne.stopPropagation(),confirm(`Are you sure you want to delete user "${K.username}"? This action cannot be undone.`)&&w(K.id),x(null)},className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-red-500/10 flex items-center gap-2 transition-colors",children:[e.jsx(es,{size:16}),"Delete User"]})]})})]})]})})]},K.id)}):e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-6 py-8 text-center text-text-secondary",children:"No users found"})})})]})}),e.jsxs("div",{className:"px-6 py-4 border-t border-border-dark flex items-center justify-between bg-card-dark",children:[e.jsxs("span",{className:"text-sm text-text-secondary",children:["Showing ",e.jsxs("span",{className:"font-bold text-white",children:["1-",B.length]})," of"," ",e.jsx("span",{className:"font-bold text-white",children:B.length})," users"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"p-2 rounded-lg text-text-secondary hover:bg-border-dark hover:text-white disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(Sy,{size:20})}),e.jsx("button",{className:"p-2 rounded-lg text-text-secondary hover:bg-border-dark hover:text-white",children:e.jsx(Ka,{size:20})})]})]})]})]}),o&&e.jsx(t_,{onClose:()=>l(!1),onSuccess:async()=>{l(!1),y.invalidateQueries({queryKey:["iam-users"]}),await y.refetchQueries({queryKey:["iam-users"]})}}),d&&u&&e.jsx(r_,{user:u,onClose:()=>{c(!1),h(null)},onSuccess:async()=>{c(!1),h(null),y.invalidateQueries({queryKey:["iam-users"]}),await y.refetchQueries({queryKey:["iam-users"]})}}),r==="groups"&&e.jsx(s_,{}),r==="roles"&&e.jsx(n_,{}),r!=="users"&&r!=="groups"&&e.jsxs("div",{className:"p-8 text-center text-text-secondary",children:[r==="directory"&&"Directory Services tab coming soon",r==="auth"&&"Authentication & SSO tab coming soon"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-2",children:[e.jsxs("div",{className:"bg-[#111a22] p-5 rounded-xl border border-border-dark flex flex-col gap-4",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-slate-800 rounded-lg text-text-secondary",children:e.jsx(ya,{size:20})}),e.jsx("h3",{className:"text-white font-bold",children:"Directory Service"})]}),e.jsx("span",{className:"px-2 py-1 rounded text-xs font-bold bg-slate-800 text-text-secondary border border-slate-700",children:"Inactive"})]}),e.jsx("p",{className:"text-sm text-text-secondary",children:"No LDAP or Active Directory server is currently connected. Local authentication is being used."}),e.jsx("div",{className:"mt-auto pt-2",children:e.jsxs("button",{className:"text-primary text-sm font-bold hover:underline flex items-center gap-1",children:["Configure Directory",e.jsx(xv,{size:16})]})})]}),e.jsxs("div",{className:"bg-[#111a22] p-5 rounded-xl border border-border-dark flex flex-col gap-4",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-orange-500/10 rounded-lg text-orange-500",children:e.jsx(Bn,{size:20})}),e.jsx("h3",{className:"text-white font-bold",children:"Security Policy"})]}),e.jsx("span",{className:"px-2 py-1 rounded text-xs font-bold bg-green-500/10 text-green-500 border border-green-500/20",children:"Good"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"text-text-secondary",children:"Multi-Factor Auth"}),e.jsx("span",{className:"text-green-500 font-medium",children:"Enforced"})]}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"text-text-secondary",children:"Password Rotation"}),e.jsx("span",{className:"text-white font-medium",children:"90 Days"})]})]}),e.jsx("div",{className:"mt-auto pt-2",children:e.jsxs("button",{className:"text-primary text-sm font-bold hover:underline flex items-center gap-1",children:["Manage Policies",e.jsx(xv,{size:16})]})})]})]})]})]})})}function t_({onClose:r,onSuccess:t}){const[s,n]=Ce.useState(""),[o,l]=Ce.useState(""),[d,c]=Ce.useState(""),[u,h]=Ce.useState(""),m=ft({mutationFn:Zr.createUser,onSuccess:async()=>{await new Promise(y=>setTimeout(y,300)),t()},onError:y=>{console.error("Failed to create user:",y);const p=y.response?.data?.error||y.message||"Failed to create user";alert(p)}}),x=y=>{if(y.preventDefault(),!s.trim()||!o.trim()||!d.trim()){alert("Username, email, and password are required");return}const p={username:s.trim(),email:o.trim(),password:d,full_name:u.trim()||void 0};console.log("Creating user:",{...p,password:"***"}),m.mutate(p)};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Create User"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Create a new user account"})]}),e.jsx("button",{onClick:r,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:x,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"user-username",className:"block text-sm font-medium text-white mb-2",children:["Username ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"user-username",type:"text",value:s,onChange:y=>n(y.target.value),placeholder:"johndoe",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"user-email",className:"block text-sm font-medium text-white mb-2",children:["Email ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"user-email",type:"email",value:o,onChange:y=>l(y.target.value),placeholder:"john.doe@example.com",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"user-password",className:"block text-sm font-medium text-white mb-2",children:["Password ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"user-password",type:"password",value:d,onChange:y=>c(y.target.value),placeholder:"Enter password",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0,minLength:8}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Minimum 8 characters"})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"user-fullname",className:"block text-sm font-medium text-white mb-2",children:["Full Name ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("input",{id:"user-fullname",type:"text",value:u,onChange:y=>h(y.target.value),placeholder:"John Doe",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:r,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:m.isPending,className:"px-6 bg-primary hover:bg-blue-600",children:m.isPending?"Creating...":"Create User"})]})]})]})})}function r_({user:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(r.email||""),[l,d]=Ce.useState(r.full_name||""),[c,u]=Ce.useState(r.is_active),[h,m]=Ce.useState(r.roles||[]),[x,y]=Ce.useState(r.groups||[]),[p,v]=Ce.useState(""),[N,B]=Ce.useState(""),g=Nr(),j=Ce.useRef(h),_=Ce.useRef(x);Ce.useEffect(()=>{j.current=h,console.log("useEffect userRoles - state updated:",h)},[h]),Ce.useEffect(()=>{_.current=x,console.log("useEffect userGroups - state updated:",x)},[x]),Ce.useEffect(()=>{console.log("EditUserForm - userRoles state changed:",h)},[h]),Ce.useEffect(()=>{console.log("EditUserForm - userGroups state changed:",x)},[x]);const{data:w=[]}=dt({queryKey:["iam-roles"],queryFn:Zr.listRoles}),{data:L=[]}=dt({queryKey:["iam-groups"],queryFn:Zr.listGroups}),K=w.filter(F=>!h.includes(F.name)),M=L.filter(F=>!x.includes(F.name)),V=ft({mutationFn:F=>Zr.updateUser(r.id,F),onSuccess:async()=>{s(),g.invalidateQueries({queryKey:["iam-users"]}),g.invalidateQueries({queryKey:["iam-user",r.id]}),g.invalidateQueries({queryKey:["iam-roles"]}),g.invalidateQueries({queryKey:["iam-groups"]}),await g.refetchQueries({queryKey:["iam-users"]}),await g.refetchQueries({queryKey:["iam-user",r.id]}),await g.refetchQueries({queryKey:["iam-roles"]}),await g.refetchQueries({queryKey:["iam-groups"]})},onError:F=>{console.error("Failed to update user:",F);const le=F.response?.data?.error||F.message||"Failed to update user";alert(le)}}),T=ft({mutationFn:F=>Zr.assignRoleToUser(r.id,F),onMutate:async F=>{console.log("assignRoleMutation onMutate - BEFORE update, current userRoles:",j.current),m(le=>{const ae=le.includes(F)?le:[...le,F];return console.log("assignRoleMutation onMutate - prev:",le,"roleName:",F,"newRoles:",ae),j.current=ae,ae}),v(""),console.log("assignRoleMutation onMutate - AFTER update, ref should be:",j.current)},onSuccess:async(F,le)=>{g.invalidateQueries({queryKey:["iam-users"]}),g.invalidateQueries({queryKey:["iam-user",r.id]}),g.invalidateQueries({queryKey:["iam-roles"]}),await g.refetchQueries({queryKey:["iam-roles"]}),m(ae=>(console.log("assignRoleMutation onSuccess - roleName:",le,"current userRoles:",ae),ae))},onError:(F,le)=>{console.error("Failed to assign role:",F,le),m(ae=>ae.filter(se=>se!==le)),alert(F.response?.data?.error||F.message||"Failed to assign role")}}),ne=ft({mutationFn:F=>Zr.removeRoleFromUser(r.id,F),onMutate:async F=>{const le=h;return m(ae=>ae.filter(se=>se!==F)),{previousRoles:le}},onSuccess:async(F,le)=>{g.invalidateQueries({queryKey:["iam-users"]}),g.invalidateQueries({queryKey:["iam-user",r.id]}),g.invalidateQueries({queryKey:["iam-roles"]}),await g.refetchQueries({queryKey:["iam-roles"]}),console.log("Role removed successfully:",le,"Current userRoles:",h)},onError:(F,le,ae)=>{console.error("Failed to remove role:",F),ae?.previousRoles&&m(ae.previousRoles),alert(F.response?.data?.error||F.message||"Failed to remove role")}}),Z=ft({mutationFn:F=>Zr.assignGroupToUser(r.id,F),onMutate:async F=>{console.log("assignGroupMutation onMutate - BEFORE update, current userGroups:",_.current),y(le=>{const ae=le.includes(F)?le:[...le,F];return console.log("assignGroupMutation onMutate - prev:",le,"groupName:",F,"newGroups:",ae),_.current=ae,ae}),B(""),console.log("assignGroupMutation onMutate - AFTER update, ref should be:",_.current)},onSuccess:async(F,le)=>{g.invalidateQueries({queryKey:["iam-users"]}),g.invalidateQueries({queryKey:["iam-user",r.id]}),g.invalidateQueries({queryKey:["iam-groups"]}),await g.refetchQueries({queryKey:["iam-groups"]}),y(ae=>(console.log("assignGroupMutation onSuccess - groupName:",le,"current userGroups:",ae),ae))},onError:(F,le)=>{console.error("Failed to assign group:",F,le),y(ae=>ae.filter(se=>se!==le)),alert(F.response?.data?.error||F.message||"Failed to assign group")}}),U=ft({mutationFn:F=>Zr.removeGroupFromUser(r.id,F),onMutate:async F=>{const le=x;return y(ae=>ae.filter(se=>se!==F)),{previousGroups:le}},onSuccess:async(F,le)=>{g.invalidateQueries({queryKey:["iam-users"]}),g.invalidateQueries({queryKey:["iam-user",r.id]}),g.invalidateQueries({queryKey:["iam-groups"]}),await g.refetchQueries({queryKey:["iam-groups"]}),console.log("Group removed successfully:",le,"Current userGroups:",x)},onError:(F,le,ae)=>{console.error("Failed to remove group:",F),ae?.previousGroups&&y(ae.previousGroups),alert(F.response?.data?.error||F.message||"Failed to remove group")}}),q=F=>{F.preventDefault();const le=j.current,ae=_.current,se={email:n.trim(),full_name:l.trim()||void 0,is_active:c,roles:le,groups:ae};console.log("EditUserForm - Submitting payload:",se),console.log("EditUserForm - currentRoles from ref:",le),console.log("EditUserForm - currentGroups from ref:",ae),console.log("EditUserForm - userRoles from state:",h),console.log("EditUserForm - userGroups from state:",x),V.mutate(se)};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Edit User"}),e.jsxs("p",{className:"text-sm text-text-secondary mt-1",children:["Edit user account: ",r.username]})]}),e.jsx("button",{onClick:t,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:q,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-username",className:"block text-sm font-medium text-white mb-2",children:"Username"}),e.jsx("input",{id:"edit-username",type:"text",value:r.username,disabled:!0,className:"w-full px-4 py-3 bg-[#0a0f14] border border-border-dark rounded-lg text-text-secondary text-sm cursor-not-allowed"}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Username cannot be changed"})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-email",className:"block text-sm font-medium text-white mb-2",children:["Email ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"edit-email",type:"email",value:n,onChange:F=>o(F.target.value),placeholder:"john.doe@example.com",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-fullname",className:"block text-sm font-medium text-white mb-2",children:["Full Name ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("input",{id:"edit-fullname",type:"text",value:l,onChange:F=>d(F.target.value),placeholder:"John Doe",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors"})]}),e.jsxs("div",{className:"border-t border-border-dark pt-6",children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-3",children:"Roles"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("select",{value:p,onChange:F=>v(F.target.value),className:"flex-1 px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"",children:"Select a role..."}),K.map(F=>e.jsxs("option",{value:F.name,children:[F.name," ",F.description?`- ${F.description}`:""]},F.name))]}),e.jsx(ct,{type:"button",onClick:()=>{p&&T.mutate(p)},disabled:!p||T.isPending,className:"px-4 bg-primary hover:bg-blue-600",children:e.jsx(Ks,{size:16})})]}),e.jsx("div",{className:"space-y-2",children:h.length>0?h.map(F=>e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg",children:[e.jsx("span",{className:"text-white text-sm font-medium",children:F}),e.jsx("button",{type:"button",onClick:()=>ne.mutate(F),disabled:ne.isPending,className:"text-red-400 hover:text-red-300 transition-colors",children:e.jsx(es,{size:16})})]},F)):e.jsx("p",{className:"text-text-secondary text-sm text-center py-2",children:"No roles assigned"})})]}),e.jsxs("div",{className:"border-t border-border-dark pt-6",children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-3",children:"Groups"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("select",{value:N,onChange:F=>B(F.target.value),className:"flex-1 px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"",children:"Select a group..."}),M.map(F=>e.jsxs("option",{value:F.name,children:[F.name," ",F.description?`- ${F.description}`:""]},F.id))]}),e.jsx(ct,{type:"button",onClick:()=>{N&&Z.mutate(N)},disabled:!N||Z.isPending,className:"px-4 bg-primary hover:bg-blue-600",children:e.jsx(Ks,{size:16})})]}),e.jsx("div",{className:"space-y-2",children:x.length>0?x.map(F=>e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg",children:[e.jsx("span",{className:"text-white text-sm font-medium",children:F}),e.jsx("button",{type:"button",onClick:()=>U.mutate(F),disabled:U.isPending,className:"text-red-400 hover:text-red-300 transition-colors",children:e.jsx(es,{size:16})})]},F)):e.jsx("p",{className:"text-text-secondary text-sm text-center py-2",children:"No groups assigned"})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:F=>u(F.target.checked),className:"w-4 h-4 rounded bg-[#0f161d] border-border-dark text-primary focus:ring-2 focus:ring-primary"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Active Account"})]}),e.jsx("p",{className:"text-xs text-text-secondary mt-1 ml-7",children:c?"User can log in and access the system":"User account is disabled"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:V.isPending,className:"px-6 bg-primary hover:bg-blue-600",children:V.isPending?"Saving...":"Save Changes"})]})]})]})})}function s_(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(!1),[c,u]=Ce.useState(null),[h,m]=Ce.useState(null),{data:x,isLoading:y}=dt({queryKey:["iam-groups"],queryFn:Zr.listGroups}),p=x?.filter(B=>B.name.toLowerCase().includes(t.toLowerCase())||B.description&&B.description.toLowerCase().includes(t.toLowerCase()))||[],v=ft({mutationFn:Zr.deleteGroup,onSuccess:async()=>{r.invalidateQueries({queryKey:["iam-groups"]}),await r.refetchQueries({queryKey:["iam-groups"]}),r.invalidateQueries({queryKey:["iam-users"]}),await r.refetchQueries({queryKey:["iam-users"]}),alert("Group deleted successfully!")},onError:B=>{console.error("Failed to delete group:",B),alert(B.response?.data?.error||B.message||"Failed to delete group")}}),N=(B,g)=>{confirm(`Are you sure you want to delete group "${g}"? This action cannot be undone.`)&&v.mutate(B)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 max-w-xl gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search groups by name or description...",value:t,onChange:B=>s(B.target.value),className:"w-full bg-card-dark border border-border-dark rounded-lg pl-10 pr-4 py-2.5 text-white placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-sm"})]}),e.jsxs(ct,{variant:"outline",className:"flex items-center gap-2 px-4 py-2.5 bg-card-dark border border-border-dark rounded-lg text-text-secondary hover:text-white hover:border-slate-500 transition-colors",children:[e.jsx(fp,{size:20}),e.jsx("span",{className:"text-sm font-medium",children:"Filter"})]})]}),e.jsxs(ct,{onClick:()=>o(!0),className:"flex items-center gap-2 bg-primary hover:bg-blue-600 text-white px-5 py-2.5 rounded-lg font-bold shadow-lg shadow-blue-500/20 transition-all",children:[e.jsx(mp,{size:20}),e.jsx("span",{children:"Create Group"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-[#111a22] overflow-hidden shadow-sm",children:[e.jsx("div",{className:"overflow-x-auto custom-scrollbar",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-card-dark border-b border-border-dark text-left",children:[e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Description"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Users"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Roles"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:y?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-8 text-center text-text-secondary",children:"Loading groups..."})}):p.length>0?p.map(B=>e.jsxs("tr",{className:"group hover:bg-card-dark transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"text-white font-medium",children:B.name})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:B.description||"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:B.user_count}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:B.role_count}),e.jsx("td",{className:"px-6 py-4",children:B.is_system?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-purple-500/10 text-purple-400 text-xs font-medium border border-purple-500/20",children:[e.jsx(Bn,{size:12}),"System"]}):e.jsx("span",{className:"text-text-secondary text-xs",children:"Custom"})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:g=>{g.stopPropagation(),m(h===B.id?null:B.id)},className:"p-2 text-text-secondary hover:text-white hover:bg-border-dark rounded-lg transition-colors",children:e.jsx(pp,{size:20})}),h===B.id&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>m(null)}),e.jsx("div",{className:"absolute right-0 mt-1 w-48 bg-card-dark border border-border-dark rounded-lg shadow-xl z-20",children:e.jsxs("div",{className:"py-1",children:[e.jsxs("button",{onClick:g=>{g.stopPropagation(),u(B),d(!0),m(null)},disabled:B.is_system,className:"w-full px-4 py-2 text-left text-sm text-white hover:bg-[#233648] flex items-center gap-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Wd,{size:16}),"Edit Group"]}),e.jsxs("button",{onClick:g=>{g.stopPropagation(),N(B.id,B.name),m(null)},disabled:B.is_system||v.isPending,className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-red-500/10 flex items-center gap-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(es,{size:16}),"Delete Group"]})]})})]})]})})]},B.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-8 text-center text-text-secondary",children:"No groups found"})})})]})}),e.jsxs("div",{className:"px-6 py-4 border-t border-border-dark flex items-center justify-between bg-card-dark",children:[e.jsxs("span",{className:"text-sm text-text-secondary",children:["Showing ",e.jsxs("span",{className:"font-bold text-white",children:["1-",p.length]})," of"," ",e.jsx("span",{className:"font-bold text-white",children:p.length})," groups"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"p-2 rounded-lg text-text-secondary hover:bg-border-dark hover:text-white disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(Sy,{size:20})}),e.jsx("button",{className:"p-2 rounded-lg text-text-secondary hover:bg-border-dark hover:text-white",children:e.jsx(Ka,{size:20})})]})]})]}),n&&e.jsx(a_,{onClose:()=>o(!1),onSuccess:async()=>{o(!1),r.invalidateQueries({queryKey:["iam-groups"]}),await r.refetchQueries({queryKey:["iam-groups"]})}}),l&&c&&e.jsx(l_,{group:c,onClose:()=>{d(!1),u(null)},onSuccess:async()=>{d(!1),u(null),r.invalidateQueries({queryKey:["iam-groups"]}),await r.refetchQueries({queryKey:["iam-groups"]}),r.invalidateQueries({queryKey:["iam-users"]}),await r.refetchQueries({queryKey:["iam-users"]})}})]})}function a_({onClose:r,onSuccess:t}){const[s,n]=Ce.useState(""),[o,l]=Ce.useState(""),d=ft({mutationFn:Zr.createGroup,onSuccess:()=>{t()},onError:u=>{console.error("Failed to create group:",u);const h=u.response?.data?.error||u.message||"Failed to create group";alert(h)}}),c=u=>{if(u.preventDefault(),!s.trim()){alert("Name is required");return}const h={name:s.trim(),description:o.trim()||""};console.log("Creating group:",h),d.mutate(h)};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Create Group"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Create a new user group"})]}),e.jsx("button",{onClick:r,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:20})})]}),e.jsxs("form",{onSubmit:c,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"group-name",className:"block text-sm font-medium text-white mb-2",children:["Group Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"group-name",type:"text",value:s,onChange:u=>n(u.target.value),placeholder:"operators",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"group-description",className:"block text-sm font-medium text-white mb-2",children:["Description ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("textarea",{id:"group-description",value:o,onChange:u=>l(u.target.value),placeholder:"Group description",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors resize-none",rows:4})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:r,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:d.isPending,className:"px-6 bg-primary hover:bg-blue-600",children:d.isPending?"Creating...":"Create Group"})]})]})]})})}function n_(){const r=Nr(),[t,s]=Ce.useState(""),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(!1),[c,u]=Ce.useState(null),{data:h,isLoading:m}=dt({queryKey:["iam-roles"],queryFn:Zr.listRoles}),x=h?.filter(v=>v.name.toLowerCase().includes(t.toLowerCase())||v.description&&v.description.toLowerCase().includes(t.toLowerCase()))||[],y=ft({mutationFn:Zr.deleteRole,onSuccess:async()=>{r.invalidateQueries({queryKey:["iam-roles"]}),await r.refetchQueries({queryKey:["iam-roles"]}),r.invalidateQueries({queryKey:["iam-users"]}),await r.refetchQueries({queryKey:["iam-users"]}),alert("Role deleted successfully!")},onError:v=>{console.error("Failed to delete role:",v),alert(v.response?.data?.error||v.message||"Failed to delete role")}}),p=v=>{confirm("Are you sure you want to delete this role? This action cannot be undone.")&&y.mutate(v)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 max-w-xl gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary",size:20}),e.jsx("input",{type:"text",placeholder:"Search roles by name or description...",value:t,onChange:v=>s(v.target.value),className:"w-full bg-card-dark border border-border-dark rounded-lg pl-10 pr-4 py-2.5 text-white placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-sm"})]}),e.jsxs(ct,{variant:"outline",className:"flex items-center gap-2 px-4 py-2.5 bg-card-dark border border-border-dark rounded-lg text-text-secondary hover:text-white hover:border-slate-500 transition-colors",children:[e.jsx(fp,{size:20}),e.jsx("span",{className:"text-sm font-medium",children:"Filter"})]})]}),e.jsxs(ct,{onClick:()=>o(!0),className:"flex items-center gap-2 bg-primary hover:bg-blue-600 text-white px-5 py-2.5 rounded-lg font-bold shadow-lg shadow-blue-500/20 transition-all",children:[e.jsx(mp,{size:20}),e.jsx("span",{children:"Create Role"})]})]}),e.jsx("div",{className:"rounded-xl border border-border-dark bg-[#111a22] overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto custom-scrollbar",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-card-dark border-b border-border-dark text-left",children:[e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Description"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Users"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-text-secondary uppercase tracking-wider text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:m?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-6 py-8 text-center text-text-secondary",children:"Loading roles..."})}):x.length>0?x.map(v=>e.jsxs("tr",{className:"group hover:bg-card-dark transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"text-white font-medium",children:v.name})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:v.description||"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary text-sm",children:v.user_count||0}),e.jsx("td",{className:"px-6 py-4",children:v.is_system?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-purple-500/10 text-purple-400 text-xs font-medium border border-purple-500/20",children:[e.jsx(Bn,{size:12}),"System"]}):e.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-blue-500/10 text-blue-400 text-xs font-medium border border-blue-500/20",children:"Custom"})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{u(v),d(!0)},className:"p-2 text-text-secondary hover:text-white hover:bg-border-dark rounded-lg transition-colors",title:"Edit role",children:e.jsx(Wd,{size:16})}),!v.is_system&&e.jsx("button",{onClick:()=>p(v.id),disabled:y.isPending,className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded-lg transition-colors",title:"Delete role",children:e.jsx(es,{size:16})})]})})]},v.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-6 py-8 text-center text-text-secondary",children:"No roles found"})})})]})})}),n&&e.jsx(i_,{onClose:()=>o(!1),onSuccess:async()=>{o(!1),r.invalidateQueries({queryKey:["iam-roles"]}),await r.refetchQueries({queryKey:["iam-roles"]})}}),l&&c&&e.jsx(o_,{role:c,onClose:()=>{d(!1),u(null)},onSuccess:async()=>{d(!1),u(null),r.invalidateQueries({queryKey:["iam-roles"]}),await r.refetchQueries({queryKey:["iam-roles"]}),r.invalidateQueries({queryKey:["iam-users"]}),await r.refetchQueries({queryKey:["iam-users"]})}})]})}function i_({onClose:r,onSuccess:t}){const[s,n]=Ce.useState(""),[o,l]=Ce.useState(""),d=ft({mutationFn:u=>Zr.createRole(u),onSuccess:()=>{t()},onError:u=>{console.error("Failed to create role:",u);const h=u.response?.data?.error||u.message||"Failed to create role";alert(h)}}),c=u=>{u.preventDefault(),d.mutate({name:s.trim(),description:o.trim()||void 0})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Create Role"}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Create a new role for access control"})]}),e.jsx("button",{onClick:r,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:24})})]}),e.jsxs("form",{onSubmit:c,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"role-name",className:"block text-sm font-medium text-white mb-2",children:["Role Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"role-name",type:"text",value:s,onChange:u=>n(u.target.value),placeholder:"e.g., operator, auditor",className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"role-description",className:"block text-sm font-medium text-white mb-2",children:["Description ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("textarea",{id:"role-description",value:o,onChange:u=>l(u.target.value),placeholder:"Describe the role's purpose and permissions",rows:3,className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:r,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:d.isPending,className:"px-6 bg-primary hover:bg-blue-600",children:d.isPending?"Creating...":"Create Role"})]})]})]})})}function o_({role:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(r.name),[l,d]=Ce.useState(r.description||""),[c,u]=Ce.useState([]),[h,m]=Ce.useState(""),x=Nr(),{data:y=[]}=dt({queryKey:["iam-role-permissions",r.id],queryFn:()=>Zr.getRolePermissions(r.id)});Ce.useEffect(()=>{y&&u(y)},[y]);const{data:p=[]}=dt({queryKey:["iam-permissions"],queryFn:Zr.listPermissions}),v=p.filter(_=>!c.includes(_.name)),N=ft({mutationFn:_=>Zr.updateRole(r.id,_),onSuccess:()=>{s()},onError:_=>{console.error("Failed to update role:",_);const w=_.response?.data?.error||_.message||"Failed to update role";alert(w)}}),B=ft({mutationFn:_=>Zr.assignPermissionToRole(r.id,_),onSuccess:async()=>{const _=await Zr.getRolePermissions(r.id);u(_),x.invalidateQueries({queryKey:["iam-role-permissions",r.id]}),await x.refetchQueries({queryKey:["iam-role-permissions",r.id]}),x.invalidateQueries({queryKey:["iam-users"]}),await x.refetchQueries({queryKey:["iam-users"]}),m("")},onError:_=>{console.error("Failed to assign permission:",_),alert(_.response?.data?.error||_.message||"Failed to assign permission")}}),g=ft({mutationFn:_=>Zr.removePermissionFromRole(r.id,_),onSuccess:async()=>{const _=await Zr.getRolePermissions(r.id);u(_),x.invalidateQueries({queryKey:["iam-role-permissions",r.id]}),await x.refetchQueries({queryKey:["iam-role-permissions",r.id]}),x.invalidateQueries({queryKey:["iam-users"]}),await x.refetchQueries({queryKey:["iam-users"]})},onError:_=>{console.error("Failed to remove permission:",_),alert(_.response?.data?.error||_.message||"Failed to remove permission")}}),j=_=>{_.preventDefault(),N.mutate({name:n.trim(),description:l.trim()||void 0})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white",children:["Edit Role: ",r.name]}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Modify role details"})]}),e.jsx("button",{onClick:t,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:24})})]}),e.jsxs("form",{onSubmit:j,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-role-name",className:"block text-sm font-medium text-white mb-2",children:["Role Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"edit-role-name",type:"text",value:n,onChange:_=>o(_.target.value),disabled:r.is_system,className:`w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors ${r.is_system?"cursor-not-allowed opacity-50":""}`,required:!0}),r.is_system&&e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"System roles cannot be renamed"})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-role-description",className:"block text-sm font-medium text-white mb-2",children:["Description ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("textarea",{id:"edit-role-description",value:l,onChange:_=>d(_.target.value),placeholder:"Describe the role's purpose and permissions",rows:3,className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors resize-none"})]}),e.jsxs("div",{className:"border-t border-border-dark pt-6",children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-3",children:"Permissions"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("select",{value:h,onChange:_=>m(_.target.value),className:"flex-1 px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[e.jsx("option",{value:"",children:"Select a permission..."}),v.map(_=>e.jsxs("option",{value:_.name,children:[_.name," ",_.description?`- ${_.description}`:`(${_.resource}:${_.action})`]},_.id))]}),e.jsx(ct,{type:"button",onClick:()=>{h&&B.mutate(h)},disabled:!h||B.isPending,className:"px-4 bg-primary hover:bg-blue-600",children:e.jsx(Ks,{size:16})})]}),e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto custom-scrollbar",children:c.length>0?c.map(_=>{const w=p.find(L=>L.name===_);return e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-[#0f161d] border border-border-dark rounded-lg",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-white text-sm font-medium",children:_}),w&&e.jsxs("span",{className:"text-text-secondary text-xs",children:[w.resource,":",w.action,w.description&&` - ${w.description}`]})]}),e.jsx("button",{type:"button",onClick:()=>g.mutate(_),disabled:g.isPending,className:"text-red-400 hover:text-red-300 transition-colors",children:e.jsx(es,{size:16})})]},_)}):e.jsx("p",{className:"text-text-secondary text-sm text-center py-2",children:"No permissions assigned"})})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:N.isPending||r.is_system,className:"px-6 bg-primary hover:bg-blue-600",children:N.isPending?"Saving...":"Save Changes"})]})]})]})})}function l_({group:r,onClose:t,onSuccess:s}){const[n,o]=Ce.useState(r.name),[l,d]=Ce.useState(r.description||""),c=ft({mutationFn:h=>Zr.updateGroup(r.id,h),onSuccess:()=>{s()},onError:h=>{console.error("Failed to update group:",h);const m=h.response?.data?.error||h.message||"Failed to update group";alert(m)}}),u=h=>{h.preventDefault(),c.mutate({name:n.trim(),description:l.trim()||void 0})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border-dark bg-[#1e2832]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-white",children:["Edit Group: ",r.name]}),e.jsx("p",{className:"text-sm text-text-secondary mt-1",children:"Modify group details"})]}),e.jsx("button",{onClick:t,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-[#233648] rounded-lg",children:e.jsx(Zs,{size:24})})]}),e.jsxs("form",{onSubmit:u,className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-group-name",className:"block text-sm font-medium text-white mb-2",children:["Group Name ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{id:"edit-group-name",type:"text",value:n,onChange:h=>o(h.target.value),disabled:r.is_system,className:`w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors ${r.is_system?"cursor-not-allowed opacity-50":""}`,required:!0}),r.is_system&&e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"System groups cannot be renamed"})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"edit-group-description",className:"block text-sm font-medium text-white mb-2",children:["Description ",e.jsx("span",{className:"text-text-secondary text-xs",children:"(Optional)"})]}),e.jsx("textarea",{id:"edit-group-description",value:l,onChange:h=>d(h.target.value),placeholder:"Describe the group's purpose",rows:3,className:"w-full px-4 py-3 bg-[#0f161d] border border-border-dark rounded-lg text-white text-sm placeholder-text-secondary/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-colors resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-border-dark",children:[e.jsx(ct,{type:"button",variant:"outline",onClick:t,className:"px-6",children:"Cancel"}),e.jsx(ct,{type:"submit",disabled:c.isPending||r.is_system,className:"px-6 bg-primary hover:bg-blue-600",children:c.isPending?"Saving...":"Save Changes"})]})]})]})})}function Uv(){const{id:r}=jy(),t=Ph(),{user:s}=hu(),n=Nr(),[o,l]=Ce.useState(!1),[d,c]=Ce.useState({email:"",full_name:""}),[u,h]=Ce.useState(null),m=r||s?.id,x=!!s&&!!m&&(m===s.id||s.roles.includes("admin")),{data:y,isLoading:p}=dt({queryKey:["iam-user",m],queryFn:()=>Zr.getUser(m),enabled:x}),v=ft({mutationFn:M=>Zr.updateUser(m,M),onSuccess:()=>{n.invalidateQueries({queryKey:["iam-user",m]}),n.invalidateQueries({queryKey:["iam-users"]}),l(!1),m===s?.id&&n.invalidateQueries({queryKey:["auth-me"]})}});if(Ce.useEffect(()=>{if(y){c({email:y.email||"",full_name:y.full_name||""});const M=localStorage.getItem(`avatar_${y.id}`);M&&h(M)}},[y]),!x)return e.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e.jsx("div",{className:"max-w-[1200px] mx-auto",children:e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-6 text-center",children:[e.jsx("p",{className:"text-red-400 font-semibold",children:"Access Denied"}),e.jsx("p",{className:"text-text-secondary text-sm mt-2",children:"You don't have permission to view this profile."}),e.jsxs(ct,{variant:"outline",onClick:()=>t(-1),className:"mt-4",children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})})});if(p)return e.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e.jsx("div",{className:"max-w-[1200px] mx-auto",children:e.jsx("p",{className:"text-text-secondary",children:"Loading profile..."})})});if(!y)return e.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e.jsx("div",{className:"max-w-[1200px] mx-auto",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-lg p-6 text-center",children:[e.jsx("p",{className:"text-text-secondary",children:"User not found"}),e.jsxs(ct,{variant:"outline",onClick:()=>t(-1),className:"mt-4",children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Go Back"]})]})})});const N=m===s?.id,B=N||s?.roles.includes("admin"),g=()=>{v.mutate({email:d.email,full_name:d.full_name}),u&&y&&(localStorage.setItem(`avatar_${y.id}`,u),window.dispatchEvent(new Event("avatar-updated")))},j=M=>{const V=M.target.files?.[0];if(V){if(!V.type.startsWith("image/")){alert("Please select an image file");return}if(V.size>2*1024*1024){alert("Image size must be less than 2MB");return}const T=new FileReader;T.onloadend=()=>{h(T.result)},T.readAsDataURL(V)}},_=()=>{h(null),y&&(localStorage.removeItem(`avatar_${y.id}`),window.dispatchEvent(new Event("avatar-updated")))},w=M=>new Date(M).toLocaleString(),L=M=>M?w(M):"Never",K=()=>y?.full_name?y.full_name.split(" ").map(M=>M[0]).join("").substring(0,2).toUpperCase():y?.username?.substring(0,2).toUpperCase()||"U";return e.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(ct,{variant:"ghost",size:"sm",onClick:()=>t(-1),className:"text-text-secondary hover:text-white",children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-black text-white leading-tight",children:"User Profile"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:N?"Your profile information":`Viewing profile for ${y.username}`})]})]}),B&&e.jsx("div",{className:"flex gap-2",children:o?e.jsxs(e.Fragment,{children:[e.jsxs(ct,{variant:"outline",onClick:()=>{l(!1),c({email:y.email||"",full_name:y.full_name||""})},children:[e.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Cancel"]}),e.jsxs(ct,{onClick:g,disabled:v.isPending,children:[e.jsx(up,{className:"h-4 w-4 mr-2"}),v.isPending?"Saving...":"Save Changes"]})]}):e.jsxs(ct,{onClick:()=>l(!0),children:[e.jsx(gv,{className:"h-4 w-4 mr-2"}),"Edit Profile"]})})]}),e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-blue-600/20 p-8 border-b border-border-dark",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center text-white text-3xl font-bold overflow-hidden",children:[u?e.jsx("img",{src:u,alt:y.full_name||y.username,className:"w-full h-full object-cover",onError:M=>{const V=M.target;V.style.display="none";const T=V.nextElementSibling;T&&(T.style.display="flex")}}):null,e.jsx("span",{className:u?"hidden":"",children:K()})]}),B&&e.jsx("div",{className:"absolute bottom-0 right-0",children:e.jsxs("label",{className:"cursor-pointer bg-primary hover:bg-primary/90 rounded-full p-2 border-2 border-background-dark flex items-center justify-center transition-colors",children:[e.jsx(gv,{className:"h-4 w-4 text-white"}),e.jsx("input",{type:"file",accept:"image/*",onChange:j,className:"hidden"})]})}),B&&u&&e.jsx("button",{onClick:_,className:"absolute top-0 right-0 bg-red-500 hover:bg-red-600 rounded-full p-1.5 border-2 border-background-dark flex items-center justify-center transition-colors",title:"Remove avatar",children:e.jsx(Zs,{className:"h-3 w-3 text-white"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:y.full_name||y.username}),e.jsxs("p",{className:"text-text-secondary mt-1",children:["@",y.username]}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold ${y.is_active?"bg-green-500/10 text-green-400 border border-green-500/20":"bg-red-500/10 text-red-400 border border-red-500/20"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${y.is_active?"bg-green-400":"bg-red-400"}`}),y.is_active?"Active":"Inactive"]}),y.is_system&&e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold bg-purple-500/10 text-purple-400 border border-purple-500/20",children:[e.jsx(Bn,{size:12}),"System User"]})]})]})]})}),e.jsx("div",{className:"p-8",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(o4,{className:"h-5 w-5 text-primary"}),"Basic Information"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Username"}),e.jsx("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white font-mono",children:y.username}),e.jsx("p",{className:"text-xs text-text-secondary mt-1",children:"Username cannot be changed"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Email Address"}),o?e.jsx("input",{type:"email",value:d.email,onChange:M=>c({...d,email:M.target.value}),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"email@example.com"}):e.jsxs("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white flex items-center gap-2",children:[e.jsx(U6,{className:"h-4 w-4 text-text-secondary"}),y.email||"-"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Full Name"}),o?e.jsx("input",{type:"text",value:d.full_name,onChange:M=>c({...d,full_name:M.target.value}),className:"w-full bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"Full Name"}):e.jsx("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white",children:y.full_name||"-"})]})]})]})}),e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(Bn,{className:"h-5 w-5 text-primary"}),"Account Details"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Roles"}),e.jsx("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3",children:y.roles&&y.roles.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:y.roles.map(M=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-primary/10 text-primary text-xs font-medium border border-primary/20",children:[e.jsx(Bn,{size:12}),M]},M))}):e.jsx("span",{className:"text-text-secondary text-sm",children:"No roles assigned"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Permissions"}),e.jsx("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3",children:y.permissions&&y.permissions.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:y.permissions.map(M=>e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-slate-700 text-slate-300 text-xs font-medium",children:M},M))}):e.jsx("span",{className:"text-text-secondary text-sm",children:"No permissions assigned"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Last Login"}),e.jsxs("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white flex items-center gap-2",children:[e.jsx(Ec,{className:"h-4 w-4 text-text-secondary"}),L(y.last_login_at)]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-text-secondary uppercase tracking-wider mb-2",children:"Account Created"}),e.jsxs("div",{className:"bg-[#0f161d] border border-border-dark rounded-lg px-4 py-3 text-white flex items-center gap-2",children:[e.jsx(l4,{className:"h-4 w-4 text-text-secondary"}),w(y.created_at)]})]})]})]})})]})})]})]})})}const Qv=[{id:"1",name:"Daily Backup: VM-Cluster-01",type:"Replication",progress:45,speed:"145 MB/s",status:"running",eta:"1h 12m"},{id:"2",name:"ZFS Scrub: Pool-01",type:"Maintenance",progress:78,speed:"1.2 GB/s",status:"running"}];function A_(){const[r,t]=Ce.useState("jobs"),[s,n]=Ce.useState(""),o=5,{data:l,isLoading:d}=dt({queryKey:["monitoring-metrics"],queryFn:Cc.getMetrics,refetchInterval:o*1e3}),{data:c=[],isLoading:u}=dt({queryKey:["monitoring-logs"],queryFn:()=>ao.getSystemLogs(50),refetchInterval:10*1e3}),{data:h=[]}=dt({queryKey:["monitoring-network"],queryFn:()=>ao.getNetworkThroughput("15m"),refetchInterval:o*1e3}),{data:m=[]}=dt({queryKey:["monitoring-pools"],queryFn:sn.listPools,refetchInterval:30*1e3}),{data:x}=dt({queryKey:["monitoring-alerts"],queryFn:()=>Cc.listAlerts({limit:20}),refetchInterval:10*1e3}),y=w=>{const L=Math.floor(w/86400),K=Math.floor(w%86400/3600),M=Math.floor(w%3600/60);return`${L}d ${K}h ${M}m`},p=m.length>0?m[0]:null,v=p?.health_status==="online"?"Online":"Degraded",N=p?.health_status==="online",B=c.filter(w=>w.message.toLowerCase().includes(s.toLowerCase())||w.source.toLowerCase().includes(s.toLowerCase())),g=w=>{const L=w.toUpperCase();return L==="INFO"||L==="DEBUG"?"text-emerald-500":L==="WARN"||L==="WARNING"?"text-yellow-500":L==="ERROR"||L==="CRITICAL"||L==="FATAL"?"text-red-500":"text-text-secondary"},j=h.length>0?Math.max(...h.map(w=>Math.max(w.inbound,w.outbound))):0,_=h.length>0?((h[h.length-1].inbound+h[h.length-1].outbound)/1e3).toFixed(1):"0.0";return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col bg-background-dark",children:[e.jsx("header",{className:"flex-none px-6 py-5 border-b border-border-dark bg-background-dark/95 backdrop-blur z-10",children:e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-3 max-w-[1600px] mx-auto",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-white text-3xl font-black tracking-tight",children:"System Monitor"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Real-time telemetry, ZFS health, and system event logs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-card-dark rounded-lg border border-border-dark",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),e.jsx("span",{className:"text-xs font-medium text-emerald-400",children:"System Healthy"})]}),e.jsxs("button",{className:"flex items-center gap-2 h-10 px-4 bg-card-dark hover:bg-[#233648] border border-border-dark text-white text-sm font-bold rounded-lg transition-colors",children:[e.jsx(Cn,{size:18}),e.jsxs("span",{children:["Refresh: ",o,"s"]})]})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6",children:e.jsxs("div",{className:"flex flex-col gap-6 max-w-[1600px] mx-auto pb-10",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"CPU Load"}),e.jsx(e4,{className:"text-text-secondary",size:20})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsx("p",{className:"text-white text-3xl font-bold",children:d?"...":`${l?.system?.cpu_usage_percent?.toFixed(0)||0}%`}),e.jsxs("span",{className:"text-emerald-500 text-sm font-medium mb-1 flex items-center",children:[e.jsx(t4,{size:16,className:"mr-1"}),"2%"]})]}),e.jsx("div",{className:"h-1.5 w-full bg-[#233648] rounded-full mt-3 overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${l?.system?.cpu_usage_percent||0}%`}})})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"RAM Usage"}),e.jsx(r4,{className:"text-text-secondary",size:20})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsx("p",{className:"text-white text-3xl font-bold",children:d?"...":fr(l?.system?.memory_used_bytes||0)}),e.jsxs("span",{className:"text-text-secondary text-xs mb-2",children:["/ ",fr(l?.system?.memory_total_bytes||0)]})]}),e.jsx("div",{className:"h-1.5 w-full bg-[#233648] rounded-full mt-3 overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500 rounded-full transition-all",style:{width:`${l?.system?.memory_usage_percent||0}%`}})})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"ZFS Pool Status"}),e.jsx(su,{className:N?"text-emerald-500":"text-yellow-500",size:20})]}),e.jsxs("div",{className:"flex items-end gap-3 mt-1",children:[e.jsx("p",{className:"text-white text-3xl font-bold",children:v}),e.jsx("span",{className:"text-text-secondary text-sm font-medium mb-1",children:"No Errors"})]}),e.jsx("div",{className:"flex gap-1 mt-3",children:[1,2,3,4].map(w=>e.jsx("div",{className:`h-1.5 flex-1 rounded-full ${w===1?"rounded-l-full":w===4?"rounded-r-full":""} ${N?"bg-emerald-500":"bg-yellow-500"}`},w))})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-5 border border-border-dark bg-card-dark",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"System Uptime"}),e.jsx(Ec,{className:"text-text-secondary",size:20})]}),e.jsx("div",{className:"mt-1",children:e.jsx("p",{className:"text-white text-3xl font-bold",children:d?"...":y(l?.system?.uptime_seconds||0)})}),e.jsx("p",{className:"text-text-secondary text-xs mt-3",children:"Last reboot: Manual Patching"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"xl:col-span-2 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Network Throughput"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Inbound vs Outbound (eth0)"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-white text-2xl font-bold leading-tight",children:[_," Gbps"]}),e.jsxs("p",{className:"text-emerald-500 text-sm",children:["Peak: ",(j/1e3).toFixed(1)," Gbps"]})]})]}),e.jsx("div",{className:"h-[200px] w-full",children:h.length>0?e.jsx(Cl,{width:"100%",height:"100%",children:e.jsxs(f4,{data:h.map(w=>({time:new Date(w.time).toLocaleTimeString(),inbound:w.inbound,outbound:w.outbound})),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"gradientPrimary",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#137fec",stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:"#137fec",stopOpacity:0})]})}),e.jsx(Nc,{strokeDasharray:"3 3",stroke:"#324d67"}),e.jsx(Bc,{dataKey:"time",stroke:"#92adc9",style:{fontSize:"12px"}}),e.jsx(jc,{stroke:"#92adc9",style:{fontSize:"12px"}}),e.jsx(Sl,{contentStyle:{backgroundColor:"#1a2632",border:"1px solid #324d67",borderRadius:"0.5rem"}}),e.jsx(Qh,{}),e.jsx(vh,{type:"monotone",dataKey:"outbound",stroke:"#92adc9",strokeDasharray:"5 5",strokeWidth:2,fill:"none"}),e.jsx(vh,{type:"monotone",dataKey:"inbound",stroke:"#137fec",strokeWidth:3,fill:"url(#gradientPrimary)"})]})}):e.jsx("div",{className:"h-full flex items-center justify-center text-text-secondary",children:"Loading network data..."})})]}),e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"ZFS ARC Hit Ratio"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Cache efficiency"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-white text-2xl font-bold leading-tight",children:"94%"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Target: >90%"})]})]}),e.jsxs("div",{className:"h-[150px] w-full relative",children:[e.jsx(Cl,{width:"100%",height:"100%",children:e.jsxs(ky,{data:[{time:"10:00",ratio:95},{time:"10:15",ratio:94},{time:"10:30",ratio:96},{time:"10:45",ratio:93},{time:"11:00",ratio:94}],children:[e.jsx(Nc,{strokeDasharray:"3 3",stroke:"#324d67"}),e.jsx(Bc,{dataKey:"time",stroke:"#92adc9",style:{fontSize:"12px"}}),e.jsx(jc,{stroke:"#92adc9",domain:[90,100],style:{fontSize:"12px"}}),e.jsx(Sl,{contentStyle:{backgroundColor:"#1a2632",border:"1px solid #324d67",borderRadius:"0.5rem"}}),e.jsx(Lh,{type:"monotone",dataKey:"ratio",stroke:"#10b981",strokeWidth:2,dot:!1})]})}),e.jsx("div",{className:"w-full h-[1px] bg-border-dark absolute top-[20%]"}),e.jsx("div",{className:"absolute top-[20%] right-0 text-xs text-text-secondary -mt-5",children:"95%"})]})]})]}),e.jsx("div",{className:"flex flex-col gap-6",children:e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl p-6 h-full shadow-sm flex flex-col",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Disk Health"}),e.jsx("span",{className:"bg-[#233648] text-white text-xs px-2 py-1 rounded border border-border-dark",children:"Pool 1"})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3 flex-1 content-start",children:[[0,1,2,3,4,5,6,7].map(w=>e.jsxs("div",{className:`aspect-square border rounded flex flex-col items-center justify-center ${w===5?"bg-[#332a18] border-yellow-700/50":"bg-[#1a2e22] border-emerald-800"}`,children:[w===5?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-yellow-500 animate-pulse"}),e.jsx(Eh,{className:"text-yellow-500",size:20})]}):e.jsx(Ul,{className:"text-emerald-500",size:20}),e.jsxs("span",{className:`text-[10px] font-mono mt-1 ${w===5?"text-yellow-500":"text-emerald-500"}`,children:["da",w]})]},w)),[8,9,10,11].map(w=>e.jsx("div",{className:"aspect-square bg-[#161f29] border border-border-dark border-dashed rounded flex flex-col items-center justify-center opacity-50",children:e.jsx("span",{className:"text-[10px] text-text-secondary font-mono",children:"Empty"})},w))]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-border-dark",children:[e.jsxs("div",{className:"flex justify-between text-sm text-text-secondary",children:[e.jsx("span",{children:"Total Capacity"}),e.jsx("span",{className:"text-white font-bold",children:fr(l?.storage?.total_capacity_bytes||0)})]}),e.jsx("div",{className:"w-full bg-[#233648] h-2 rounded-full mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full transition-all",style:{width:`${l?.storage?.total_capacity_bytes?l.storage.used_capacity_bytes/l.storage.total_capacity_bytes*100:0}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-text-secondary mt-1",children:[e.jsxs("span",{children:["Used: ",fr(l?.storage?.used_capacity_bytes||0)]}),e.jsxs("span",{children:["Free: ",fr((l?.storage?.total_capacity_bytes||0)-(l?.storage?.used_capacity_bytes||0))]})]})]})]})})]}),e.jsxs("div",{className:"bg-card-dark border border-border-dark rounded-xl shadow-sm overflow-hidden flex flex-col h-[400px]",children:[e.jsxs("div",{className:"flex border-b border-border-dark bg-[#161f29]",children:[e.jsxs("button",{onClick:()=>t("jobs"),className:`px-6 py-4 text-sm font-bold flex items-center transition-colors ${r==="jobs"?"text-primary border-b-2 border-primary bg-card-dark":"text-text-secondary hover:text-white"}`,children:["Active Jobs"," ",e.jsx("span",{className:"ml-2 bg-primary/20 text-primary px-1.5 py-0.5 rounded text-xs",children:Qv.length})]}),e.jsx("button",{onClick:()=>t("logs"),className:`px-6 py-4 text-sm transition-colors ${r==="logs"?"text-primary border-b-2 border-primary bg-card-dark font-bold":"text-text-secondary hover:text-white font-medium"}`,children:"System Logs"}),e.jsx("button",{onClick:()=>t("alerts"),className:`px-6 py-4 text-sm transition-colors ${r==="alerts"?"text-primary border-b-2 border-primary bg-card-dark font-bold":"text-text-secondary hover:text-white font-medium"}`,children:"Alerts History"}),e.jsx("div",{className:"flex-1 flex justify-end items-center px-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(io,{className:"absolute left-2 top-1.5 text-text-secondary",size:18}),e.jsx("input",{className:"bg-[#111a22] border border-border-dark rounded-md py-1 pl-8 pr-3 text-sm text-white focus:outline-none focus:border-primary w-48 transition-all",placeholder:"Search logs...",type:"text",value:s,onChange:w=>n(w.target.value)})]})})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[r==="jobs"&&e.jsx("div",{className:"p-0 overflow-y-auto custom-scrollbar",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{className:"bg-[#1a2632] text-xs uppercase text-text-secondary font-medium sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Job Name"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Type"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark w-1/3",children:"Progress"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Speed"}),e.jsx("th",{className:"px-6 py-3 border-b border-border-dark",children:"Status"})]})}),e.jsx("tbody",{className:"text-sm divide-y divide-border-dark",children:Qv.map(w=>e.jsxs("tr",{className:"group hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 font-medium text-white",children:w.name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:w.type}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-full bg-[#111a22] rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full rounded-full relative overflow-hidden",style:{width:`${w.progress}%`},children:e.jsx("div",{className:"absolute inset-0 bg-white/20 animate-pulse"})})}),e.jsxs("span",{className:"text-xs font-mono text-white",children:[w.progress,"%"]})]}),w.eta&&e.jsxs("p",{className:"text-[10px] text-text-secondary mt-1",children:["ETA: ",w.eta]})]}),e.jsx("td",{className:"px-6 py-4 text-text-secondary font-mono",children:w.speed}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-primary/20 text-primary",children:"Running"})})]},w.id))})]})}),r==="logs"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-6 py-2 bg-[#161f29] border-y border-border-dark flex items-center justify-between",children:[e.jsx("h4",{className:"text-xs uppercase text-text-secondary font-bold tracking-wider",children:"Recent System Events"}),e.jsx("button",{className:"text-xs text-primary hover:text-white transition-colors",children:"View All Logs"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar bg-[#111a22]",children:e.jsx("table",{className:"w-full text-left border-collapse",children:e.jsx("tbody",{className:"text-sm font-mono divide-y divide-border-dark/50",children:u?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-4 text-center text-text-secondary",children:"Loading logs..."})}):B.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-4 text-center text-text-secondary",children:"No logs found"})}):B.map((w,L)=>e.jsxs("tr",{className:"group hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-2 text-text-secondary w-32 whitespace-nowrap",children:new Date(w.time).toLocaleTimeString()}),e.jsx("td",{className:"px-6 py-2 w-24",children:e.jsx("span",{className:g(w.level),children:w.level})}),e.jsx("td",{className:"px-6 py-2 w-32 text-white",children:w.source}),e.jsx("td",{className:"px-6 py-2 text-text-secondary truncate max-w-lg",children:w.message})]},L))})})})]}),r==="alerts"&&e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar bg-[#111a22] p-6",children:x?.alerts&&x.alerts.length>0?e.jsx("div",{className:"space-y-3",children:x.alerts.map(w=>e.jsx("div",{className:"bg-[#1a2632] border border-border-dark rounded-lg p-4 hover:bg-[#233648] transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[w.severity==="critical"?e.jsx(_l,{className:"text-red-500 mt-1",size:20}):w.severity==="warning"?e.jsx(Eh,{className:"text-yellow-500 mt-1",size:20}):e.jsx(a4,{className:"text-blue-500 mt-1",size:20}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-white font-medium",children:w.title}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:w.message}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:new Date(w.created_at).toLocaleString()})]})]}),e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${w.severity==="critical"?"bg-red-500/20 text-red-400":w.severity==="warning"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:w.severity.toUpperCase()})]})},w.id))}):e.jsx("div",{className:"text-center text-text-secondary py-8",children:"No alerts"})})]})]})]})})]})}const Ea={listBuckets:async()=>(await ze.get("/object-storage/buckets")).data.buckets||[],getBucket:async r=>(await ze.get(`/object-storage/buckets/${encodeURIComponent(r)}`)).data,createBucket:async r=>{await ze.post("/object-storage/buckets",{name:r})},deleteBucket:async r=>{await ze.delete(`/object-storage/buckets/${encodeURIComponent(r)}`)},getAvailableDatasets:async()=>(await ze.get("/object-storage/setup/datasets")).data.pools||[],getCurrentSetup:async()=>{const r=await ze.get("/object-storage/setup/current");return!r.data.configured||!r.data.setup?null:{dataset_path:r.data.setup.dataset_path,mount_point:r.data.setup.mount_point}},setupObjectStorage:async(r,t,s)=>(await ze.post("/object-storage/setup",{pool_name:r,dataset_name:t,create_new:s})).data,updateObjectStorage:async(r,t,s)=>(await ze.put("/object-storage/setup",{pool_name:r,dataset_name:t,create_new:s})).data,listUsers:async()=>(await ze.get("/object-storage/users")).data.users||[],createUser:async r=>{await ze.post("/object-storage/users",r)},deleteUser:async r=>{await ze.delete(`/object-storage/users/${encodeURIComponent(r)}`)},listServiceAccounts:async()=>(await ze.get("/object-storage/service-accounts")).data.service_accounts||[],createServiceAccount:async r=>(await ze.post("/object-storage/service-accounts",r)).data,deleteServiceAccount:async r=>{await ze.delete(`/object-storage/service-accounts/${encodeURIComponent(r)}`)},listObjects:async(r,t)=>{const s=t?`?prefix=${encodeURIComponent(t)}`:"";return(await ze.get(`/object-storage/buckets/${encodeURIComponent(r)}/objects${s}`)).data.objects||[]}};function c_({S3_ENDPOINT:r}){const[t,s]=Ce.useState("users"),[n,o]=Ce.useState(!1),[l,d]=Ce.useState(""),[c,u]=Ce.useState(""),[h,m]=Ce.useState(!1),[x,y]=Ce.useState(""),[p,v]=Ce.useState(""),[N,B]=Ce.useState(""),[g,j]=Ce.useState(null),[_,w]=Ce.useState(!1),[L,K]=Ce.useState(null),[M,V]=Ce.useState(null),[T,ne]=Ce.useState(!1),[Z,U]=Ce.useState(!1),q=Nr(),{data:F=[],isLoading:le}=dt({queryKey:["object-storage-users"],queryFn:Ea.listUsers,refetchInterval:1e4}),{data:ae=[],isLoading:se}=dt({queryKey:["object-storage-service-accounts"],queryFn:Ea.listServiceAccounts,refetchInterval:1e4}),fe=ft({mutationFn:J=>Ea.createUser(J),onMutate:async J=>{await q.cancelQueries({queryKey:["object-storage-users"]});const O=q.getQueryData(["object-storage-users"]);return q.setQueryData(["object-storage-users"],(H=[])=>{const re={access_key:J.access_key,status:"enabled",created_at:new Date().toISOString()};return[...H,re]}),o(!1),d(""),u(""),{previousUsers:O}},onError:(J,O,H)=>{H?.previousUsers&&q.setQueryData(["object-storage-users"],H.previousUsers),o(!0),alert(J.response?.data?.error||"Failed to create user")},onSuccess:()=>{q.invalidateQueries({queryKey:["object-storage-users"]}),alert("User created successfully!")},onSettled:()=>{q.invalidateQueries({queryKey:["object-storage-users"]})}}),ye=ft({mutationFn:J=>Ea.deleteUser(J),onMutate:async J=>{await q.cancelQueries({queryKey:["object-storage-users"]});const O=q.getQueryData(["object-storage-users"]);return q.setQueryData(["object-storage-users"],(H=[])=>H.filter(re=>re.access_key!==J)),{previousUsers:O}},onError:(J,O,H)=>{H?.previousUsers&&q.setQueryData(["object-storage-users"],H.previousUsers),alert(J.response?.data?.error||"Failed to delete user")},onSuccess:()=>{q.invalidateQueries({queryKey:["object-storage-users"]})},onSettled:()=>{q.invalidateQueries({queryKey:["object-storage-users"]})}}),_e=ft({mutationFn:J=>Ea.createServiceAccount(J),onMutate:async J=>{await q.cancelQueries({queryKey:["object-storage-service-accounts"]});const O=q.getQueryData(["object-storage-service-accounts"]);return m(!1),y(""),v(""),B(""),{previousAccounts:O}},onError:(J,O,H)=>{H?.previousAccounts&&q.setQueryData(["object-storage-service-accounts"],H.previousAccounts),m(!0),alert(J.response?.data?.error||"Failed to create access key")},onSuccess:J=>{q.setQueryData(["object-storage-service-accounts"],(O=[])=>[...O,J]),j(J),q.invalidateQueries({queryKey:["object-storage-service-accounts"]})},onSettled:()=>{q.invalidateQueries({queryKey:["object-storage-service-accounts"]})}}),xe=ft({mutationFn:J=>Ea.deleteServiceAccount(J),onMutate:async J=>{await q.cancelQueries({queryKey:["object-storage-service-accounts"]});const O=q.getQueryData(["object-storage-service-accounts"]);return q.setQueryData(["object-storage-service-accounts"],(H=[])=>H.filter(re=>re.access_key!==J)),{previousAccounts:O}},onError:(J,O,H)=>{H?.previousAccounts&&q.setQueryData(["object-storage-service-accounts"],H.previousAccounts),alert(J.response?.data?.error||"Failed to delete access key")},onSuccess:()=>{q.invalidateQueries({queryKey:["object-storage-service-accounts"]})},onSettled:()=>{q.invalidateQueries({queryKey:["object-storage-service-accounts"]})}}),D=async()=>{ne(!0);try{await q.invalidateQueries({queryKey:["object-storage-users"]}),await q.refetchQueries({queryKey:["object-storage-users"]}),setTimeout(()=>{alert("Users refreshed successfully!")},300)}catch{alert("Failed to refresh users")}finally{ne(!1)}},$=async()=>{U(!0);try{await q.invalidateQueries({queryKey:["object-storage-service-accounts"]}),await q.refetchQueries({queryKey:["object-storage-service-accounts"]}),setTimeout(()=>{alert("Access keys refreshed successfully!")},300)}catch{alert("Failed to refresh access keys")}finally{U(!1)}},X=J=>new Date(J).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),te=async(J,O)=>{try{await navigator.clipboard.writeText(J),alert(`${O} copied to clipboard!`)}catch(H){console.error("Failed to copy:",H);const re=document.createElement("textarea");re.value=J,re.style.position="fixed",re.style.left="-999999px",document.body.appendChild(re),re.select();try{document.execCommand("copy"),alert(`${O} copied to clipboard!`)}catch{alert(`Failed to copy. ${O}: ${J}`)}document.body.removeChild(re)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border-dark",children:[e.jsx("button",{onClick:()=>s("users"),className:`px-4 py-2 text-sm font-medium transition-colors ${t==="users"?"text-primary border-b-2 border-primary":"text-text-secondary hover:text-white"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vd,{size:18}),e.jsxs("span",{children:["Users (",F.length,")"]})]})}),e.jsx("button",{onClick:()=>s("keys"),className:`px-4 py-2 text-sm font-medium transition-colors ${t==="keys"?"text-primary border-b-2 border-primary":"text-text-secondary hover:text-white"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wx,{size:18}),e.jsxs("span",{children:["Access Keys (",ae.length,")"]})]})})]}),t==="users"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"IAM Users"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage MinIO IAM users for accessing object storage"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:T,className:"px-4 py-2 bg-[#233648] hover:bg-[#2b4055] text-white text-sm font-medium rounded-lg border border-border-dark transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[e.jsx(Cn,{size:16,className:T?"animate-spin":""}),T?"Refreshing...":"Refresh"]}),e.jsxs("button",{onClick:()=>o(!0),className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2",children:[e.jsx(mp,{size:16}),"Create User"]})]})]}),le?e.jsx("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:e.jsx("p",{className:"text-text-secondary text-sm",children:"Loading users..."})}):F.length===0?e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:[e.jsx(Vd,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm mb-4",children:"No users found"}),e.jsx("button",{onClick:()=>o(!0),className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors",children:"Create First User"})]}):e.jsx("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#16202a] border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Access Key"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:F.map(J=>e.jsxs("tr",{className:"hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vd,{size:16,className:"text-primary"}),e.jsx("span",{className:"text-white font-mono text-sm",children:J.access_key})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${J.status==="enabled"?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-red-500/10 text-red-500 border border-red-500/20"}`,children:J.status==="enabled"?e.jsxs(e.Fragment,{children:[e.jsx(su,{size:12,className:"mr-1"}),"Enabled"]}):"Disabled"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-text-secondary text-sm",children:X(J.created_at)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs("button",{onClick:async()=>{await te(J.access_key,"Access Key")},className:"px-3 py-1.5 text-xs font-medium text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors flex items-center gap-1.5",title:"Copy Access Key",children:[e.jsx(so,{size:14}),"Copy"]}),e.jsxs("button",{onClick:()=>K(J.access_key),disabled:ye.isPending,className:"px-3 py-1.5 text-xs font-medium text-red-400 bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed",title:"Delete User",children:[e.jsx(es,{size:14}),"Delete"]})]})})]},J.access_key))})]})})})]}),t==="keys"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Access Keys"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1",children:"Manage service account access keys for programmatic access"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:$,disabled:Z,className:"px-4 py-2 bg-[#233648] hover:bg-[#2b4055] text-white text-sm font-medium rounded-lg border border-border-dark transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[e.jsx(Cn,{size:16,className:Z?"animate-spin":""}),Z?"Refreshing...":"Refresh"]}),e.jsxs("button",{onClick:()=>{if(F.length===0){alert("Please create at least one user before creating access keys"),s("users");return}m(!0)},className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2",children:[e.jsx(Q6,{size:16}),"Create Access Key"]})]})]}),se?e.jsx("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:e.jsx("p",{className:"text-text-secondary text-sm",children:"Loading access keys..."})}):ae.length===0?e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:[e.jsx(Wx,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm mb-4",children:"No access keys found"}),e.jsx("button",{onClick:()=>{if(F.length===0){alert("Please create at least one user before creating access keys"),s("users");return}m(!0)},className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors",children:"Create First Access Key"})]}):e.jsx("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#16202a] border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Access Key"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Parent User"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Expiration"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:ae.map(J=>e.jsxs("tr",{className:"hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wx,{size:16,className:"text-primary"}),e.jsx("span",{className:"text-white font-mono text-sm",children:J.access_key})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-text-secondary text-sm",children:J.parent_user}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-text-secondary text-sm",children:J.expiration?X(J.expiration):"Never"}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-text-secondary text-sm",children:X(J.created_at)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs("button",{onClick:async()=>{await te(J.access_key,"Access Key")},className:"px-3 py-1.5 text-xs font-medium text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors flex items-center gap-1.5",title:"Copy Access Key",children:[e.jsx(so,{size:14}),"Copy"]}),e.jsxs("button",{onClick:()=>V(J.access_key),disabled:xe.isPending,className:"px-3 py-1.5 text-xs font-medium text-red-400 bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed",title:"Delete Access Key",children:[e.jsx(es,{size:14}),"Delete"]})]})})]},J.access_key))})]})})})]}),n&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Create IAM User"}),e.jsx("button",{onClick:()=>{o(!1),d(""),u("")},className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Access Key"}),e.jsx("input",{type:"text",value:l,onChange:J=>d(J.target.value),placeholder:"e.g., myuser",className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:ring-1 focus:ring-primary focus:border-primary outline-none font-mono",autoFocus:!0}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"Access key must be unique and follow MinIO naming conventions"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Secret Key"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:_?"text":"password",value:c,onChange:J=>u(J.target.value),placeholder:"Enter secret key",className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 pr-10 text-white text-sm focus:ring-1 focus:ring-primary focus:border-primary outline-none font-mono"}),e.jsx("button",{type:"button",onClick:()=>w(!_),className:"absolute right-3 top-1/2 -translate-y-1/2 text-text-secondary hover:text-white",children:_?e.jsx(bv,{size:18}):e.jsx(Db,{size:18})})]}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"Secret key must be at least 8 characters long"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>{o(!1),d(""),u("")},className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{if(!l.trim()){alert("Please enter an access key");return}if(!c.trim()||c.length<8){alert("Please enter a secret key (minimum 8 characters)");return}fe.mutate({access_key:l.trim(),secret_key:c})},disabled:fe.isPending||!l.trim()||!c.trim(),className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:fe.isPending?"Creating...":"Create User"})]})]})]})}),h&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Create Access Key"}),e.jsx("button",{onClick:()=>{m(!1),y(""),v(""),B("")},className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Parent User"}),e.jsxs("select",{value:x,onChange:J=>y(J.target.value),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:ring-1 focus:ring-primary focus:border-primary outline-none",autoFocus:!0,children:[e.jsx("option",{value:"",children:"-- Select User --"}),F.map(J=>e.jsx("option",{value:J.access_key,children:J.access_key},J.access_key))]}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"Select the IAM user this access key will belong to"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Policy (Optional)"}),e.jsx("textarea",{value:p,onChange:J=>v(J.target.value),placeholder:'{"Version":"2012-10-17","Statement":[...]}',rows:4,className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:ring-1 focus:ring-primary focus:border-primary outline-none font-mono"}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"JSON policy document (leave empty for default permissions)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Expiration (Optional)"}),e.jsx("input",{type:"datetime-local",value:N,onChange:J=>B(J.target.value),className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm focus:ring-1 focus:ring-primary focus:border-primary outline-none"}),e.jsx("p",{className:"text-text-secondary text-xs mt-2",children:"Leave empty for no expiration"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>{m(!1),y(""),v(""),B("")},className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{if(!x.trim()){alert("Please select a parent user");return}_e.mutate({parent_user:x.trim(),policy:p.trim()||void 0,expiration:N?new Date(N).toISOString():void 0})},disabled:_e.isPending||!x.trim(),className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:_e.isPending?"Creating...":"Create Access Key"})]})]})]})}),L&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg",children:e.jsx(_l,{className:"text-red-400",size:24})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-lg font-bold",children:"Delete User"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"This action cannot be undone"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("p",{className:"text-white text-sm mb-2",children:["Are you sure you want to delete user ",e.jsx("span",{className:"font-mono font-semibold text-primary",children:L}),"?"]}),e.jsx("p",{className:"text-text-secondary text-xs",children:"All access keys associated with this user will also be deleted. This action cannot be undone."})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:()=>K(null),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:()=>{ye.mutate(L),K(null)},disabled:ye.isPending,className:"px-4 py-2 bg-red-500 hover:bg-red-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[e.jsx(es,{size:16}),ye.isPending?"Deleting...":"Delete User"]})]})]})}),M&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg",children:e.jsx(_l,{className:"text-red-400",size:24})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-white text-lg font-bold",children:"Delete Access Key"}),e.jsx("p",{className:"text-text-secondary text-sm",children:"This action cannot be undone"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("p",{className:"text-white text-sm mb-2",children:["Are you sure you want to delete access key ",e.jsx("span",{className:"font-mono font-semibold text-primary",children:M}),"?"]}),e.jsx("p",{className:"text-text-secondary text-xs",children:"Applications using this access key will lose access immediately. This action cannot be undone."})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:()=>V(null),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:()=>{xe.mutate(M),V(null)},disabled:xe.isPending,className:"px-4 py-2 bg-red-500 hover:bg-red-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[e.jsx(es,{size:16}),xe.isPending?"Deleting...":"Delete Key"]})]})]})}),g&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-lg w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Access Key Created"}),e.jsx("button",{onClick:()=>{j(null),w(!1)},className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-orange-500/10 border border-orange-500/20 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_l,{className:"text-orange-400 mt-0.5",size:20}),e.jsxs("div",{children:[e.jsx("p",{className:"text-orange-400 text-sm font-medium mb-1",children:"Important"}),e.jsx("p",{className:"text-orange-300 text-xs",children:"Save these credentials now. The secret key will not be shown again."})]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Access Key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:g.access_key,readOnly:!0,className:"flex-1 bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm font-mono"}),e.jsx("button",{onClick:()=>te(g.access_key,"Access Key"),className:"px-3 py-2 bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg text-white text-sm transition-colors",children:e.jsx(so,{size:16})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Secret Key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("input",{type:_?"text":"password",value:g.secret_key||"",readOnly:!0,className:"w-full bg-[#233648] border border-border-dark rounded-lg px-4 py-2 pr-10 text-white text-sm font-mono"}),e.jsx("button",{type:"button",onClick:()=>w(!_),className:"absolute right-3 top-1/2 -translate-y-1/2 text-text-secondary hover:text-white",children:_?e.jsx(bv,{size:18}):e.jsx(Db,{size:18})})]}),e.jsx("button",{onClick:()=>te(g.secret_key||"","Secret Key"),className:"px-3 py-2 bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg text-white text-sm transition-colors",children:e.jsx(so,{size:16})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-white text-sm font-medium mb-2",children:"Endpoint"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:r,readOnly:!0,className:"flex-1 bg-[#233648] border border-border-dark rounded-lg px-4 py-2 text-white text-sm font-mono"}),e.jsx("button",{onClick:()=>te(r,"Endpoint"),className:"px-3 py-2 bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg text-white text-sm transition-colors",children:e.jsx(so,{size:16})})]})]}),e.jsx("div",{className:"flex gap-3 justify-end pt-4",children:e.jsx("button",{onClick:()=>{j(null),w(!1)},className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors",children:"I've Saved These Credentials"})})]})]})})]})}const d_=9e3;function u_(){const[r,t]=Ce.useState("buckets"),[s,n]=Ce.useState(""),[o,l]=Ce.useState(1),[d,c]=Ce.useState(!1),[u,h]=Ce.useState(""),[m,x]=Ce.useState(""),[y,p]=Ce.useState(!1),[v,N]=Ce.useState(""),[B,g]=Ce.useState(!1),[j,_]=Ce.useState(!1),[w,L]=Ce.useState(""),[K,M]=Ce.useState(null),V=10,T=Nr(),{data:ne="localhost"}=dt({queryKey:["system-management-ip"],queryFn:ao.getManagementIPAddress,staleTime:300*1e3,retry:2}),Z=`http://${ne}:${d_}`,{data:U=[],isLoading:q}=dt({queryKey:["object-storage-buckets"],queryFn:Ea.listBuckets,refetchInterval:5e3,staleTime:0}),{data:F=[]}=dt({queryKey:["object-storage-setup-datasets"],queryFn:Ea.getAvailableDatasets,enabled:d}),{data:le}=dt({queryKey:["object-storage-current-setup"],queryFn:Ea.getCurrentSetup}),ae=ft({mutationFn:({poolName:re,datasetName:Ae,createNew:oe})=>le?Ea.updateObjectStorage(re,Ae,oe):Ea.setupObjectStorage(re,Ae,oe),onSuccess:re=>{T.invalidateQueries({queryKey:["object-storage-current-setup"]}),T.invalidateQueries({queryKey:["object-storage-buckets"]}),c(!1),alert(le?`Object storage dataset updated successfully! + +${re.message} + +⚠️ IMPORTANT: Existing data in the previous dataset is NOT automatically migrated. You may need to manually migrate data or restart MinIO service to use the new dataset.`:"Object storage setup completed successfully!")},onError:re=>{alert(re.response?.data?.error||`Failed to ${le?"update":"setup"} object storage`)}}),se=ft({mutationFn:re=>Ea.createBucket(re),onMutate:async re=>{await T.cancelQueries({queryKey:["object-storage-buckets"]});const Ae=T.getQueryData(["object-storage-buckets"]);return T.setQueryData(["object-storage-buckets"],(oe=[])=>{const ce={name:re,creation_date:new Date().toISOString(),size:0,objects:0,access_policy:"private"};return[...oe,ce]}),_(!1),L(""),{previousBuckets:Ae}},onError:(re,Ae,oe)=>{oe?.previousBuckets&&T.setQueryData(["object-storage-buckets"],oe.previousBuckets),_(!0),alert(re.response?.data?.error||"Failed to create bucket")},onSuccess:()=>{T.invalidateQueries({queryKey:["object-storage-buckets"]}),alert("Bucket created successfully!")},onSettled:()=>{T.invalidateQueries({queryKey:["object-storage-buckets"]})}}),fe=ft({mutationFn:re=>Ea.deleteBucket(re),onSuccess:()=>{T.invalidateQueries({queryKey:["object-storage-buckets"]}),M(null),alert("Bucket deleted successfully!")},onError:re=>{alert(re.response?.data?.error||"Failed to delete bucket")}}),ye=U.map(re=>({...re,usage:re.size||0,objects:re.objects||0,accessPolicy:re.access_policy||"private"})),_e=ye.filter(re=>re.name.toLowerCase().includes(s.toLowerCase())),xe=Math.ceil(_e.length/V),D=_e.slice((o-1)*V,o*V),$=ye.reduce((re,Ae)=>re+Ae.usage,0),X=ye.reduce((re,Ae)=>re+Ae.objects,0),te=re=>re.accessPolicy==="public-read"||re.accessPolicy==="public-read-write"?e.jsx(u4,{className:"text-orange-500",size:20}):e.jsx(h4,{className:"text-purple-500",size:20}),J=re=>re==="public-read-write"?e.jsx("span",{className:"inline-flex items-center rounded-full bg-red-500/10 px-2.5 py-0.5 text-xs font-medium text-red-500 border border-red-500/20",children:"Public Read/Write"}):re==="public-read"?e.jsx("span",{className:"inline-flex items-center rounded-full bg-orange-500/10 px-2.5 py-0.5 text-xs font-medium text-orange-500 border border-orange-500/20",children:"Public Read"}):e.jsx("span",{className:"inline-flex items-center rounded-full bg-green-500/10 px-2.5 py-0.5 text-xs font-medium text-green-500 border border-green-500/20",children:"Private"}),O=re=>new Date(re).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),H=async(re,Ae)=>{try{await navigator.clipboard.writeText(re),alert(`${Ae} copied to clipboard!`)}catch(oe){console.error(`Failed to copy ${Ae}:`,oe);const ce=document.createElement("textarea");ce.value=re,ce.style.position="fixed",ce.style.left="-999999px",document.body.appendChild(ce),ce.select();try{document.execCommand("copy"),alert(`${Ae} copied to clipboard!`)}catch{alert(`Failed to copy. ${Ae}: ${re}`)}document.body.removeChild(ce)}};return e.jsxs("div",{className:"flex flex-col h-full bg-[#0f1720]",children:[e.jsx("main",{className:"flex-1 flex flex-col overflow-y-auto relative scroll-smooth",children:e.jsxs("div",{className:"flex flex-col max-w-[1200px] w-full mx-auto p-6 md:p-8 lg:p-12 gap-8",children:[e.jsxs("div",{className:"flex flex-wrap justify-between items-start gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h1",{className:"text-white tracking-tight text-[32px] font-bold leading-tight",children:"Object Storage Service"}),e.jsx("p",{className:"text-text-secondary text-sm font-normal max-w-xl",children:"Manage S3-compatible buckets, configure access policies, and monitor real-time object storage performance."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:async()=>{g(!0);try{await T.invalidateQueries({queryKey:["object-storage-buckets"]}),await T.refetchQueries({queryKey:["object-storage-buckets"]}),await new Promise(re=>setTimeout(re,300)),alert("Buckets refreshed successfully!")}catch(re){console.error("Failed to refresh buckets:",re),alert("Failed to refresh buckets. Please try again.")}finally{g(!1)}},disabled:q||B,className:"flex h-10 items-center justify-center rounded-lg border border-border-dark px-4 text-white text-sm font-medium hover:bg-[#233648] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Refresh buckets list",children:[e.jsx(Cn,{className:`mr-2 ${B?"animate-spin":""}`,size:20}),B?"Refreshing...":"Refresh Buckets"]}),le?e.jsxs("button",{onClick:()=>c(!0),className:"flex h-10 items-center justify-center rounded-lg bg-orange-500 px-4 text-white text-sm font-medium hover:bg-orange-600 transition-colors",children:[e.jsx(vc,{className:"mr-2",size:20}),"Change Dataset"]}):e.jsxs("button",{onClick:()=>c(!0),className:"flex h-10 items-center justify-center rounded-lg bg-primary px-4 text-white text-sm font-medium hover:bg-blue-600 transition-colors",children:[e.jsx(Ks,{className:"mr-2",size:20}),"Setup Object Storage"]}),e.jsxs("button",{className:"flex h-10 items-center justify-center rounded-lg border border-border-dark px-4 text-white text-sm font-medium hover:bg-[#233648] transition-colors",children:[e.jsx(A4,{className:"mr-2",size:20}),"Documentation"]}),e.jsxs("button",{className:"flex h-10 items-center justify-center rounded-lg bg-[#233648] px-4 text-white text-sm font-medium hover:bg-[#2b4055] transition-colors border border-border-dark",children:[e.jsx(vc,{className:"mr-2",size:20}),"Config"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-5 border border-border-dark bg-[#1c2936]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Service Status"}),e.jsx(su,{className:"text-[#0bda5b]",size:20})]}),e.jsx("p",{className:"text-white tracking-tight text-2xl font-bold",children:"Running"}),e.jsx("p",{className:"text-text-secondary text-xs",children:"Port 9000 (TLS Enabled)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-5 border border-border-dark bg-[#1c2936]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Total Usage"}),e.jsx(Ul,{className:"text-primary",size:20})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-white tracking-tight text-2xl font-bold",children:fr($,1)}),e.jsx("p",{className:"text-[#0bda5b] text-sm font-medium",children:"+2.1%"})]}),e.jsx("div",{className:"w-full bg-[#233648] rounded-full h-1.5 mt-1",children:e.jsx("div",{className:"bg-primary h-1.5 rounded-full",style:{width:"45%"}})})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-5 border border-border-dark bg-[#1c2936]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Object Count"}),e.jsx(_y,{className:"text-blue-400",size:20})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("p",{className:"text-white tracking-tight text-2xl font-bold",children:[(X/1e6).toFixed(1),"M"]}),e.jsx("p",{className:"text-[#0bda5b] text-sm font-medium",children:"+0.5%"})]}),e.jsx("p",{className:"text-text-secondary text-xs",children:"Total objects across all buckets"})]}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-5 border border-border-dark bg-[#1c2936]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-text-secondary text-sm font-medium",children:"Uptime"}),e.jsx(Ec,{className:"text-green-400",size:20})]}),e.jsx("p",{className:"text-white tracking-tight text-2xl font-bold",children:"99.9%"}),e.jsx("p",{className:"text-text-secondary text-xs",children:"Last 30 days"})]})]}),e.jsx("div",{className:"border-b border-border-dark",children:e.jsxs("div",{className:"flex gap-8 px-2",children:[e.jsxs("button",{onClick:()=>t("buckets"),className:`flex items-center gap-2 border-b-2 pb-3 pt-2 transition-colors ${r==="buckets"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx(c4,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Buckets"})]}),e.jsxs("button",{onClick:()=>t("browse"),className:`flex items-center gap-2 border-b-2 pb-3 pt-2 transition-colors ${r==="browse"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx(au,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Browse"})]}),e.jsxs("button",{onClick:()=>t("users"),className:`flex items-center gap-2 border-b-2 pb-3 pt-2 transition-colors ${r==="users"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx(Vd,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Users & Keys"})]}),e.jsxs("button",{onClick:()=>t("monitoring"),className:`flex items-center gap-2 border-b-2 pb-3 pt-2 transition-colors ${r==="monitoring"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx(Wm,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Monitoring"})]}),e.jsxs("button",{onClick:()=>t("settings"),className:`flex items-center gap-2 border-b-2 pb-3 pt-2 transition-colors ${r==="settings"?"border-primary text-white":"border-transparent text-text-secondary hover:text-white"}`,children:[e.jsx(fp,{size:20}),e.jsx("span",{className:"text-sm font-bold",children:"Settings"})]})]})}),r==="browse"&&e.jsx(h_,{S3_ENDPOINT:Z}),r==="buckets"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(io,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-text-secondary",size:18}),e.jsx("input",{type:"text",placeholder:"Filter buckets...",value:s,onChange:re=>{n(re.target.value),l(1)},className:"w-full pl-10 pr-4 py-2 bg-[#1c2936] border border-border-dark rounded-lg text-white placeholder-text-secondary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"})]}),e.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-2 px-4 py-2 bg-primary text-white rounded-lg hover:bg-blue-600 transition-colors font-medium",children:[e.jsx(Ks,{size:18}),"Create Bucket"]})]}),e.jsxs("div",{className:"rounded-lg border border-border-dark bg-[#1c2936] overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#233648] border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Usage"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Objects"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Access Policy"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:q?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-8 text-center text-text-secondary",children:"Loading buckets..."})}):D.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-6 py-8 text-center text-text-secondary",children:s?"No buckets found matching your search.":"No buckets yet. Create your first bucket to get started."})}):D.map(re=>e.jsxs("tr",{className:"hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[te(re),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-white font-medium",children:re.name}),e.jsx("span",{className:"text-text-secondary text-xs",children:"standard"})]})]})}),e.jsx("td",{className:"px-6 py-4 text-white",children:fr(re.usage,1)}),e.jsx("td",{className:"px-6 py-4 text-white",children:re.objects}),e.jsx("td",{className:"px-6 py-4",children:J(re.accessPolicy)}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:O(re.creation_date)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs("button",{onClick:()=>H(re.name,"Bucket Name"),className:"px-3 py-1.5 text-xs font-medium text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors flex items-center gap-1.5",title:"Copy Bucket Name",children:[e.jsx(so,{size:14}),"Copy Name"]}),e.jsxs("button",{onClick:()=>H(`${Z}/${re.name}`,"Bucket Endpoint"),className:"px-3 py-1.5 text-xs font-medium text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors flex items-center gap-1.5",title:"Copy Bucket Endpoint",children:[e.jsx(d4,{size:14}),"Copy Endpoint"]}),e.jsxs("button",{onClick:()=>M(re.name),disabled:fe.isPending,className:"px-3 py-1.5 text-xs font-medium text-red-400 hover:bg-red-500/10 border border-red-500/20 rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-50",title:"Delete Bucket",children:[e.jsx(es,{size:14}),fe.isPending?"Deleting...":"Delete"]})]})})]},re.name))})]})}),xe>1&&e.jsxs("div",{className:"px-6 py-4 border-t border-border-dark flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm text-text-secondary",children:["Showing ",(o-1)*V+1," to ",Math.min(o*V,_e.length)," of ",_e.length," buckets"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>l(re=>Math.max(1,re-1)),disabled:o===1,className:"px-3 py-1.5 text-sm text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),e.jsx("button",{onClick:()=>l(re=>Math.min(xe,re+1)),disabled:o===xe,className:"px-3 py-1.5 text-sm text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]})]})}),r==="users"&&e.jsx(c_,{S3_ENDPOINT:Z}),r==="monitoring"&&e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:[e.jsx(Wm,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Monitoring dashboard coming soon"})]}),r==="settings"&&e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-8 text-center",children:[e.jsx(vc,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Settings configuration coming soon"})]})]})}),j&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Create New Bucket"}),e.jsx("button",{onClick:()=>{_(!1),L("")},className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Bucket Name"}),e.jsx("input",{type:"text",value:w,onChange:re=>L(re.target.value),placeholder:"Enter bucket name",className:"w-full px-4 py-2 bg-[#233648] border border-border-dark rounded-lg text-white placeholder-text-secondary focus:outline-none focus:ring-2 focus:ring-primary",onKeyDown:re=>{re.key==="Enter"&&w.trim()&&se.mutate(w.trim())}}),e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:"Bucket names must be unique and follow S3 naming conventions"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>{_(!1),L("")},className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{w.trim()&&se.mutate(w.trim())},disabled:!w.trim()||se.isPending,className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:se.isPending?"Creating...":"Create Bucket"})]})]})]})}),K&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Confirm Delete Bucket"}),e.jsx("button",{onClick:()=>M(null),className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_l,{className:"text-red-400 mt-0.5",size:20}),e.jsxs("div",{children:[e.jsx("p",{className:"text-red-400 text-sm font-medium mb-1",children:"Warning"}),e.jsxs("p",{className:"text-red-300 text-xs",children:['This action cannot be undone. All objects within the bucket "',K,'" will be permanently deleted.']})]})]})}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>M(null),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{fe.mutate(K),M(null)},disabled:fe.isPending,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:fe.isPending?"Deleting...":"Delete Bucket"})]})]})]})}),d&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#1c2936] border border-border-dark rounded-lg p-6 max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:le?"Change Object Storage Dataset":"Setup Object Storage"}),e.jsx("button",{onClick:()=>c(!1),className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Select Pool"}),e.jsxs("select",{value:u,onChange:re=>{h(re.target.value),x("")},className:"w-full px-4 py-2 bg-[#233648] border border-border-dark rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-primary",children:[e.jsx("option",{value:"",children:"Select a pool..."}),F.map(re=>e.jsx("option",{value:re.pool_id,children:re.pool_name},re.pool_id))]})]}),u&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Select Dataset"}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",checked:!y,onChange:()=>{p(!1),N("")},className:"text-primary"}),e.jsx("span",{className:"text-white text-sm",children:"Use existing dataset"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",checked:y,onChange:()=>p(!0),className:"text-primary"}),e.jsx("span",{className:"text-white text-sm",children:"Create new dataset"})]})]}),y?e.jsx("input",{type:"text",value:v,onChange:re=>N(re.target.value),placeholder:"Enter new dataset name",className:"w-full px-4 py-2 bg-[#233648] border border-border-dark rounded-lg text-white placeholder-text-secondary focus:outline-none focus:ring-2 focus:ring-primary"}):e.jsxs("select",{value:m,onChange:re=>x(re.target.value),className:"w-full px-4 py-2 bg-[#233648] border border-border-dark rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-primary",children:[e.jsx("option",{value:"",children:"Select a dataset..."}),F.find(re=>re.pool_id===u)?.datasets.map(re=>e.jsxs("option",{value:re.name,children:[re.name," ",re.mount_point&&`(${re.mount_point})`]},re.id))]})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>c(!1),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-border-dark hover:bg-[#233648] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{const re=F.find(oe=>oe.pool_id===u);if(!re)return;const Ae=y?v:m;if(!Ae.trim()){alert("Please select or enter a dataset name");return}ae.mutate({poolName:re.pool_name,datasetName:Ae.trim(),createNew:y})},disabled:!u||!y&&!m||y&&!v.trim()||ae.isPending,className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:ae.isPending?"Setting up...":le?"Update Configuration":"Setup Object Storage"})]})]})]})})]})}function h_({S3_ENDPOINT:r}){const[t,s]=Ce.useState(null),[n,o]=Ce.useState(""),l=Nr(),{data:d=[]}=dt({queryKey:["object-storage-buckets"],queryFn:Ea.listBuckets,refetchInterval:5e3,staleTime:0}),{data:c=[],isLoading:u}=dt({queryKey:["object-storage-objects",t,n],queryFn:()=>t?Ea.listObjects(t,n||void 0):Promise.resolve([]),enabled:!!t,refetchInterval:5e3,staleTime:0}),h=v=>{o(v)},m=()=>{if(!n){s(null);return}const v=n.split("/").filter(N=>N);v.length>0?(v.pop(),o(v.length>0?v.join("/")+"/":"")):o("")},x=()=>{const v=[{name:t||"",path:""}];if(n){const N=n.split("/").filter(g=>g);let B="";N.forEach(g=>{B+=g+"/",v.push({name:g,path:B})})}return v},y=v=>v?new Date(v).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"-";if(!t)return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h2",{className:"text-white text-xl font-semibold",children:"Select a Bucket to Browse"})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(v=>e.jsxs("button",{onClick:()=>s(v.name),className:"flex flex-col gap-3 p-6 rounded-lg border border-border-dark bg-[#1c2936] hover:bg-[#233648] transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(au,{className:"text-primary",size:24}),e.jsx("span",{className:"text-white font-medium",children:v.name})]}),v.access_policy==="public-read"||v.access_policy==="public-read-write"?e.jsx(u4,{className:"text-orange-500",size:18}):e.jsx(h4,{className:"text-purple-500",size:18})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-text-secondary",children:fr(v.size,1)}),e.jsxs("span",{className:"text-text-secondary",children:[v.objects," objects"]})]})]},v.name))}),d.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(au,{className:"mx-auto text-text-secondary mb-4",size:48}),e.jsx("p",{className:"text-text-secondary",children:"No buckets available"})]})]});const p=x();return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{s(null),o("")},className:"flex items-center gap-2 px-3 py-1.5 text-sm text-text-secondary hover:text-white transition-colors rounded-lg hover:bg-[#233648]",children:[e.jsx(wc,{size:16}),"Back to Buckets"]}),e.jsx(Ka,{className:"text-text-secondary",size:16}),p.map((v,N)=>e.jsxs("div",{className:"flex items-center gap-2",children:[N>0&&e.jsx(Ka,{className:"text-text-secondary",size:16}),e.jsx("button",{onClick:()=>{o(N===0?"":v.path)},className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${N===p.length-1?"text-white bg-[#233648]":"text-text-secondary hover:text-white hover:bg-[#233648]"}`,children:v.name||"root"})]},N))]}),e.jsxs("button",{onClick:()=>{l.invalidateQueries({queryKey:["object-storage-objects",t,n]})},className:"flex items-center gap-2 px-4 py-2 text-sm text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors",children:[e.jsx(Cn,{size:16}),"Refresh"]})]}),e.jsx("div",{className:"rounded-lg border border-border-dark bg-[#1c2936] overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#233648] border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Name"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Size"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Last Modified"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-secondary uppercase tracking-wider",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-border-dark",children:[n&&e.jsxs("tr",{className:"hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("button",{onClick:m,className:"flex items-center gap-2 text-white hover:text-primary transition-colors",children:[e.jsx(wc,{size:16}),e.jsx("span",{children:".."})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:"-"}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:"-"}),e.jsx("td",{className:"px-6 py-4"})]}),u?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-8 text-center text-text-secondary",children:"Loading..."})}):c.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-8 text-center text-text-secondary",children:n?"This folder is empty":"This bucket is empty"})}):c.map(v=>e.jsxs("tr",{className:"hover:bg-[#233648] transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:v.is_dir?e.jsxs("button",{onClick:()=>h(v.key),className:"flex items-center gap-2 text-white hover:text-primary transition-colors",children:[e.jsx(c4,{className:"text-primary",size:18}),e.jsx("span",{children:v.name})]}):e.jsxs("div",{className:"flex items-center gap-2 text-white",children:[e.jsx(L6,{className:"text-text-secondary",size:18}),e.jsx("span",{children:v.name})]})}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:v.is_dir?"-":fr(v.size,1)}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:y(v.last_modified)}),e.jsx("td",{className:"px-6 py-4 text-right",children:!v.is_dir&&e.jsx("div",{className:"flex items-center justify-end gap-2",children:e.jsxs("button",{onClick:()=>{const N=`${r}/${t}/${v.key}`;f_(N,"Object URL")},className:"px-3 py-1.5 text-xs font-medium text-white bg-[#233648] hover:bg-[#2b4055] border border-border-dark rounded-lg transition-colors flex items-center gap-1.5",title:"Copy URL",children:[e.jsx(d4,{size:14}),"Copy URL"]})})})]},v.key))]})]})})})]})}function f_(r,t){navigator.clipboard.writeText(r).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{alert(`Failed to copy. ${t}: ${r}`)})}function m_(){const[r,t]=Ce.useState("snapshots"),[s,n]=Ce.useState(""),[o,l]=Ce.useState(1),[d,c]=Ce.useState(!1),[u,h]=Ce.useState(!1),[m,x]=Ce.useState(!1),[y,p]=Ce.useState(null),[v,N]=Ce.useState({dataset:"",name:"",recursive:!1}),[B,g]=Ce.useState({name:"",dataset:"",snapshot_name_template:"auto-%Y-%m-%d-%H%M",schedule_type:"daily",schedule_config:{time:"00:00"},recursive:!1}),[j,_]=Ce.useState(""),[w,L]=Ce.useState(null),[K,M]=Ce.useState(null),V=10,T=Nr(),[ne,Z]=Ce.useState({name:"",direction:"outbound",source_dataset:"",target_host:"",target_port:22,target_user:"root",target_dataset:"",source_host:"",source_port:22,source_user:"root",local_dataset:"",schedule_type:"daily",schedule_config:{time:"00:00"},compression:"lz4",recursive:!1,incremental:!0,auto_snapshot:!0,encryption:!1,enabled:!0}),[U,q]=Ce.useState(null),{data:F=[]}=dt({queryKey:["replication-pools"],queryFn:sn.listPools}),{data:le=[],isLoading:ae,refetch:se}=dt({queryKey:["snapshots",j],queryFn:()=>$u.listSnapshots(j||void 0),refetchInterval:5e3,staleTime:0}),{data:fe=[],isLoading:ye,refetch:_e}=dt({queryKey:["snapshot-schedules"],queryFn:eh.listSchedules,refetchInterval:5e3,staleTime:0}),{data:xe=[],isLoading:D,refetch:$}=dt({queryKey:["replication-tasks"],queryFn:()=>th.listTasks(),refetchInterval:5e3,staleTime:0}),X=xe.filter(k=>k.direction==="outbound"),te=xe.filter(k=>k.direction==="inbound"),[J,O]=Ce.useState([]),H=async k=>{try{const G=F.find(Ue=>Ue.name===k||Ue.id===k);if(!G||J.find(Ue=>Ue.pool===k||Ue.pool===G.id||Ue.pool===G.name))return;const be=await sn.listDatasets(G.id);O(Ue=>[...Ue.filter(He=>He.pool!==k&&He.pool!==G.id&&He.pool!==G.name),{pool:G.name,datasets:be}])}catch(G){console.error("Failed to fetch datasets:",G)}},re=async()=>{if(F.length!==0)for(const k of F)try{if(J.find(be=>be.pool===k.name||be.pool===k.id))continue;const me=await sn.listDatasets(k.id);O(be=>[...be.filter(Re=>Re.pool!==k.name&&Re.pool!==k.id),{pool:k.name,datasets:me}])}catch(G){console.error(`Failed to fetch datasets for pool ${k.name}:`,G)}};Ce.useEffect(()=>{u&&F.length>0&&re()},[u,F.length]),Ce.useEffect(()=>{m&&F.length>0&&re()},[m,F.length]),Ce.useEffect(()=>{y?g({name:y.name,dataset:y.dataset,snapshot_name_template:y.snapshot_name_template,schedule_type:y.schedule_type,schedule_config:y.schedule_config,recursive:y.recursive,retention_count:y.retention_count,retention_days:y.retention_days}):m||g({name:"",dataset:"",snapshot_name_template:"auto-%Y-%m-%d-%H%M",schedule_type:"daily",schedule_config:{time:"00:00"},recursive:!1})},[y,m]);const Ae=ft({mutationFn:k=>$u.createSnapshot(k),onSuccess:async()=>{h(!1),N({dataset:"",name:"",recursive:!1}),await T.invalidateQueries({queryKey:["snapshots"]}),await se(),alert("Snapshot created successfully!")},onError:k=>{alert(k.response?.data?.error||"Failed to create snapshot")}}),oe=ft({mutationFn:({name:k,recursive:G})=>$u.deleteSnapshot(k,G),onSuccess:()=>{T.invalidateQueries({queryKey:["snapshots"]}),L(null),alert("Snapshot deleted successfully!")},onError:k=>{alert(k.response?.data?.error||"Failed to delete snapshot")}}),ce=ft({mutationFn:({name:k,force:G})=>$u.rollbackSnapshot(k,G),onSuccess:()=>{T.invalidateQueries({queryKey:["snapshots"]}),M(null),alert("Snapshot rollback completed successfully!")},onError:k=>{alert(k.response?.data?.error||"Failed to rollback snapshot")}}),Se=le.filter(k=>k.name.toLowerCase().includes(s.toLowerCase())||k.dataset.toLowerCase().includes(s.toLowerCase())||k.snapshot_name.toLowerCase().includes(s.toLowerCase())),z=Math.ceil(Se.length/V),ie=Se.slice((o-1)*V,o*V),W=le.length,Q=le.reduce((k,G)=>k+G.referenced,0),I=k=>new Date(k).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"});return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col bg-background-dark",children:[e.jsxs("header",{className:"flex items-center justify-between px-8 py-5 border-b border-[#233648] bg-background-dark shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ba,{to:"/storage",className:"text-text-secondary hover:text-white text-sm font-medium transition-colors",children:"Storage"}),e.jsx(Ka,{className:"text-[#536b85]",size:16}),e.jsx(ba,{to:"/storage",className:"text-text-secondary hover:text-white text-sm font-medium transition-colors",children:"Pools"}),e.jsx(Ka,{className:"text-[#536b85]",size:16}),e.jsx("span",{className:"text-white text-sm font-bold bg-[#1e2936] px-2 py-1 rounded",children:"Data Protection"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("button",{className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-[#1e2936] text-text-secondary transition-colors relative",children:[e.jsx(_l,{size:20}),e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 bg-red-500 rounded-full border border-background-dark"})]}),e.jsx("button",{className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-[#1e2936] text-text-secondary transition-colors",children:e.jsx(pp,{size:20})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-8 custom-scrollbar",children:e.jsxs("div",{className:"mx-auto max-w-[1200px] flex flex-col gap-8",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h1",{className:"text-white text-3xl font-extrabold tracking-tight",children:"Snapshots & Replication"}),e.jsx("p",{className:"text-text-secondary text-base font-normal max-w-2xl",children:"Manage local ZFS snapshots and configure remote replication tasks to ensure data redundancy and disaster recovery."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{className:"px-4 py-2 bg-[#1e2936] hover:bg-[#2a3b4d] text-white text-sm font-bold rounded-lg border border-[#324d67] transition-all flex items-center gap-2",children:[e.jsx(hp,{size:18}),"View Logs"]}),e.jsxs("button",{onClick:()=>{r==="replication"?c(!0):r==="schedules"?(p(null),x(!0)):h(!0)},className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-bold rounded-lg shadow-[0_4px_12px_rgba(19,127,236,0.3)] transition-all flex items-center gap-2",children:[e.jsx(Ks,{size:18}),r==="replication"?"Create Replication":r==="schedules"?"Create Schedule":"Create Snapshot"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-[#18232e] border border-[#2a3b4d] relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Tm,{className:"text-6xl text-primary"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Total Snapshots"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:W.toLocaleString()}),e.jsxs("span",{className:"text-emerald-400 text-sm font-medium mb-1 flex items-center",children:[e.jsx(T6,{size:14,className:"mr-0.5"}),"+12 today"]})]}),e.jsxs("p",{className:"text-[#536b85] text-xs font-medium mt-1",children:[fr(Q,1)," Reclaimable Space"]})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-[#18232e] border border-[#2a3b4d] relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Cn,{className:"text-6xl text-emerald-500"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Last Replication"}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:"Success"})}),e.jsx("p",{className:"text-[#536b85] text-xs font-medium mt-1",children:"15 mins ago • tank/backup"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-5 bg-[#18232e] border border-[#2a3b4d] relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Ec,{className:"text-6xl text-purple-500"})}),e.jsx("p",{className:"text-text-secondary text-sm font-medium uppercase tracking-wider",children:"Next Scheduled"}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx("p",{className:"text-white text-3xl font-bold tracking-tight",children:"10:00 PM"})}),e.jsx("p",{className:"text-[#536b85] text-xs font-medium mt-1",children:"Daily Offsite Backup"})]})]}),e.jsxs("div",{className:"flex flex-col bg-[#18232e] border border-[#2a3b4d] rounded-xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"flex border-b border-[#2a3b4d] bg-[#151f29]",children:[e.jsxs("button",{onClick:()=>t("snapshots"),className:`px-6 py-4 text-sm font-bold flex items-center gap-2 transition-colors ${r==="snapshots"?"text-white border-b-2 border-primary bg-[#18232e]":"text-text-secondary hover:text-white border-b-2 border-transparent hover:bg-[#18232e]"}`,children:[e.jsx(Tm,{size:20}),"Snapshots"]}),e.jsxs("button",{onClick:()=>t("schedules"),className:`px-6 py-4 text-sm font-bold flex items-center gap-2 transition-colors ${r==="schedules"?"text-white border-b-2 border-primary bg-[#18232e]":"text-text-secondary hover:text-white border-b-2 border-transparent hover:bg-[#18232e]"}`,children:[e.jsx(Ec,{size:20}),"Schedules",fe.length>0&&e.jsx("span",{className:"ml-1 bg-[#2a3b4d] text-white text-[10px] px-1.5 py-0.5 rounded-full",children:fe.length})]}),e.jsxs("button",{onClick:()=>t("replication"),className:`px-6 py-4 text-sm font-bold flex items-center gap-2 transition-colors ${r==="replication"?"text-white border-b-2 border-primary bg-[#18232e]":"text-text-secondary hover:text-white border-b-2 border-transparent hover:bg-[#18232e]"}`,children:[e.jsx(Xx,{size:20}),"Replication Tasks",xe.length>0&&e.jsx("span",{className:"ml-1 bg-[#2a3b4d] text-white text-[10px] px-1.5 py-0.5 rounded-full",children:xe.length})]}),e.jsxs("button",{onClick:()=>t("restore"),className:`px-6 py-4 text-sm font-bold flex items-center gap-2 transition-colors ${r==="restore"?"text-white border-b-2 border-primary bg-[#18232e]":"text-text-secondary hover:text-white border-b-2 border-transparent hover:bg-[#18232e]"}`,children:[e.jsx(Im,{size:20}),"Restore Points"]})]}),e.jsxs("div",{className:"p-4 flex flex-col sm:flex-row gap-4 justify-between items-center border-b border-[#2a3b4d] bg-[#18232e]",children:[e.jsxs("div",{className:"relative w-full sm:w-96 group",children:[e.jsx(io,{className:"absolute left-3 top-2.5 text-[#536b85] group-focus-within:text-primary transition-colors",size:20}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] text-white text-sm rounded-lg pl-10 pr-4 py-2.5 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-[#536b85]",placeholder:"Search snapshot name or dataset...",type:"text",value:s,onChange:k=>n(k.target.value)})]}),e.jsxs("div",{className:"flex gap-3 w-full sm:w-auto",children:[e.jsx("div",{className:"relative group",children:e.jsxs("select",{className:"flex items-center gap-2 px-4 py-2.5 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-sm font-medium text-text-secondary hover:text-white hover:border-[#536b85] transition-all appearance-none cursor-pointer",value:j,onChange:k=>{_(k.target.value),l(1)},children:[e.jsx("option",{value:"",children:"Dataset: All"}),Array.from(new Set(le.map(k=>k.dataset))).map(k=>e.jsx("option",{value:k,children:k},k))]})}),e.jsx("div",{className:"relative group",children:e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2.5 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-sm font-medium text-text-secondary hover:text-white hover:border-[#536b85] transition-all",children:[e.jsx(l4,{size:18}),"Date Range"]})})]})]}),r==="snapshots"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{className:"bg-[#151f29] text-text-secondary",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] w-[50px]",children:e.jsx("input",{className:"w-4 h-4 rounded border-[#324d67] bg-[#111a22] text-primary focus:ring-offset-[#111a22]",type:"checkbox"})}),e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] text-xs font-bold uppercase tracking-wider",children:"Snapshot Name"}),e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] text-xs font-bold uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] text-xs font-bold uppercase tracking-wider",children:"Created"}),e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] text-xs font-bold uppercase tracking-wider",children:"Referenced"}),e.jsx("th",{className:"p-4 border-b border-[#2a3b4d] text-xs font-bold uppercase tracking-wider text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"text-sm",children:ae?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-8 text-center text-text-secondary",children:"Loading snapshots..."})}):ie.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-8 text-center text-text-secondary",children:s?"No snapshots found matching your search.":"No snapshots yet. Create your first snapshot to get started."})}):ie.map(k=>e.jsxs("tr",{className:"group hover:bg-[#1e2936] transition-colors border-b border-[#2a3b4d]",children:[e.jsx("td",{className:"p-4",children:e.jsx("input",{className:"w-4 h-4 rounded border-[#324d67] bg-[#111a22] text-primary focus:ring-offset-[#111a22]",type:"checkbox"})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Tm,{className:"text-[#536b85]",size:20}),e.jsx("span",{className:"text-white font-medium",children:k.snapshot_name}),k.is_latest&&e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold bg-primary/20 text-primary border border-primary/20",children:"LATEST"})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-text-secondary",children:k.dataset})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-text-secondary",children:I(k.created)})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-white font-mono",children:fr(k.referenced)})}),e.jsx("td",{className:"p-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>M(k.name),className:"p-1.5 hover:bg-[#2a3b4d] rounded text-text-secondary hover:text-white",title:"Rollback",children:e.jsx(Im,{size:20})}),e.jsx("button",{onClick:()=>{const G=prompt(`Enter clone dataset name for ${k.snapshot_name}:`);G&&$u.cloneSnapshot(k.name,{clone_name:G}).then(()=>{T.invalidateQueries({queryKey:["snapshots"]}),alert("Snapshot cloned successfully!")}).catch(me=>{alert(me.response?.data?.error||"Failed to clone snapshot")})},className:"p-1.5 hover:bg-[#2a3b4d] rounded text-text-secondary hover:text-white",title:"Clone",children:e.jsx(so,{size:20})}),e.jsx("button",{onClick:()=>L(k.name),className:"p-1.5 hover:bg-red-500/20 rounded text-text-secondary hover:text-red-500",title:"Delete",children:e.jsx(es,{size:20})})]})})]},k.id))})]})}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#18232e]",children:[e.jsxs("p",{className:"text-text-secondary text-sm",children:["Showing ",e.jsxs("span",{className:"text-white font-bold",children:["1-",ie.length]})," of"," ",e.jsx("span",{className:"text-white font-bold",children:Se.length})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>l(k=>Math.max(1,k-1)),disabled:o===1,className:"px-3 py-1 text-sm rounded border border-[#2a3b4d] text-text-secondary hover:bg-[#2a3b4d] hover:text-white disabled:opacity-50",children:"Previous"}),Array.from({length:Math.min(3,z)},(k,G)=>G+1).map(k=>e.jsx("button",{onClick:()=>l(k),className:`px-3 py-1 text-sm rounded border border-[#2a3b4d] ${o===k?"text-white bg-[#2a3b4d]":"text-text-secondary hover:bg-[#2a3b4d] hover:text-white"}`,children:k},k)),z>3&&e.jsx("span",{className:"text-text-secondary",children:"..."}),e.jsx("button",{onClick:()=>l(k=>Math.min(z,k+1)),disabled:o===z,className:"px-3 py-1 text-sm rounded border border-[#2a3b4d] text-text-secondary hover:bg-[#2a3b4d] hover:text-white disabled:opacity-50",children:"Next"})]})]})]}),r==="schedules"&&e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Snapshot Schedules"}),e.jsxs("button",{onClick:()=>{p(null),x(!0)},className:"flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-bold rounded-lg transition-colors",children:[e.jsx(Ks,{size:18}),"Create Schedule"]})]}),ye?e.jsx("div",{className:"text-center py-8 text-text-secondary",children:"Loading schedules..."}):fe.length===0?e.jsx("div",{className:"text-center py-8 text-text-secondary",children:"No schedules configured. Create your first schedule to automate snapshot creation."}):e.jsx("div",{className:"space-y-3",children:fe.map(k=>e.jsxs("div",{className:"flex items-center gap-4 bg-[#111a22] p-4 rounded-lg border border-[#2a3b4d] hover:bg-[#1e2936] transition-colors",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k.enabled?"bg-emerald-500":"bg-gray-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:k.name}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold bg-[#2a3b4d] text-text-secondary",children:k.schedule_type})]}),e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Dataset: ",k.dataset," • Template: ",k.snapshot_name_template]}),k.next_run_at&&e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Next run: ",new Date(k.next_run_at).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:async()=>{try{await eh.toggleSchedule(k.id,!k.enabled),await T.invalidateQueries({queryKey:["snapshot-schedules"]}),await _e(),alert(`Schedule ${k.enabled?"disabled":"enabled"} successfully`)}catch(G){alert(G.response?.data?.error||"Failed to toggle schedule")}},className:`px-3 py-1 text-xs font-medium rounded transition-colors ${k.enabled?"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/30":"bg-gray-500/20 text-gray-400 hover:bg-gray-500/30"}`,children:k.enabled?"Enabled":"Disabled"}),e.jsxs("button",{onClick:()=>{p(k),x(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 hover:bg-[#2a3b4d] rounded text-text-secondary hover:text-white transition-colors border border-[#2a3b4d] hover:border-primary",title:"Edit Schedule",children:[e.jsx(Wd,{size:16}),e.jsx("span",{className:"text-xs font-medium",children:"Edit"})]}),e.jsx("button",{onClick:async()=>{if(confirm(`Delete schedule "${k.name}"?`))try{await eh.deleteSchedule(k.id),await T.invalidateQueries({queryKey:["snapshot-schedules"]}),await _e(),alert("Schedule deleted successfully")}catch(G){alert(G.response?.data?.error||"Failed to delete schedule")}},className:"p-1.5 hover:bg-red-500/20 rounded text-text-secondary hover:text-red-500 transition-colors",title:"Delete Schedule",children:e.jsx(es,{size:18})})]})]},k.id))})]}),r==="replication"&&e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-white text-lg font-bold",children:"Replication Tasks"}),e.jsxs("button",{onClick:()=>{q(null),Z({name:"",direction:"outbound",source_dataset:"",target_host:"",target_port:22,target_user:"root",target_dataset:"",source_host:"",source_port:22,source_user:"root",local_dataset:"",schedule_type:"daily",schedule_config:{time:"00:00"},compression:"lz4",recursive:!1,incremental:!0,auto_snapshot:!0,encryption:!1,enabled:!0}),c(!0)},className:"flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-bold rounded-lg transition-colors",children:[e.jsx(Ks,{size:18}),"Create Replication"]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Xx,{size:20,className:"text-primary"}),e.jsx("h4",{className:"text-white text-base font-bold",children:"Outbound Replication"}),e.jsx("span",{className:"text-text-secondary text-sm",children:"(Sending to remote)"})]}),D?e.jsx("div",{className:"text-center py-8 text-text-secondary",children:"Loading replication tasks..."}):X.length===0?e.jsx("div",{className:"text-center py-8 text-text-secondary bg-[#111a22] rounded-lg border border-[#2a3b4d]",children:"No outbound replication tasks configured."}):e.jsx("div",{className:"space-y-3",children:X.map(k=>e.jsxs("div",{className:"flex items-center gap-4 bg-[#111a22] p-4 rounded-lg border border-[#2a3b4d] hover:bg-[#1e2936] transition-colors",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k.status==="running"?"bg-primary animate-pulse":k.status==="failed"?"bg-red-500":"bg-emerald-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:k.name}),!k.enabled&&e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold bg-gray-500/20 text-gray-400",children:"Disabled"})]}),e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Source: ",k.source_dataset," → Target: ",k.target_host,":",k.target_port," (",k.target_dataset,")"]}),k.last_run_at&&e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Last run: ",new Date(k.last_run_at).toLocaleString(),k.last_run_status&&e.jsxs("span",{className:`ml-2 ${k.last_run_status==="success"?"text-emerald-400":"text-red-400"}`,children:["(",k.last_run_status,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{q(k),Z({name:k.name,direction:k.direction,source_dataset:k.source_dataset,target_host:k.target_host,target_port:k.target_port,target_user:k.target_user,target_dataset:k.target_dataset,source_host:k.source_host,source_port:k.source_port,source_user:k.source_user,local_dataset:k.local_dataset,schedule_type:k.schedule_type,schedule_config:k.schedule_config,compression:k.compression,recursive:k.recursive,incremental:k.incremental,auto_snapshot:k.auto_snapshot,encryption:k.encryption,enabled:k.enabled}),c(!0)},className:"p-1.5 hover:bg-[#2a3b4d] rounded text-text-secondary hover:text-white transition-colors",title:"Edit",children:e.jsx(Wd,{size:18})}),e.jsx("button",{onClick:async()=>{if(confirm(`Delete replication task "${k.name}"?`))try{await th.deleteTask(k.id),await T.invalidateQueries({queryKey:["replication-tasks"]}),await $(),alert("Replication task deleted successfully")}catch(G){alert(G.response?.data?.error||"Failed to delete replication task")}},className:"p-1.5 hover:bg-red-500/20 rounded text-text-secondary hover:text-red-500 transition-colors",title:"Delete",children:e.jsx(es,{size:18})})]})]},k.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Xx,{size:20,className:"text-emerald-500"}),e.jsx("h4",{className:"text-white text-base font-bold",children:"Inbound Replication"}),e.jsx("span",{className:"text-text-secondary text-sm",children:"(Receiving from remote)"})]}),D?e.jsx("div",{className:"text-center py-8 text-text-secondary",children:"Loading replication tasks..."}):te.length===0?e.jsx("div",{className:"text-center py-8 text-text-secondary bg-[#111a22] rounded-lg border border-[#2a3b4d]",children:"No inbound replication tasks configured."}):e.jsx("div",{className:"space-y-3",children:te.map(k=>e.jsxs("div",{className:"flex items-center gap-4 bg-[#111a22] p-4 rounded-lg border border-[#2a3b4d] hover:bg-[#1e2936] transition-colors",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k.status==="running"?"bg-primary animate-pulse":k.status==="failed"?"bg-red-500":"bg-emerald-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:k.name}),!k.enabled&&e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold bg-gray-500/20 text-gray-400",children:"Disabled"})]}),e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Source: ",k.source_host,":",k.source_port," (",k.source_dataset,") → Local: ",k.local_dataset]}),k.last_run_at&&e.jsxs("p",{className:"text-[#536b85] text-xs mt-1",children:["Last run: ",new Date(k.last_run_at).toLocaleString(),k.last_run_status&&e.jsxs("span",{className:`ml-2 ${k.last_run_status==="success"?"text-emerald-400":"text-red-400"}`,children:["(",k.last_run_status,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{q(k),Z({name:k.name,direction:k.direction,source_dataset:k.source_dataset,target_host:k.target_host,target_port:k.target_port,target_user:k.target_user,target_dataset:k.target_dataset,source_host:k.source_host,source_port:k.source_port,source_user:k.source_user,local_dataset:k.local_dataset,schedule_type:k.schedule_type,schedule_config:k.schedule_config,compression:k.compression,recursive:k.recursive,incremental:k.incremental,auto_snapshot:k.auto_snapshot,encryption:k.encryption,enabled:k.enabled}),c(!0)},className:"p-1.5 hover:bg-[#2a3b4d] rounded text-text-secondary hover:text-white transition-colors",title:"Edit",children:e.jsx(Wd,{size:18})}),e.jsx("button",{onClick:async()=>{if(confirm(`Delete replication task "${k.name}"?`))try{await th.deleteTask(k.id),await T.invalidateQueries({queryKey:["replication-tasks"]}),await $(),alert("Replication task deleted successfully")}catch(G){alert(G.response?.data?.error||"Failed to delete replication task")}},className:"p-1.5 hover:bg-red-500/20 rounded text-text-secondary hover:text-red-500 transition-colors",title:"Delete",children:e.jsx(es,{size:18})})]})]},k.id))})]})]}),r==="restore"&&e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(Im,{className:"mx-auto mb-4 text-text-secondary",size:48}),e.jsx("p",{className:"text-text-secondary text-sm",children:"Restore points coming soon"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#18232e] border border-[#2a3b4d] rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-white font-bold text-lg",children:"Replication Status"}),e.jsx("a",{className:"text-primary text-sm font-bold hover:underline",href:"#",children:"Manage All"})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[xe.slice(0,3).map(k=>e.jsxs("div",{className:"flex items-center gap-4 bg-[#111a22] p-3 rounded-lg border border-[#2a3b4d]",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k.status==="running"?"bg-primary animate-pulse":k.status==="failed"?"bg-red-500":"bg-emerald-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:k.name}),e.jsx("p",{className:"text-[#536b85] text-xs",children:k.direction==="outbound"?`Target: ${k.target_host}:${k.target_port}`:`Source: ${k.source_host}:${k.source_port}`})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:`text-sm ${k.status==="running"?"text-primary font-bold":"text-text-secondary"}`,children:k.status==="running"?"Running":k.status}),k.last_run_at&&e.jsx("p",{className:"text-[#536b85] text-xs",children:new Date(k.last_run_at).toLocaleString()})]})]},k.id)),xe.length===0&&e.jsx("p",{className:"text-text-secondary text-sm text-center py-4",children:"No replication tasks"})]})]}),e.jsxs("div",{className:"bg-[#18232e] border border-[#2a3b4d] rounded-xl p-6 flex flex-col justify-center items-center text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-3",children:e.jsx(_l,{className:"text-primary text-2xl"})}),e.jsx("h3",{className:"text-white font-bold text-lg",children:"Snapshot Retention"}),e.jsx("p",{className:"text-text-secondary text-sm mt-1 mb-4",children:"You have 14 snapshots marked for expiration in the next 24 hours."}),e.jsx("button",{className:"text-white bg-[#2a3b4d] hover:bg-[#324d67] px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:"Review Expiration Policy"})]})]})]})}),d&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>c(!1),children:e.jsxs("div",{className:"bg-[#18232e] rounded-xl border border-[#2a3b4d] max-w-2xl w-full max-h-[90vh] overflow-y-auto",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-[#2a3b4d] flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:U?"Edit Replication Task":"Create Replication Task"}),e.jsx("button",{onClick:()=>{c(!1),q(null),Z({name:"",direction:"outbound",source_dataset:"",target_host:"",target_port:22,target_user:"root",target_dataset:"",source_host:"",source_port:22,source_user:"root",local_dataset:"",schedule_type:"daily",schedule_config:{time:"00:00"},compression:"lz4",recursive:!1,incremental:!0,auto_snapshot:!0,encryption:!1,enabled:!0})},className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Task Name"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none",type:"text",placeholder:"Daily Offsite Backup",value:ne.name,onChange:k=>Z({...ne,name:k.target.value})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Direction"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none appearance-none",value:ne.direction,onChange:k=>Z({...ne,direction:k.target.value}),children:[e.jsx("option",{value:"outbound",children:"Outbound (Sending to remote)"}),e.jsx("option",{value:"inbound",children:"Inbound (Receiving from remote)"})]})]}),ne.direction==="outbound"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Source Dataset"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none appearance-none",value:ne.source_dataset||"",onChange:k=>{Z({...ne,source_dataset:k.target.value||void 0});const G=k.target.value.split("/")[0];G&&H(G)},children:[e.jsx("option",{value:"",children:"Select a dataset"}),F.map(k=>e.jsx("optgroup",{label:k.name,children:J.find(G=>G.pool===k.name)?.datasets.filter(G=>G.type==="filesystem").map(G=>e.jsx("option",{value:G.name,children:G.name},G.id))},k.id))]})]})}),ne.direction==="inbound"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Source Host"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"text",placeholder:"192.168.20.5",value:ne.source_host||"",onChange:k=>Z({...ne,source_host:k.target.value||void 0})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Source Dataset (on remote)"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"text",placeholder:"tank/backup",value:ne.source_dataset||"",onChange:k=>Z({...ne,source_dataset:k.target.value||void 0})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Local Dataset"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none appearance-none",value:ne.local_dataset||"",onChange:k=>{Z({...ne,local_dataset:k.target.value||void 0});const G=k.target.value.split("/")[0];G&&H(G)},children:[e.jsx("option",{value:"",children:"Select a dataset"}),F.map(k=>e.jsx("optgroup",{label:k.name,children:J.find(G=>G.pool===k.name)?.datasets.filter(G=>G.type==="filesystem").map(G=>e.jsx("option",{value:G.name,children:G.name},G.id))},k.id))]})]})]}),ne.direction==="outbound"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Target Host"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"text",placeholder:"192.168.20.5",value:ne.target_host||"",onChange:k=>Z({...ne,target_host:k.target.value||void 0})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"SSH Port"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"number",placeholder:"22",value:ne.target_port||22,onChange:k=>Z({...ne,target_port:parseInt(k.target.value)||22})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Target User"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none",type:"text",placeholder:"root",value:ne.target_user||"root",onChange:k=>Z({...ne,target_user:k.target.value||void 0})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Target Dataset"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"text",placeholder:"tank/backup",value:ne.target_dataset||"",onChange:k=>Z({...ne,target_dataset:k.target.value||void 0})})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Schedule"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none appearance-none",value:ne.schedule_type||"daily",onChange:k=>Z({...ne,schedule_type:k.target.value||void 0}),children:[e.jsx("option",{value:"hourly",children:"Hourly"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"cron",children:"Custom (Cron)"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Time"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none font-mono",type:"time",value:ne.schedule_config?.time||"00:00",onChange:k=>Z({...ne,schedule_config:{...ne.schedule_config,time:k.target.value}})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Compression"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none appearance-none",value:ne.compression,onChange:k=>Z({...ne,compression:k.target.value}),children:[e.jsx("option",{value:"off",children:"Off"}),e.jsx("option",{value:"lz4",children:"LZ4 (Fast)"}),e.jsx("option",{value:"gzip",children:"GZIP"}),e.jsx("option",{value:"zstd",children:"ZSTD"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:ne.recursive,onChange:k=>Z({...ne,recursive:k.target.checked}),className:"rounded border-[#324d67] bg-[#111a22] text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Recursive (include child datasets)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:ne.auto_snapshot||!1,onChange:k=>Z({...ne,auto_snapshot:k.target.checked}),className:"rounded border-[#324d67] bg-[#111a22] text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Auto-create snapshot before replication"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:ne.encryption,onChange:k=>Z({...ne,encryption:k.target.checked}),className:"rounded border-[#324d67] bg-[#111a22] text-primary focus:ring-primary h-4 w-4"}),e.jsx("span",{className:"text-sm text-white",children:"Enable encryption (SSH tunnel)"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t border-[#2a3b4d]",children:[e.jsx(ct,{onClick:()=>c(!1),variant:"outline",className:"px-4 h-10 border-[#2a3b4d] text-white hover:bg-[#2a3b4d]",children:"Cancel"}),e.jsxs(ct,{onClick:async()=>{try{U?(await th.updateTask(U.id,ne),alert("Replication task updated successfully!")):(await th.createTask(ne),alert("Replication task created successfully!")),await T.invalidateQueries({queryKey:["replication-tasks"]}),await $(),c(!1),q(null),Z({name:"",direction:"outbound",source_dataset:"",target_host:"",target_port:22,target_user:"root",target_dataset:"",source_host:"",source_port:22,source_user:"root",local_dataset:"",schedule_type:"daily",schedule_config:{time:"00:00"},compression:"lz4",recursive:!1,incremental:!0,auto_snapshot:!0,encryption:!1,enabled:!0})}catch(k){alert(k.response?.data?.error||"Failed to save replication task")}},className:"px-4 h-10 bg-primary hover:bg-blue-600",children:[e.jsx(up,{size:18,className:"mr-2"}),U?"Update Replication":"Create Replication"]})]})]})]})}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>{h(!1),N({dataset:"",name:"",recursive:!1})},children:e.jsxs("div",{className:"bg-[#18232e] rounded-xl border border-[#2a3b4d] max-w-lg w-full",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-[#2a3b4d] flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Create Snapshot"}),e.jsx("button",{onClick:()=>{h(!1),N({dataset:"",name:"",recursive:!1})},className:"text-text-secondary hover:text-white",children:e.jsx(Zs,{size:20})})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Dataset"}),e.jsxs("select",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:v.dataset,onChange:k=>{N({...v,dataset:k.target.value})},onFocus:()=>{J.length===0&&re()},children:[e.jsx("option",{value:"",children:"Select a dataset"}),F.map(k=>{const G=J.find(me=>me.pool===k.name||me.pool===k.id);return!G||G.datasets.length===0?e.jsx("optgroup",{label:k.name,children:e.jsx("option",{value:"",disabled:!0,children:"Loading datasets..."})},k.id):e.jsx("optgroup",{label:k.name,children:G.datasets.filter(me=>me.type==="filesystem").map(me=>e.jsx("option",{value:me.name,children:me.name},me.id))},k.id)})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-semibold text-white",children:"Snapshot Name"}),e.jsx("input",{className:"w-full bg-[#111a22] border border-[#2a3b4d] rounded-lg px-3 py-2 text-sm text-white focus:border-primary focus:ring-1 focus:ring-primary outline-none",type:"text",placeholder:"manual-backup-2024",value:v.name,onChange:k=>N({...v,name:k.target.value})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 rounded border-[#324d67] bg-[#111a22] text-primary",checked:v.recursive,onChange:k=>N({...v,recursive:k.target.checked})}),e.jsx("label",{className:"text-sm text-white",children:"Recursive (include child datasets)"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(ct,{onClick:()=>{h(!1),N({dataset:"",name:"",recursive:!1})},variant:"outline",className:"px-4 h-10 border-[#2a3b4d] text-white hover:bg-[#2a3b4d]",children:"Cancel"}),e.jsx(ct,{onClick:()=>{if(!v.dataset||!v.name){alert("Please fill in all required fields");return}Ae.mutate({dataset:v.dataset,name:v.name,recursive:v.recursive})},disabled:Ae.isPending||!v.dataset||!v.name,className:"px-4 h-10 bg-primary hover:bg-blue-600 disabled:opacity-50",children:Ae.isPending?"Creating...":"Create Snapshot"})]})]})]})}),w&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#18232e] border border-[#2a3b4d] rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Confirm Delete Snapshot"}),e.jsx("button",{onClick:()=>L(null),className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_l,{className:"text-red-400 mt-0.5",size:20}),e.jsxs("div",{children:[e.jsx("p",{className:"text-red-400 text-sm font-medium mb-1",children:"Warning"}),e.jsxs("p",{className:"text-red-300 text-xs",children:['This action cannot be undone. Snapshot "',w,'" will be permanently deleted.']})]})]})}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>L(null),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-[#2a3b4d] hover:bg-[#111a22] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{oe.mutate({name:w,recursive:!1})},disabled:oe.isPending,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:oe.isPending?"Deleting...":"Delete Snapshot"})]})]})]})}),K&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#18232e] border border-[#2a3b4d] rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:"Confirm Rollback to Snapshot"}),e.jsx("button",{onClick:()=>M(null),className:"text-text-secondary hover:text-white transition-colors",children:"✕"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-orange-500/10 border border-orange-500/20 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(_l,{className:"text-orange-400 mt-0.5",size:20}),e.jsxs("div",{children:[e.jsx("p",{className:"text-orange-400 text-sm font-medium mb-1",children:"Warning"}),e.jsxs("p",{className:"text-orange-300 text-xs",children:['Rolling back to snapshot "',K,'" will destroy all changes made after this snapshot was created. This action cannot be undone.']})]})]})}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>M(null),className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-[#2a3b4d] hover:bg-[#111a22] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:()=>{ce.mutate({name:K,force:!1})},disabled:ce.isPending,className:"px-4 py-2 bg-orange-600 hover:bg-orange-700 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:ce.isPending?"Rolling back...":"Rollback to Snapshot"})]})]})]})}),m&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#18232e] border border-[#2a3b4d] rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx("div",{className:"p-6 border-b border-[#2a3b4d]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-white text-xl font-bold",children:y?"Edit Schedule":"Create Snapshot Schedule"}),e.jsx("button",{onClick:()=>{x(!1),p(null),g({name:"",dataset:"",snapshot_name_template:"auto-%Y-%m-%d-%H%M",schedule_type:"daily",schedule_config:{time:"00:00"},recursive:!1})},className:"text-text-secondary hover:text-white transition-colors",children:e.jsx(Zs,{size:24})})]})}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Schedule Name"}),e.jsx("input",{type:"text",value:B.name,onChange:k=>g({...B,name:k.target.value}),placeholder:"e.g., Daily Backup",className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white placeholder-text-secondary focus:outline-none focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Dataset"}),e.jsxs("select",{value:B.dataset,onChange:k=>g({...B,dataset:k.target.value}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary",children:[e.jsx("option",{value:"",children:"Select dataset..."}),J.flatMap(k=>k.datasets.map(G=>e.jsx("option",{value:G.name,children:G.name},G.name)))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Snapshot Name Template"}),e.jsx("input",{type:"text",value:B.snapshot_name_template,onChange:k=>g({...B,snapshot_name_template:k.target.value}),placeholder:"e.g., auto-%Y-%m-%d-%H%M or daily-backup",className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white placeholder-text-secondary focus:outline-none focus:border-primary"}),e.jsx("p",{className:"text-[#536b85] text-xs mt-1",children:"Use %Y, %m, %d, %H, %M for date/time formatting (e.g., %Y-%m-%d-%H%M)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Schedule Type"}),e.jsxs("select",{value:B.schedule_type,onChange:k=>{const G=k.target.value;let me={};G==="daily"||G==="weekly"||G==="monthly"?(me={time:B.schedule_config?.time||"00:00"},G==="weekly"?me.day=B.schedule_config?.day||0:G==="monthly"&&(me.day=B.schedule_config?.day||1)):G==="cron"&&(me={cron:B.schedule_config?.cron||"0 0 * * *"}),g({...B,schedule_type:G,schedule_config:me})},className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary",children:[e.jsx("option",{value:"hourly",children:"Hourly"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"cron",children:"Custom (Cron)"})]})]}),B.schedule_type==="daily"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Time (HH:MM)"}),e.jsx("input",{type:"time",value:B.schedule_config?.time||"00:00",onChange:k=>g({...B,schedule_config:{...B.schedule_config,time:k.target.value}}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary"})]}),B.schedule_type==="weekly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Day of Week"}),e.jsxs("select",{value:B.schedule_config?.day||0,onChange:k=>g({...B,schedule_config:{...B.schedule_config,day:parseInt(k.target.value)}}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary",children:[e.jsx("option",{value:0,children:"Sunday"}),e.jsx("option",{value:1,children:"Monday"}),e.jsx("option",{value:2,children:"Tuesday"}),e.jsx("option",{value:3,children:"Wednesday"}),e.jsx("option",{value:4,children:"Thursday"}),e.jsx("option",{value:5,children:"Friday"}),e.jsx("option",{value:6,children:"Saturday"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Time (HH:MM)"}),e.jsx("input",{type:"time",value:B.schedule_config?.time||"00:00",onChange:k=>g({...B,schedule_config:{...B.schedule_config,time:k.target.value}}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary"})]})]}),B.schedule_type==="monthly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Day of Month (1-31)"}),e.jsx("input",{type:"number",min:"1",max:"31",value:B.schedule_config?.day||1,onChange:k=>g({...B,schedule_config:{...B.schedule_config,day:parseInt(k.target.value)}}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Time (HH:MM)"}),e.jsx("input",{type:"time",value:B.schedule_config?.time||"00:00",onChange:k=>g({...B,schedule_config:{...B.schedule_config,time:k.target.value}}),className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white focus:outline-none focus:border-primary"})]})]}),B.schedule_type==="cron"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Cron Expression"}),e.jsx("input",{type:"text",value:B.schedule_config?.cron||"0 0 * * *",onChange:k=>g({...B,schedule_config:{...B.schedule_config,cron:k.target.value}}),placeholder:"0 0 * * *",className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white placeholder-text-secondary focus:outline-none focus:border-primary"}),e.jsx("p",{className:"text-[#536b85] text-xs mt-1",children:"Format: minute hour day month weekday"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"recursive",checked:B.recursive,onChange:k=>g({...B,recursive:k.target.checked}),className:"w-4 h-4 rounded border-[#2a3b4d] bg-[#111a22] text-primary focus:ring-primary"}),e.jsx("label",{htmlFor:"recursive",className:"text-sm text-white",children:"Recursive (include child datasets)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Retention Count (optional)"}),e.jsx("input",{type:"number",min:"1",value:B.retention_count||"",onChange:k=>g({...B,retention_count:k.target.value?parseInt(k.target.value):void 0}),placeholder:"Keep last N snapshots (leave empty for unlimited)",className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white placeholder-text-secondary focus:outline-none focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-semibold text-white mb-2 block",children:"Retention Days (optional)"}),e.jsx("input",{type:"number",min:"1",value:B.retention_days||"",onChange:k=>g({...B,retention_days:k.target.value?parseInt(k.target.value):void 0}),placeholder:"Keep snapshots for N days (leave empty for unlimited)",className:"w-full px-4 py-2 bg-[#111a22] border border-[#2a3b4d] rounded-lg text-white placeholder-text-secondary focus:outline-none focus:border-primary"})]}),e.jsxs("div",{className:"flex gap-3 justify-end pt-4",children:[e.jsx("button",{onClick:()=>{x(!1),p(null),g({name:"",dataset:"",snapshot_name_template:"auto-%Y-%m-%d-%H%M",schedule_type:"daily",schedule_config:{time:"00:00"},recursive:!1})},className:"px-4 py-2 text-white text-sm font-medium rounded-lg border border-[#2a3b4d] hover:bg-[#111a22] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:async()=>{if(!B.name||!B.dataset||!B.snapshot_name_template){alert("Please fill in all required fields");return}try{y?(await eh.updateSchedule(y.id,B),alert("Schedule updated successfully!")):(await eh.createSchedule(B),alert("Schedule created successfully!")),await T.invalidateQueries({queryKey:["snapshot-schedules"]}),await _e(),x(!1),p(null),g({name:"",dataset:"",snapshot_name_template:"auto-%Y-%m-%d-%H%M",schedule_type:"daily",schedule_config:{time:"00:00"},recursive:!1})}catch(k){alert(k.response?.data?.error||"Failed to save schedule")}},className:"px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-medium rounded-lg transition-colors",children:y?"Update Schedule":"Create Schedule"})]})]})]})})]})}const rh=[{id:"1",filename:"invoice_2024.pdf.exe",path:"/mnt/pool0/users/finance/",threat:"Win.Trojan.Agent-1",threatLevel:"high",date:"2024-10-24T10:42:00Z"},{id:"2",filename:"keygen_v2.zip",path:"/mnt/pool0/public/software/",threat:"PUA.Win.Tool.Keygen",threatLevel:"medium",date:"2024-10-22T20:15:00Z"},{id:"3",filename:"script_final.sh",path:"/root/downloads/",threat:"Unix.Malware.Agent",threatLevel:"high",date:"2024-10-20T02:30:00Z"}],p_=[{id:"1",name:"Daily Full System",target:"/",frequency:"Every day at 02:00",lastRun:"Yesterday 02:00",status:"success"},{id:"2",name:"Weekly Pool Scan",target:"/mnt/pool0",frequency:"Sundays at 04:00",lastRun:"3 days ago",status:"success"}];function x_(){const[r,t]=Ce.useState(!0),[s,n]=Ce.useState("/mnt/pool0/data"),[o,l]=Ce.useState(!0),[d,c]=Ce.useState(!1),[u,h]=Ce.useState(!1),[m,x]=Ce.useState([]),y=B=>new Date(B).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),p=B=>B==="high"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20",v=()=>{m.length===rh.length?x([]):x(rh.map(B=>B.id))},N=B=>{m.includes(B)?x(m.filter(g=>g!==B)):x([...m,B])};return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col bg-background-dark",children:[e.jsx("header",{className:"sticky top-0 z-20 bg-background-dark/95 backdrop-blur border-b border-border-dark px-6 py-4 lg:px-10",children:e.jsx("div",{className:"max-w-7xl mx-auto w-full",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ba,{to:"/system",className:"text-text-secondary hover:text-primary transition-colors",children:"System"}),e.jsx(Ka,{className:"text-text-secondary",size:16}),e.jsx(ba,{to:"/system",className:"text-text-secondary hover:text-primary transition-colors",children:"Security"}),e.jsx(Ka,{className:"text-text-secondary",size:16}),e.jsx("span",{className:"text-white font-medium",children:"Share Shield System"})]}),e.jsxs("div",{className:"flex flex-wrap justify-between items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-white text-3xl font-black tracking-tight mb-1",children:"Share Shield System"}),e.jsx("p",{className:"text-text-secondary text-sm lg:text-base max-w-2xl",children:"Manage virus definitions, on-demand scans, and quarantine settings for your storage pools."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 bg-[#233648] hover:bg-[#2c445a] text-white text-sm font-medium rounded-lg border border-border-dark transition-all",children:[e.jsx(hp,{size:16}),"Scan History"]}),e.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 bg-primary hover:bg-blue-600 text-white text-sm font-bold rounded-lg shadow-lg shadow-blue-500/20 transition-all",children:[e.jsx(Cn,{size:16}),"Update Definitions"]})]})]})]})})}),e.jsx("div",{className:"flex-1 p-6 lg:px-10 py-8 overflow-y-auto",children:e.jsxs("div",{className:"max-w-7xl mx-auto w-full flex flex-col gap-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"xl:col-span-2 rounded-xl border border-border-dark bg-card-dark p-5 flex items-center justify-between shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10 border border-emerald-500/20",children:e.jsx(Bn,{className:"text-emerald-500",size:32})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white text-base font-bold",children:"Share Shield Service"}),e.jsxs("p",{className:"text-emerald-400 text-sm font-medium flex items-center gap-1.5",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-emerald-400 animate-pulse"}),"Active & Protecting"]})]})]}),e.jsxs("label",{className:"relative flex h-[28px] w-[48px] cursor-pointer items-center rounded-full border-none bg-[#233648] p-0.5 transition-colors duration-300 has-[:checked]:justify-end has-[:checked]:bg-primary",children:[e.jsx("div",{className:"h-[24px] w-[24px] rounded-full bg-white shadow-sm"}),e.jsx("input",{checked:r,onChange:B=>t(B.target.checked),className:"invisible absolute",type:"checkbox"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-card-dark p-5 flex flex-col justify-between shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:"text-text-secondary text-sm font-medium",children:"Virus Definitions"}),e.jsx(_y,{className:"text-text-secondary",size:20})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white text-2xl font-bold tracking-tight",children:"v26500"}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Updated: 2 hours ago"})]})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-card-dark p-5 flex flex-col justify-between shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:"text-text-secondary text-sm font-medium",children:"Quarantined Files"}),e.jsx(Eh,{className:"text-amber-500",size:20})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-white text-2xl font-bold tracking-tight",children:"12"}),e.jsx("span",{className:"text-emerald-500 text-xs font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded",children:"+2 new"})]}),e.jsx("p",{className:"text-text-secondary text-xs mt-1",children:"Since last reboot"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[e.jsx("div",{className:"flex flex-col gap-6 xl:col-span-1",children:e.jsxs("div",{className:"rounded-xl border border-border-dark bg-card-dark overflow-hidden flex flex-col",children:[e.jsx("div",{className:"p-5 border-b border-border-dark bg-[#16202a]",children:e.jsxs("h3",{className:"text-white font-bold text-lg flex items-center gap-2",children:[e.jsx(I6,{className:"text-primary",size:20}),"On-Demand Scanner"]})}),e.jsxs("div",{className:"p-5 flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-text-secondary",children:"Target Directory"}),e.jsxs("div",{className:"flex",children:[e.jsx("input",{className:"flex-1 bg-[#111a22] border border-border-dark text-white text-sm rounded-l-lg px-3 py-2.5 focus:ring-1 focus:ring-primary focus:border-primary outline-none placeholder-gray-600",placeholder:"/path/to/scan",type:"text",value:s,onChange:B=>n(B.target.value)}),e.jsx("button",{className:"bg-[#233648] hover:bg-[#2c445a] text-white px-3 border-y border-r border-border-dark rounded-r-lg transition-colors",children:e.jsx(au,{size:18})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[e.jsx("input",{checked:o,onChange:B=>l(B.target.checked),className:"rounded border-border-dark bg-[#233648] text-primary focus:ring-offset-[#111a22] focus:ring-primary size-4",type:"checkbox"}),e.jsx("span",{className:"text-sm text-gray-300 group-hover:text-white transition-colors",children:"Recursive Scan"})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[e.jsx("input",{checked:d,onChange:B=>c(B.target.checked),className:"rounded border-border-dark bg-[#233648] text-primary focus:ring-offset-[#111a22] focus:ring-primary size-4",type:"checkbox"}),e.jsx("span",{className:"text-sm text-gray-300 group-hover:text-white transition-colors",children:"Scan Archives (zip, rar)"})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[e.jsx("input",{checked:u,onChange:B=>h(B.target.checked),className:"rounded border-border-dark bg-[#233648] text-primary focus:ring-offset-[#111a22] focus:ring-primary size-4",type:"checkbox"}),e.jsx("span",{className:"text-sm text-gray-300 group-hover:text-white transition-colors",children:"Remove Threats Automatically"})]})]}),e.jsxs("div",{className:"pt-2 border-t border-border-dark/50 flex flex-col gap-3",children:[e.jsxs("button",{className:"w-full py-2.5 bg-primary hover:bg-blue-600 text-white font-bold rounded-lg shadow-lg shadow-blue-500/20 transition-all flex justify-center items-center gap-2",children:[e.jsx(i4,{size:18}),"Start Scan"]}),e.jsxs("button",{className:"w-full py-2.5 bg-[#233648] hover:bg-[#2c445a] text-text-secondary hover:text-white font-medium rounded-lg border border-border-dark transition-all flex justify-center items-center gap-2",children:[e.jsx(Ec,{size:18}),"Schedule Scan"]})]})]})]})}),e.jsx("div",{className:"xl:col-span-2 flex flex-col gap-6",children:e.jsxs("div",{className:"rounded-xl border border-border-dark bg-card-dark overflow-hidden flex flex-col h-full",children:[e.jsxs("div",{className:"p-5 border-b border-border-dark bg-[#16202a] flex justify-between items-center",children:[e.jsxs("h3",{className:"text-white font-bold text-lg flex items-center gap-2",children:[e.jsx(D6,{className:"text-amber-500",size:20}),"Quarantine Manager"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:v,className:"text-xs font-medium text-text-secondary hover:text-white px-3 py-1.5 rounded-md hover:bg-[#233648] transition-colors border border-transparent hover:border-border-dark",children:"Select All"}),e.jsx("button",{className:"text-xs font-medium text-red-400 hover:text-red-300 px-3 py-1.5 rounded-md hover:bg-red-400/10 transition-colors border border-transparent hover:border-red-400/20",children:"Delete Selected"})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-[#16202a] text-text-secondary font-medium",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-5 py-3 w-10",children:e.jsx("input",{checked:m.length===rh.length,onChange:v,className:"rounded border-border-dark bg-[#233648] text-primary focus:ring-offset-[#111a22] focus:ring-primary size-4",type:"checkbox"})}),e.jsx("th",{className:"px-5 py-3",children:"Filename"}),e.jsx("th",{className:"px-5 py-3",children:"Threat Detected"}),e.jsx("th",{className:"px-5 py-3",children:"Date"}),e.jsx("th",{className:"px-5 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:rh.map(B=>e.jsxs("tr",{className:"group hover:bg-[#233648]/30 transition-colors",children:[e.jsx("td",{className:"px-5 py-4",children:e.jsx("input",{checked:m.includes(B.id),onChange:()=>N(B.id),className:"rounded border-border-dark bg-[#233648] text-primary focus:ring-offset-[#111a22] focus:ring-primary size-4",type:"checkbox"})}),e.jsx("td",{className:"px-5 py-4",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-white font-medium",children:B.filename}),e.jsx("span",{className:"text-xs text-text-secondary font-mono",children:B.path})]})}),e.jsx("td",{className:"px-5 py-4",children:e.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${p(B.threatLevel)}`,children:B.threat})}),e.jsx("td",{className:"px-5 py-4 text-text-secondary",children:y(B.date)}),e.jsx("td",{className:"px-5 py-4 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2 opacity-60 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{className:"p-1.5 text-text-secondary hover:text-emerald-400 hover:bg-emerald-400/10 rounded-md transition-colors",title:"Restore",children:e.jsx(Im,{size:20})}),e.jsx("button",{className:"p-1.5 text-text-secondary hover:text-red-400 hover:bg-red-400/10 rounded-md transition-colors",title:"Delete Permanently",children:e.jsx(es,{size:20})})]})})]},B.id))})]})}),e.jsxs("div",{className:"p-4 border-t border-border-dark bg-[#16202a] text-xs text-text-secondary flex justify-center",children:["Showing ",rh.length," of 12 quarantined items"]})]})})]}),e.jsxs("div",{className:"rounded-xl border border-border-dark bg-card-dark overflow-hidden mt-2",children:[e.jsxs("div",{className:"p-5 border-b border-border-dark bg-[#16202a] flex justify-between items-center",children:[e.jsx("h3",{className:"text-white font-bold text-lg",children:"Scheduled Scans"}),e.jsxs("button",{className:"text-primary hover:text-blue-400 text-sm font-bold flex items-center gap-1",children:[e.jsx(Ks,{size:18}),"Add Schedule"]})]}),e.jsx("div",{className:"p-0 overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"text-text-secondary font-medium border-b border-border-dark",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 font-medium",children:"Name"}),e.jsx("th",{className:"px-6 py-3 font-medium",children:"Target"}),e.jsx("th",{className:"px-6 py-3 font-medium",children:"Frequency"}),e.jsx("th",{className:"px-6 py-3 font-medium",children:"Last Run"}),e.jsx("th",{className:"px-6 py-3 font-medium",children:"Status"}),e.jsx("th",{className:"px-6 py-3 font-medium text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-dark",children:p_.map(B=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-white font-medium",children:B.name}),e.jsx("td",{className:"px-6 py-4 text-text-secondary font-mono text-xs",children:B.target}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:B.frequency}),e.jsx("td",{className:"px-6 py-4 text-text-secondary",children:B.lastRun}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("span",{className:"text-emerald-400 flex items-center gap-1",children:[e.jsx(su,{size:16}),"Success"]})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"text-text-secondary hover:text-white",children:e.jsx(pp,{size:18})})})]},B.id))})]})})]})]})})]})}const g_="modulepreload",b_=function(r){return"/"+r},Lv={},sg=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let u=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),c=d?.nonce||d?.getAttribute("nonce");o=u(s.map(h=>{if(h=b_(h),h in Lv)return;Lv[h]=!0;const m=h.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":g_,m||(y.as="script"),y.crossOrigin="",y.href=h,c&&y.setAttribute("nonce",c),document.head.appendChild(y),m)return new Promise((p,v)=>{y.addEventListener("load",p),y.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(d){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=d,window.dispatchEvent(c),!c.defaultPrevented)throw d}return o.then(d=>{for(const c of d||[])c.status==="rejected"&&l(c.reason);return t().catch(l)})};var no=Uint8Array,Wn=Uint16Array,Fy=Int32Array,Ey=new no([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Uy=new no([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tv=new no([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p4=function(r,t){for(var s=new Wn(31),n=0;n<31;++n)s[n]=t+=1<>1|(os&21845)<<1;pA=(pA&52428)>>2|(pA&13107)<<2,pA=(pA&61680)>>4|(pA&3855)<<4,Ob[os]=((pA&65280)>>8|(pA&255)<<8)>>1}var Nh=(function(r,t,s){for(var n=r.length,o=0,l=new Wn(t);o>u]=h}else for(c=new Wn(n),o=0;o>15-r[o]);return c}),Uc=new no(288);for(var os=0;os<144;++os)Uc[os]=8;for(var os=144;os<256;++os)Uc[os]=9;for(var os=256;os<280;++os)Uc[os]=7;for(var os=280;os<288;++os)Uc[os]=8;var Jm=new no(32);for(var os=0;os<32;++os)Jm[os]=5;var v_=Nh(Uc,9,0),N_=Nh(Jm,5,0),g4=function(r){return(r+7)/8|0},B_=function(r,t,s){return(s==null||s>r.length)&&(s=r.length),new no(r.subarray(t,s))},bl=function(r,t,s){s<<=t&7;var n=t/8|0;r[n]|=s,r[n+1]|=s>>8},sh=function(r,t,s){s<<=t&7;var n=t/8|0;r[n]|=s,r[n+1]|=s>>8,r[n+2]|=s>>16},ag=function(r,t){for(var s=[],n=0;ny&&(y=l[n].s);var p=new Wn(y+1),v=Hb(s[m-1],p,0);if(v>t){var n=0,N=0,B=v-t,g=1<t)N+=g-(1<>=B;N>0;){var _=l[n].s;p[_]=0&&N;--n){var w=l[n].s;p[w]==t&&(--p[w],++N)}v=t}return{t:new no(p),l:v}},Hb=function(r,t,s){return r.s==-1?Math.max(Hb(r.l,t,s+1),Hb(r.r,t,s+1)):t[r.s]=s},Dv=function(r){for(var t=r.length;t&&!r[--t];);for(var s=new Wn(++t),n=0,o=r[0],l=1,d=function(u){s[n++]=u},c=1;c<=t;++c)if(r[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)d(32754);l>2&&(d(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(d(o),--l;l>6;l-=6)d(8304);l>2&&(d(l-3<<5|8208),l=0)}for(;l--;)d(o);l=1,o=r[c]}return{c:s.subarray(0,n),n:t}},ah=function(r,t){for(var s=0,n=0;n>8,r[o+2]=r[o]^255,r[o+3]=r[o+1]^255;for(var l=0;l4&&!ne[Tv[U-1]];--U);var q=h+5<<3,F=ah(o,Uc)+ah(l,Jm)+d,le=ah(o,y)+ah(l,N)+d+14+3*U+ah(M,ne)+2*M[16]+3*M[17]+7*M[18];if(u>=0&&q<=F&&q<=le)return b4(t,m,r.subarray(u,u+h));var ae,se,fe,ye;if(bl(t,m,1+(le15&&(bl(t,m,$[V]>>5&127),m+=$[V]>>12)}}else ae=v_,se=Uc,fe=N_,ye=Jm;for(var V=0;V255){var X=te>>18&31;sh(t,m,ae[X+257]),m+=se[X+257],X>7&&(bl(t,m,te>>23&31),m+=Ey[X]);var J=te&31;sh(t,m,fe[J]),m+=ye[J],J>3&&(sh(t,m,te>>5&8191),m+=Uy[J])}else sh(t,m,ae[te]),m+=se[te]}return sh(t,m,ae[256]),m+se[256]},j_=new Fy([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),y4=new no(0),C_=function(r,t,s,n,o,l){var d=l.z||r.length,c=new no(n+d+5*(1+Math.ceil(d/7e3))+o),u=c.subarray(n,c.length-o),h=l.l,m=(l.r||0)&7;if(t){m&&(u[0]=l.r>>3);for(var x=j_[t-1],y=x>>13,p=x&8191,v=(1<7e3||ne>24576)&&(ae>423||!h)){m=Rv(r,u,0,w,L,K,V,ne,U,T-U,m),ne=M=V=0,U=T;for(var se=0;se<286;++se)L[se]=0;for(var se=0;se<30;++se)K[se]=0}var fe=2,ye=0,_e=p,xe=F-le&32767;if(ae>2&&q==_(T-xe))for(var D=Math.min(y,ae)-1,$=Math.min(32767,T),X=Math.min(258,ae);xe<=$&&--_e&&F!=le;){if(r[T+fe]==r[T+fe-xe]){for(var te=0;tefe){if(fe=te,ye=xe,te>D)break;for(var J=Math.min(xe,te-2),O=0,se=0;seO&&(O=Ae,le=H)}}}F=le,le=N[F],xe+=F-le&32767}if(ye){w[ne++]=268435456|Rb[fe]<<18|Iv[ye];var oe=Rb[fe]&31,ce=Iv[ye]&31;V+=Ey[oe]+Uy[ce],++L[257+oe],++K[ce],Z=T+fe,++M}else w[ne++]=r[T],++L[r[T]]}}for(T=Math.max(T,Z);T=d&&(u[m/8|0]=h,Se=d),m=b4(u,m+1,r.subarray(T,Se))}l.i=d}return B_(c,0,n+g4(m)+o)},w4=function(){var r=1,t=0;return{p:function(s){for(var n=r,o=t,l=s.length|0,d=0;d!=l;){for(var c=Math.min(d+2655,l);d>16),o=(o&65535)+15*(o>>16)}r=n,t=o},d:function(){return r%=65521,t%=65521,(r&255)<<24|(r&65280)<<8|(t&255)<<8|t>>8}}},S_=function(r,t,s,n,o){if(!o&&(o={l:1},t.dictionary)){var l=t.dictionary.subarray(-32768),d=new no(l.length+r.length);d.set(l),d.set(r,l.length),r=d,o.w=l.length}return C_(r,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+t.mem,s,n,o)},v4=function(r,t,s){for(;s;++t)r[t]=s,s>>>=8},__=function(r,t){var s=t.level,n=s==0?0:s<6?1:s==9?3:2;if(r[0]=120,r[1]=n<<6|(t.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,t.dictionary){var o=w4();o.p(t.dictionary),v4(r,2,o.d())}};function Mb(r,t){t||(t={});var s=w4();s.p(r);var n=S_(r,t,t.dictionary?6:2,4);return __(n,t),v4(n,n.length-4,s.d()),n}var k_=typeof TextDecoder<"u"&&new TextDecoder,F_=0;try{k_.decode(y4,{stream:!0}),F_=1}catch{}function E_(r){if(Array.isArray(r))return r}function U_(r,t){var s=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(s!=null){var n,o,l,d,c=[],u=!0,h=!1;try{if(l=(s=s.call(r)).next,t!==0)for(;!(u=(n=l.call(s)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(m){h=!0,o=m}finally{try{if(!u&&s.return!=null&&(d=s.return(),Object(d)!==d))return}finally{if(h)throw o}}return c}}function Q_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ov(r,t){return E_(r)||U_(r,t)||y6(r,t)||Q_()}function Hv(r,t="utf8"){return new TextDecoder(t).decode(r)}const L_=new TextEncoder;function T_(r){return L_.encode(r)}const I_=1024*8,D_=(()=>{const r=new Uint8Array(4),t=new Uint32Array(r.buffer);return!((t[0]=1)&r[0])})(),ng={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class Qy{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=I_,s={}){let n=!1;typeof t=="number"?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const o=s.offset?s.offset>>>0:0,l=t.byteLength-o;let d=o;(ArrayBuffer.isView(t)||t instanceof Qy)&&(t.byteLength!==t.buffer.byteLength&&(d=t.byteOffset+o),t=t.buffer),n?this.lastWrittenByte=l:this.lastWrittenByte=0,this.buffer=t,this.length=l,this.byteLength=l,this.byteOffset=d,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,d,l),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const n=(this.offset+t)*2,o=new Uint8Array(n);o.set(new Uint8Array(this.buffer)),this.buffer=o.buffer,this.length=n,this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,s){const n=ng[s].BYTES_PER_ELEMENT*t,o=this.byteOffset+this.offset,l=this.buffer.slice(o,o+n);if(this.littleEndian===D_&&s!=="uint8"&&s!=="int8"){const c=new Uint8Array(this.buffer.slice(o,o+n));c.reverse();const u=new ng[s](c.buffer);return this.offset+=n,u.reverse(),u}const d=new ng[s](l);return this.offset+=n,d}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let s="";for(let n=0;nthis.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function fu(r){let t=r.length;for(;--t>=0;)r[t]=0}const R_=3,O_=258,N4=29,H_=256,M_=H_+1+N4,B4=30,P_=512,K_=new Array((M_+2)*2);fu(K_);const z_=new Array(B4*2);fu(z_);const q_=new Array(P_);fu(q_);const G_=new Array(O_-R_+1);fu(G_);const V_=new Array(N4);fu(V_);const W_=new Array(B4);fu(W_);const X_=(r,t,s,n)=>{let o=r&65535|0,l=r>>>16&65535|0,d=0;for(;s!==0;){d=s>2e3?2e3:s,s-=d;do o=o+t[n++]|0,l=l+o|0;while(--d);o%=65521,l%=65521}return o|l<<16|0};var Pb=X_;const Y_=()=>{let r,t=[];for(var s=0;s<256;s++){r=s;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[s]=r}return t},J_=new Uint32Array(Y_()),Z_=(r,t,s,n)=>{const o=J_,l=n+s;r^=-1;for(let d=n;d>>8^o[(r^t[d])&255];return r^-1};var Eo=Z_,Kb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},j4={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const $_=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var ek=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const s=t.shift();if(s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(const n in s)$_(s,n)&&(r[n]=s[n])}}return r},tk=r=>{let t=0;for(let n=0,o=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Ih[254]=Ih[254]=1;var rk=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,s,n,o,l,d=r.length,c=0;for(o=0;o>>6,t[l++]=128|s&63):s<65536?(t[l++]=224|s>>>12,t[l++]=128|s>>>6&63,t[l++]=128|s&63):(t[l++]=240|s>>>18,t[l++]=128|s>>>12&63,t[l++]=128|s>>>6&63,t[l++]=128|s&63);return t};const sk=(r,t)=>{if(t<65534&&r.subarray&&S4)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let s="";for(let n=0;n{const s=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,o;const l=new Array(s*2);for(o=0,n=0;n4){l[o++]=65533,n+=c-1;continue}for(d&=c===2?31:c===3?15:7;c>1&&n1){l[o++]=65533;continue}d<65536?l[o++]=d:(d-=65536,l[o++]=55296|d>>10&1023,l[o++]=56320|d&1023)}return sk(l,o)},nk=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let s=t-1;for(;s>=0&&(r[s]&192)===128;)s--;return s<0||s===0?t:s+Ih[r[s]]>t?s:t},zb={string2buf:rk,buf2string:ak,utf8border:nk};function ik(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var ok=ik;const qf=16209,lk=16191;var Ak=function(t,s){let n,o,l,d,c,u,h,m,x,y,p,v,N,B,g,j,_,w,L,K,M,V,T,ne;const Z=t.state;n=t.next_in,T=t.input,o=n+(t.avail_in-5),l=t.next_out,ne=t.output,d=l-(s-t.avail_out),c=l+(t.avail_out-257),u=Z.dmax,h=Z.wsize,m=Z.whave,x=Z.wnext,y=Z.window,p=Z.hold,v=Z.bits,N=Z.lencode,B=Z.distcode,g=(1<>>24,p>>>=w,v-=w,w=_>>>16&255,w===0)ne[l++]=_&65535;else if(w&16){L=_&65535,w&=15,w&&(v>>=w,v-=w),v<15&&(p+=T[n++]<>>24,p>>>=w,v-=w,w=_>>>16&255,w&16){if(K=_&65535,w&=15,vu){t.msg="invalid distance too far back",Z.mode=qf;break e}if(p>>>=w,v-=w,w=l-d,K>w){if(w=K-w,w>m&&Z.sane){t.msg="invalid distance too far back",Z.mode=qf;break e}if(M=0,V=y,x===0){if(M+=h-w,w2;)ne[l++]=V[M++],ne[l++]=V[M++],ne[l++]=V[M++],L-=3;L&&(ne[l++]=V[M++],L>1&&(ne[l++]=V[M++]))}else{M=l-K;do ne[l++]=ne[M++],ne[l++]=ne[M++],ne[l++]=ne[M++],L-=3;while(L>2);L&&(ne[l++]=ne[M++],L>1&&(ne[l++]=ne[M++]))}}else if((w&64)===0){_=B[(_&65535)+(p&(1<>3,n-=L,v-=L<<3,p&=(1<{const u=c.bits;let h=0,m=0,x=0,y=0,p=0,v=0,N=0,B=0,g=0,j=0,_,w,L,K,M,V=null,T;const ne=new Uint16Array(kd+1),Z=new Uint16Array(kd+1);let U=null,q,F,le;for(h=0;h<=kd;h++)ne[h]=0;for(m=0;m=1&&ne[y]===0;y--);if(p>y&&(p=y),y===0)return o[l++]=1<<24|64<<16|0,o[l++]=1<<24|64<<16|0,c.bits=1,0;for(x=1;x0&&(r===Kv||y!==1))return-1;for(Z[1]=0,h=1;hMv||r===zv&&g>Pv)return 1;for(;;){q=h-N,d[m]+1=T?(F=U[d[m]-T],le=V[d[m]-T]):(F=96,le=0),_=1<>N)+w]=q<<24|F<<16|le|0;while(w!==0);for(_=1<>=1;if(_!==0?(j&=_-1,j+=_):j=0,m++,--ne[h]===0){if(h===y)break;h=t[s+d[m]]}if(h>p&&(j&K)!==L){for(N===0&&(N=p),M+=x,v=h-N,B=1<Mv||r===zv&&g>Pv)return 1;L=j&K,o[L]=p<<24|v<<16|M-l|0}}return j!==0&&(o[M+j]=h-N<<24|64<<16|0),c.bits=p,0};var Bh=fk;const mk=0,_4=1,k4=2,{Z_FINISH:qv,Z_BLOCK:pk,Z_TREES:Gf,Z_OK:Qc,Z_STREAM_END:xk,Z_NEED_DICT:gk,Z_STREAM_ERROR:ji,Z_DATA_ERROR:F4,Z_MEM_ERROR:E4,Z_BUF_ERROR:bk,Z_DEFLATED:Gv}=j4,xp=16180,Vv=16181,Wv=16182,Xv=16183,Yv=16184,Jv=16185,Zv=16186,$v=16187,e2=16188,t2=16189,Zm=16190,yl=16191,og=16192,r2=16193,lg=16194,s2=16195,a2=16196,n2=16197,i2=16198,Vf=16199,Wf=16200,o2=16201,l2=16202,A2=16203,c2=16204,d2=16205,Ag=16206,u2=16207,h2=16208,us=16209,U4=16210,Q4=16211,yk=852,wk=592,vk=15,Nk=vk,f2=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Bk(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Tc=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.modeQ4?1:0},L4=r=>{if(Tc(r))return ji;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=xp,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(yk),t.distcode=t.distdyn=new Int32Array(wk),t.sane=1,t.back=-1,Qc},T4=r=>{if(Tc(r))return ji;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,L4(r)},I4=(r,t)=>{let s;if(Tc(r))return ji;const n=r.state;return t<0?(s=0,t=-t):(s=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ji:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=s,n.wbits=t,T4(r))},D4=(r,t)=>{if(!r)return ji;const s=new Bk;r.state=s,s.strm=r,s.window=null,s.mode=xp;const n=I4(r,t);return n!==Qc&&(r.state=null),n},jk=r=>D4(r,Nk);let m2=!0,cg,dg;const Ck=r=>{if(m2){cg=new Int32Array(512),dg=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Bh(_4,r.lens,0,288,cg,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Bh(k4,r.lens,0,32,dg,0,r.work,{bits:5}),m2=!1}r.lencode=cg,r.lenbits=9,r.distcode=dg,r.distbits=5},R4=(r,t,s,n)=>{let o;const l=r.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(s-l.wsize,s),0),l.wnext=0,l.whave=l.wsize):(o=l.wsize-l.wnext,o>n&&(o=n),l.window.set(t.subarray(s-n,s-n+o),l.wnext),n-=o,n?(l.window.set(t.subarray(s-n,s),0),l.wnext=n,l.whave=l.wsize):(l.wnext+=o,l.wnext===l.wsize&&(l.wnext=0),l.whave{let s,n,o,l,d,c,u,h,m,x,y,p,v,N,B=0,g,j,_,w,L,K,M,V;const T=new Uint8Array(4);let ne,Z;const U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Tc(r)||!r.output||!r.input&&r.avail_in!==0)return ji;s=r.state,s.mode===yl&&(s.mode=og),d=r.next_out,o=r.output,u=r.avail_out,l=r.next_in,n=r.input,c=r.avail_in,h=s.hold,m=s.bits,x=c,y=u,V=Qc;e:for(;;)switch(s.mode){case xp:if(s.wrap===0){s.mode=og;break}for(;m<16;){if(c===0)break e;c--,h+=n[l++]<>>8&255,s.check=Eo(s.check,T,2,0),h=0,m=0,s.mode=Vv;break}if(s.head&&(s.head.done=!1),!(s.wrap&1)||(((h&255)<<8)+(h>>8))%31){r.msg="incorrect header check",s.mode=us;break}if((h&15)!==Gv){r.msg="unknown compression method",s.mode=us;break}if(h>>>=4,m-=4,M=(h&15)+8,s.wbits===0&&(s.wbits=M),M>15||M>s.wbits){r.msg="invalid window size",s.mode=us;break}s.dmax=1<>8&1),s.flags&512&&s.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,s.check=Eo(s.check,T,2,0)),h=0,m=0,s.mode=Wv;case Wv:for(;m<32;){if(c===0)break e;c--,h+=n[l++]<>>8&255,T[2]=h>>>16&255,T[3]=h>>>24&255,s.check=Eo(s.check,T,4,0)),h=0,m=0,s.mode=Xv;case Xv:for(;m<16;){if(c===0)break e;c--,h+=n[l++]<>8),s.flags&512&&s.wrap&4&&(T[0]=h&255,T[1]=h>>>8&255,s.check=Eo(s.check,T,2,0)),h=0,m=0,s.mode=Yv;case Yv:if(s.flags&1024){for(;m<16;){if(c===0)break e;c--,h+=n[l++]<>>8&255,s.check=Eo(s.check,T,2,0)),h=0,m=0}else s.head&&(s.head.extra=null);s.mode=Jv;case Jv:if(s.flags&1024&&(p=s.length,p>c&&(p=c),p&&(s.head&&(M=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Uint8Array(s.head.extra_len)),s.head.extra.set(n.subarray(l,l+p),M)),s.flags&512&&s.wrap&4&&(s.check=Eo(s.check,n,p,l)),c-=p,l+=p,s.length-=p),s.length))break e;s.length=0,s.mode=Zv;case Zv:if(s.flags&2048){if(c===0)break e;p=0;do M=n[l+p++],s.head&&M&&s.length<65536&&(s.head.name+=String.fromCharCode(M));while(M&&p>9&1,s.head.done=!0),r.adler=s.check=0,s.mode=yl;break;case t2:for(;m<32;){if(c===0)break e;c--,h+=n[l++]<>>=m&7,m-=m&7,s.mode=Ag;break}for(;m<3;){if(c===0)break e;c--,h+=n[l++]<>>=1,m-=1,h&3){case 0:s.mode=r2;break;case 1:if(Ck(s),s.mode=Vf,t===Gf){h>>>=2,m-=2;break e}break;case 2:s.mode=a2;break;case 3:r.msg="invalid block type",s.mode=us}h>>>=2,m-=2;break;case r2:for(h>>>=m&7,m-=m&7;m<32;){if(c===0)break e;c--,h+=n[l++]<>>16^65535)){r.msg="invalid stored block lengths",s.mode=us;break}if(s.length=h&65535,h=0,m=0,s.mode=lg,t===Gf)break e;case lg:s.mode=s2;case s2:if(p=s.length,p){if(p>c&&(p=c),p>u&&(p=u),p===0)break e;o.set(n.subarray(l,l+p),d),c-=p,l+=p,u-=p,d+=p,s.length-=p;break}s.mode=yl;break;case a2:for(;m<14;){if(c===0)break e;c--,h+=n[l++]<>>=5,m-=5,s.ndist=(h&31)+1,h>>>=5,m-=5,s.ncode=(h&15)+4,h>>>=4,m-=4,s.nlen>286||s.ndist>30){r.msg="too many length or distance symbols",s.mode=us;break}s.have=0,s.mode=n2;case n2:for(;s.have>>=3,m-=3}for(;s.have<19;)s.lens[U[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,ne={bits:s.lenbits},V=Bh(mk,s.lens,0,19,s.lencode,0,s.work,ne),s.lenbits=ne.bits,V){r.msg="invalid code lengths set",s.mode=us;break}s.have=0,s.mode=i2;case i2:for(;s.have>>24,j=B>>>16&255,_=B&65535,!(g<=m);){if(c===0)break e;c--,h+=n[l++]<>>=g,m-=g,s.lens[s.have++]=_;else{if(_===16){for(Z=g+2;m>>=g,m-=g,s.have===0){r.msg="invalid bit length repeat",s.mode=us;break}M=s.lens[s.have-1],p=3+(h&3),h>>>=2,m-=2}else if(_===17){for(Z=g+3;m>>=g,m-=g,M=0,p=3+(h&7),h>>>=3,m-=3}else{for(Z=g+7;m>>=g,m-=g,M=0,p=11+(h&127),h>>>=7,m-=7}if(s.have+p>s.nlen+s.ndist){r.msg="invalid bit length repeat",s.mode=us;break}for(;p--;)s.lens[s.have++]=M}}if(s.mode===us)break;if(s.lens[256]===0){r.msg="invalid code -- missing end-of-block",s.mode=us;break}if(s.lenbits=9,ne={bits:s.lenbits},V=Bh(_4,s.lens,0,s.nlen,s.lencode,0,s.work,ne),s.lenbits=ne.bits,V){r.msg="invalid literal/lengths set",s.mode=us;break}if(s.distbits=6,s.distcode=s.distdyn,ne={bits:s.distbits},V=Bh(k4,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,ne),s.distbits=ne.bits,V){r.msg="invalid distances set",s.mode=us;break}if(s.mode=Vf,t===Gf)break e;case Vf:s.mode=Wf;case Wf:if(c>=6&&u>=258){r.next_out=d,r.avail_out=u,r.next_in=l,r.avail_in=c,s.hold=h,s.bits=m,Ak(r,y),d=r.next_out,o=r.output,u=r.avail_out,l=r.next_in,n=r.input,c=r.avail_in,h=s.hold,m=s.bits,s.mode===yl&&(s.back=-1);break}for(s.back=0;B=s.lencode[h&(1<>>24,j=B>>>16&255,_=B&65535,!(g<=m);){if(c===0)break e;c--,h+=n[l++]<>w)],g=B>>>24,j=B>>>16&255,_=B&65535,!(w+g<=m);){if(c===0)break e;c--,h+=n[l++]<>>=w,m-=w,s.back+=w}if(h>>>=g,m-=g,s.back+=g,s.length=_,j===0){s.mode=d2;break}if(j&32){s.back=-1,s.mode=yl;break}if(j&64){r.msg="invalid literal/length code",s.mode=us;break}s.extra=j&15,s.mode=o2;case o2:if(s.extra){for(Z=s.extra;m>>=s.extra,m-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=l2;case l2:for(;B=s.distcode[h&(1<>>24,j=B>>>16&255,_=B&65535,!(g<=m);){if(c===0)break e;c--,h+=n[l++]<>w)],g=B>>>24,j=B>>>16&255,_=B&65535,!(w+g<=m);){if(c===0)break e;c--,h+=n[l++]<>>=w,m-=w,s.back+=w}if(h>>>=g,m-=g,s.back+=g,j&64){r.msg="invalid distance code",s.mode=us;break}s.offset=_,s.extra=j&15,s.mode=A2;case A2:if(s.extra){for(Z=s.extra;m>>=s.extra,m-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){r.msg="invalid distance too far back",s.mode=us;break}s.mode=c2;case c2:if(u===0)break e;if(p=y-u,s.offset>p){if(p=s.offset-p,p>s.whave&&s.sane){r.msg="invalid distance too far back",s.mode=us;break}p>s.wnext?(p-=s.wnext,v=s.wsize-p):v=s.wnext-p,p>s.length&&(p=s.length),N=s.window}else N=o,v=d-s.offset,p=s.length;p>u&&(p=u),u-=p,s.length-=p;do o[d++]=N[v++];while(--p);s.length===0&&(s.mode=Wf);break;case d2:if(u===0)break e;o[d++]=s.length,u--,s.mode=Wf;break;case Ag:if(s.wrap){for(;m<32;){if(c===0)break e;c--,h|=n[l++]<{if(Tc(r))return ji;let t=r.state;return t.window&&(t.window=null),r.state=null,Qc},kk=(r,t)=>{if(Tc(r))return ji;const s=r.state;return(s.wrap&2)===0?ji:(s.head=t,t.done=!1,Qc)},Fk=(r,t)=>{const s=t.length;let n,o,l;return Tc(r)||(n=r.state,n.wrap!==0&&n.mode!==Zm)?ji:n.mode===Zm&&(o=1,o=Pb(o,t,s,0),o!==n.check)?F4:(l=R4(r,t,s,s),l?(n.mode=U4,E4):(n.havedict=1,Qc))};var Ek=T4,Uk=I4,Qk=L4,Lk=jk,Tk=D4,Ik=Sk,Dk=_k,Rk=kk,Ok=Fk,Hk="pako inflate (from Nodeca project)",jl={inflateReset:Ek,inflateReset2:Uk,inflateResetKeep:Qk,inflateInit:Lk,inflateInit2:Tk,inflate:Ik,inflateEnd:Dk,inflateGetHeader:Rk,inflateSetDictionary:Ok,inflateInfo:Hk};function Mk(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Pk=Mk;const O4=Object.prototype.toString,{Z_NO_FLUSH:Kk,Z_FINISH:zk,Z_OK:Dh,Z_STREAM_END:ug,Z_NEED_DICT:hg,Z_STREAM_ERROR:qk,Z_DATA_ERROR:p2,Z_MEM_ERROR:Gk}=j4;function Kh(r){this.options=C4.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ok,this.strm.avail_out=0;let s=jl.inflateInit2(this.strm,t.windowBits);if(s!==Dh)throw new Error(Kb[s]);if(this.header=new Pk,jl.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=zb.string2buf(t.dictionary):O4.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=jl.inflateSetDictionary(this.strm,t.dictionary),s!==Dh)))throw new Error(Kb[s])}Kh.prototype.push=function(r,t){const s=this.strm,n=this.options.chunkSize,o=this.options.dictionary;let l,d,c;if(this.ended)return!1;for(t===~~t?d=t:d=t===!0?zk:Kk,O4.call(r)==="[object ArrayBuffer]"?s.input=new Uint8Array(r):s.input=r,s.next_in=0,s.avail_in=s.input.length;;){for(s.avail_out===0&&(s.output=new Uint8Array(n),s.next_out=0,s.avail_out=n),l=jl.inflate(s,d),l===hg&&o&&(l=jl.inflateSetDictionary(s,o),l===Dh?l=jl.inflate(s,d):l===p2&&(l=hg));s.avail_in>0&&l===ug&&s.state.wrap>0&&r[s.next_in]!==0;)jl.inflateReset(s),l=jl.inflate(s,d);switch(l){case qk:case p2:case hg:case Gk:return this.onEnd(l),this.ended=!0,!1}if(c=s.avail_out,s.next_out&&(s.avail_out===0||l===ug))if(this.options.to==="string"){let u=zb.utf8border(s.output,s.next_out),h=s.next_out-u,m=zb.buf2string(s.output,u);s.next_out=h,s.avail_out=n-h,h&&s.output.set(s.output.subarray(u,u+h),0),this.onData(m)}else this.onData(s.output.length===s.next_out?s.output:s.output.subarray(0,s.next_out));if(!(l===Dh&&c===0)){if(l===ug)return l=jl.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(s.avail_in===0)break}}return!0};Kh.prototype.onData=function(r){this.chunks.push(r)};Kh.prototype.onEnd=function(r){r===Dh&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=C4.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Vk(r,t){const s=new Kh(t);if(s.push(r),s.err)throw s.msg||Kb[s.err];return s.result}var Wk=Kh,Xk=Vk,Yk={Inflate:Wk,inflate:Xk};const{Inflate:Jk,inflate:Zk}=Yk;var x2=Jk,$k=Zk;const H4=[];for(let r=0;r<256;r++){let t=r;for(let s=0;s<8;s++)t&1?t=3988292384^t>>>1:t=t>>>1;H4[r]=t}const g2=4294967295;function eF(r,t,s){let n=r;for(let o=0;o>>8;return n}function tF(r,t){return(eF(g2,r,t)^g2)>>>0}function b2(r,t,s){const n=r.readUint32(),o=tF(new Uint8Array(r.buffer,r.byteOffset+r.offset-t-4,t),t);if(o!==n)throw new Error(`CRC mismatch for chunk ${s}. Expected ${n}, found ${o}`)}function M4(r,t,s){for(let n=0;n>1)&255}else{for(;l>1)&255;for(;l>1)&255}}function q4(r,t,s,n,o){let l=0;if(s.length===0){for(;l=s||K>=n))for(let M=0;M>8&255}const AF=new Uint16Array([255]),cF=new Uint8Array(AF.buffer),dF=cF[0]===255,uF=new Uint8Array(0);function y2(r){const{data:t,width:s,height:n,channels:o,depth:l}=r,d=Math.ceil(l/8)*o,c=Math.ceil(l/8*o*s),u=new Uint8Array(n*c);let h=uF,m=0,x,y;for(let p=0;p>8&255}const Dm=Uint8Array.of(137,80,78,71,13,10,26,10);function w2(r){if(!fF(r.readBytes(Dm.length)))throw new Error("wrong PNG signature")}function fF(r){if(r.length79)throw new Error("keyword length must be between 1 and 79")}const gF=/^[\u0000-\u00FF]*$/;function bF(r){if(!gF.test(r))throw new Error("invalid latin1 text")}function yF(r,t,s){const n=V4(t);r[n]=wF(t,s-n.length-1)}function V4(r){for(r.mark();r.readByte()!==pF;);const t=r.offset;r.reset();const s=G4.decode(r.readBytes(t-r.offset-1));return r.skip(1),xF(s),s}function wF(r,t){return G4.decode(r.readBytes(t))}const Gn={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},fg={UNKNOWN:-1,DEFLATE:0},v2={UNKNOWN:-1,ADAPTIVE:0},mg={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Xf={NONE:0,BACKGROUND:1,PREVIOUS:2},pg={SOURCE:0,OVER:1};class vF extends Qy{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,s={}){super(t);const{checkCrc:n=!1}=s;this._checkCrc=n,this._inflator=new x2,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=fg.UNKNOWN,this._filterMethod=v2.UNKNOWN,this._interlaceMethod=mg.UNKNOWN,this._colorType=Gn.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(w2(this);!this._end;){const t=this.readUint32(),s=this.readChars(4);this.decodeChunk(t,s)}return this.decodeImage(),this._png}decodeApng(){for(w2(this);!this._end;){const t=this.readUint32(),s=this.readChars(4);this.decodeApngChunk(t,s)}return this.decodeApngImage(),this._apng}decodeChunk(t,s){const n=this.offset;switch(s){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case mF:yF(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t);break}if(this.offset-n!==t)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?b2(this,t+4,s):this.skip(4)}decodeApngChunk(t,s){const n=this.offset;switch(s!=="fdAT"&&s!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),s){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,s),this.offset=n+t;break}if(this.offset-n!==t)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?b2(this,t+4,s):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=NF(this.readUint8());const s=this.readUint8();this._colorType=s;let n;switch(s){case Gn.GREYSCALE:n=1;break;case Gn.TRUECOLOUR:n=3;break;case Gn.INDEXED_COLOUR:n=1;break;case Gn.GREYSCALE_ALPHA:n=2;break;case Gn.TRUECOLOUR_ALPHA:n=4;break;case Gn.UNKNOWN:default:throw new Error(`Unknown color type: ${s}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==fg.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);const s=t/3;this._hasPalette=!0;const n=[];this._palette=n;for(let o=0;othis._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let s=0;sthis._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let s=0;for(;s{const c=((l+s.yOffset)*this._png.width+s.xOffset+d)*this._png.channels,u=(l*s.width+d)*this._png.channels;return{index:c,frameIndex:u}};switch(s.blendOp){case pg.SOURCE:for(let l=0;l=200&&t.status<=299}function Yf(r){try{r.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),r.dispatchEvent(t)}}var mc=Wt.saveAs||((typeof window>"u"?"undefined":Yr(window))!=="object"||window!==Wt?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(r,t,s){var n=Wt.URL||Wt.webkitURL,o=document.createElement("a");t=t||r.name||"download",o.download=t,o.rel="noopener",typeof r=="string"?(o.href=r,o.origin!==location.origin?B2(o.href)?gg(r,t,s):Yf(o,o.target="_blank"):Yf(o)):(o.href=n.createObjectURL(r),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){Yf(o)},0))}:"msSaveOrOpenBlob"in navigator?function(r,t,s){if(t=t||r.name||"download",typeof r=="string")if(B2(r))gg(r,t,s);else{var n=document.createElement("a");n.href=r,n.target="_blank",setTimeout(function(){Yf(n)})}else navigator.msSaveOrOpenBlob((function(o,l){return l===void 0?l={autoBom:!1}:Yr(l)!=="object"&&(Xr.warn("Deprecated: Expected third argument to be a object"),l={autoBom:!l}),l.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(o.type)?new Blob(["\uFEFF",o],{type:o.type}):o})(r,s),t)}:function(r,t,s,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),typeof r=="string")return gg(r,t,s);var o=r.type==="application/octet-stream",l=/constructor/i.test(Wt.HTMLElement)||Wt.safari,d=/CriOS\/[\d]+/.test(navigator.userAgent);if((d||o&&l)&&(typeof FileReader>"u"?"undefined":Yr(FileReader))==="object"){var c=new FileReader;c.onloadend=function(){var m=c.result;m=d?m:m.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=m:location=m,n=null},c.readAsDataURL(r)}else{var u=Wt.URL||Wt.webkitURL,h=u.createObjectURL(r);n?n.location=h:location.href=h,n=null,setTimeout(function(){u.revokeObjectURL(h)},4e4)}});function W4(r){var t;r=r||"",this.ok=!1,r.charAt(0)=="#"&&(r=r.substr(1,6)),r={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[r=(r=r.replace(/ /g,"")).toLowerCase()]||r;for(var s=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(c){return[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(c){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(c){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]}}],n=0;n255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var c=this.r.toString(16),u=this.g.toString(16),h=this.b.toString(16);return c.length==1&&(c="0"+c),u.length==1&&(u="0"+u),h.length==1&&(h="0"+h),"#"+c+u+h}}var Rm=Wt.atob.bind(Wt),j2=Wt.btoa.bind(Wt);function bg(r,t){var s=r[0],n=r[1],o=r[2],l=r[3];s=Da(s,n,o,l,t[0],7,-680876936),l=Da(l,s,n,o,t[1],12,-389564586),o=Da(o,l,s,n,t[2],17,606105819),n=Da(n,o,l,s,t[3],22,-1044525330),s=Da(s,n,o,l,t[4],7,-176418897),l=Da(l,s,n,o,t[5],12,1200080426),o=Da(o,l,s,n,t[6],17,-1473231341),n=Da(n,o,l,s,t[7],22,-45705983),s=Da(s,n,o,l,t[8],7,1770035416),l=Da(l,s,n,o,t[9],12,-1958414417),o=Da(o,l,s,n,t[10],17,-42063),n=Da(n,o,l,s,t[11],22,-1990404162),s=Da(s,n,o,l,t[12],7,1804603682),l=Da(l,s,n,o,t[13],12,-40341101),o=Da(o,l,s,n,t[14],17,-1502002290),s=Ra(s,n=Da(n,o,l,s,t[15],22,1236535329),o,l,t[1],5,-165796510),l=Ra(l,s,n,o,t[6],9,-1069501632),o=Ra(o,l,s,n,t[11],14,643717713),n=Ra(n,o,l,s,t[0],20,-373897302),s=Ra(s,n,o,l,t[5],5,-701558691),l=Ra(l,s,n,o,t[10],9,38016083),o=Ra(o,l,s,n,t[15],14,-660478335),n=Ra(n,o,l,s,t[4],20,-405537848),s=Ra(s,n,o,l,t[9],5,568446438),l=Ra(l,s,n,o,t[14],9,-1019803690),o=Ra(o,l,s,n,t[3],14,-187363961),n=Ra(n,o,l,s,t[8],20,1163531501),s=Ra(s,n,o,l,t[13],5,-1444681467),l=Ra(l,s,n,o,t[2],9,-51403784),o=Ra(o,l,s,n,t[7],14,1735328473),s=Oa(s,n=Ra(n,o,l,s,t[12],20,-1926607734),o,l,t[5],4,-378558),l=Oa(l,s,n,o,t[8],11,-2022574463),o=Oa(o,l,s,n,t[11],16,1839030562),n=Oa(n,o,l,s,t[14],23,-35309556),s=Oa(s,n,o,l,t[1],4,-1530992060),l=Oa(l,s,n,o,t[4],11,1272893353),o=Oa(o,l,s,n,t[7],16,-155497632),n=Oa(n,o,l,s,t[10],23,-1094730640),s=Oa(s,n,o,l,t[13],4,681279174),l=Oa(l,s,n,o,t[0],11,-358537222),o=Oa(o,l,s,n,t[3],16,-722521979),n=Oa(n,o,l,s,t[6],23,76029189),s=Oa(s,n,o,l,t[9],4,-640364487),l=Oa(l,s,n,o,t[12],11,-421815835),o=Oa(o,l,s,n,t[15],16,530742520),s=Ha(s,n=Oa(n,o,l,s,t[2],23,-995338651),o,l,t[0],6,-198630844),l=Ha(l,s,n,o,t[7],10,1126891415),o=Ha(o,l,s,n,t[14],15,-1416354905),n=Ha(n,o,l,s,t[5],21,-57434055),s=Ha(s,n,o,l,t[12],6,1700485571),l=Ha(l,s,n,o,t[3],10,-1894986606),o=Ha(o,l,s,n,t[10],15,-1051523),n=Ha(n,o,l,s,t[1],21,-2054922799),s=Ha(s,n,o,l,t[8],6,1873313359),l=Ha(l,s,n,o,t[15],10,-30611744),o=Ha(o,l,s,n,t[6],15,-1560198380),n=Ha(n,o,l,s,t[13],21,1309151649),s=Ha(s,n,o,l,t[4],6,-145523070),l=Ha(l,s,n,o,t[11],10,-1120210379),o=Ha(o,l,s,n,t[2],15,718787259),n=Ha(n,o,l,s,t[9],21,-343485551),r[0]=wA(s,r[0]),r[1]=wA(n,r[1]),r[2]=wA(o,r[2]),r[3]=wA(l,r[3])}function gp(r,t,s,n,o,l){return t=wA(wA(t,r),wA(n,l)),wA(t<>>32-o,s)}function Da(r,t,s,n,o,l,d){return gp(t&s|~t&n,r,t,o,l,d)}function Ra(r,t,s,n,o,l,d){return gp(t&n|s&~n,r,t,o,l,d)}function Oa(r,t,s,n,o,l,d){return gp(t^s^n,r,t,o,l,d)}function Ha(r,t,s,n,o,l,d){return gp(s^(t|~n),r,t,o,l,d)}function X4(r){var t,s=r.length,n=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=r.length;t+=64)bg(n,jF(r.substring(t-64,t)));r=r.substring(t-64);var o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=r.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(bg(n,o),t=0;t<16;t++)o[t]=0;return o[14]=8*s,bg(n,o),n}function jF(r){var t,s=[];for(t=0;t<64;t+=4)s[t>>2]=r.charCodeAt(t)+(r.charCodeAt(t+1)<<8)+(r.charCodeAt(t+2)<<16)+(r.charCodeAt(t+3)<<24);return s}var C2="0123456789abcdef".split("");function CF(r){for(var t="",s=0;s<4;s++)t+=C2[r>>8*s+4&15]+C2[r>>8*s&15];return t}function SF(r){return String.fromCharCode(255&r,(65280&r)>>8,(16711680&r)>>16,(4278190080&r)>>24)}function qb(r){return X4(r).map(SF).join("")}var _F=(function(r){for(var t=0;t>16)+(t>>16)+(s>>16)<<16|65535&s}return r+t&4294967295}function Gb(r,t){var s,n,o,l;if(r!==s){for(var d=(o=r,l=1+(256/r.length|0),new Array(l+1).join(o)),c=[],u=0;u<256;u++)c[u]=u;var h=0;for(u=0;u<256;u++){var m=c[u];h=(h+m+d.charCodeAt(u))%256,c[u]=c[h],c[h]=m}s=r,n=c}else c=n;var x=t.length,y=0,p=0,v="";for(u=0;u€/\f©þdSiz";var l=(t+this.padding).substr(0,32),d=(s+this.padding).substr(0,32);this.O=this.processOwnerPassword(l,d),this.P=-(1+(255^o)),this.encryptionKey=qb(l+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=Gb(this.encryptionKey,this.padding)}function Md(r){if(/[^\u0000-\u00ff]/.test(r))throw new Error("Invalid PDF Name Object: "+r+", Only accept ASCII characters.");for(var t="",s=r.length,n=0;n126?"#"+("0"+o.toString(16)).slice(-2):r[n]}return t}function _2(r){if(Yr(r)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(s,n,o){if(o=o||!1,typeof s!="string"||typeof n!="function"||typeof o!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(s)||(t[s]={});var l=Math.random().toString(35);return t[s][l]=[n,!!o],l},this.unsubscribe=function(s){for(var n in t)if(t[n][s])return delete t[n][s],Object.keys(t[n]).length===0&&delete t[n],!0;return!1},this.publish=function(s){if(t.hasOwnProperty(s)){var n=Array.prototype.slice.call(arguments,1),o=[];for(var l in t[s]){var d=t[s][l];try{d[0].apply(r,n)}catch(c){Wt.console&&Xr.error("jsPDF PubSub Error",c.message,c)}d[1]&&o.push(l)}o.length&&o.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function $m(r){if(!(this instanceof $m))return new $m(r);var t="opacity,stroke-opacity".split(",");for(var s in r)r.hasOwnProperty(s)&&t.indexOf(s)>=0&&(this[s]=r[s]);this.id="",this.objectNumber=-1}function Y4(r,t){this.gState=r,this.matrix=t,this.id="",this.objectNumber=-1}function pc(r,t,s,n,o){if(!(this instanceof pc))return new pc(r,t,s,n,o);this.type=r==="axial"?2:3,this.coords=t,this.colors=s,Y4.call(this,n,o)}function qd(r,t,s,n,o){if(!(this instanceof qd))return new qd(r,t,s,n,o);this.boundingBox=r,this.xStep=t,this.yStep=s,this.stream="",this.cloneIndex=0,Y4.call(this,n,o)}function Ft(r){var t,s=typeof arguments[0]=="string"?arguments[0]:"p",n=arguments[1],o=arguments[2],l=arguments[3],d=[],c=1,u=16,h="S",m=null;Yr(r=r||{})==="object"&&(s=r.orientation,n=r.unit||n,o=r.format||o,l=r.compress||r.compressPdf||l,(m=r.encryption||null)!==null&&(m.userPassword=m.userPassword||"",m.ownerPassword=m.ownerPassword||"",m.userPermissions=m.userPermissions||[]),c=typeof r.userUnit=="number"?Math.abs(r.userUnit):1,r.precision!==void 0&&(t=r.precision),r.floatPrecision!==void 0&&(u=r.floatPrecision),h=r.defaultPathOperation||"S"),d=r.filters||(l===!0?["FlateEncode"]:d),n=n||"mm",s=(""+(s||"P")).toLowerCase();var x=r.putOnlyUsedFonts||!1,y={},p={internal:{},__private__:{}};p.__private__.PubSub=_2;var v="1.3",N=p.__private__.getPdfVersion=function(){return v};p.__private__.setPdfVersion=function(R){v=R};var B={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};p.__private__.getPageFormats=function(){return B};var g=p.__private__.getPageFormat=function(R){return B[R]};o=o||"a4";var j="compat",_="advanced",w=j;function L(){this.saveGraphicsState(),ie(new Et(Tt,0,0,-Tt,0,Ti()*Tt).toString()+" cm"),this.setFontSize(this.getFontSize()/Tt),h="n",w=_}function K(){this.restoreGraphicsState(),h="S",w=j}var M=p.__private__.combineFontStyleAndFontWeight=function(R,de){if(R=="bold"&&de=="normal"||R=="bold"&&de==400||R=="normal"&&de=="italic"||R=="bold"&&de=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return de&&(R=de==400||de==="normal"?R==="italic"?"italic":"normal":de!=700&&de!=="bold"||R!=="normal"?(de==700?"bold":de)+""+R:"bold"),R};p.advancedAPI=function(R){var de=w===j;return de&&L.call(this),typeof R!="function"||(R(this),de&&K.call(this)),this},p.compatAPI=function(R){var de=w===_;return de&&K.call(this),typeof R!="function"||(R(this),de&&L.call(this)),this},p.isAdvancedAPI=function(){return w===_};var V,T=function(R){if(w!==_)throw new Error(R+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},ne=p.roundToPrecision=p.__private__.roundToPrecision=function(R,de){var je=t||de;if(isNaN(R)||isNaN(je))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return R.toFixed(je).replace(/0+$/,"")};V=p.hpf=p.__private__.hpf=typeof u=="number"?function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.hpf");return ne(R,u)}:u==="smart"?function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.hpf");return ne(R,R>-1&&R<1?16:5)}:function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.hpf");return ne(R,16)};var Z=p.f2=p.__private__.f2=function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.f2");return ne(R,2)},U=p.__private__.f3=function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.f3");return ne(R,3)},q=p.scale=p.__private__.scale=function(R){if(isNaN(R))throw new Error("Invalid argument passed to jsPDF.scale");return w===j?R*Tt:w===_?R:void 0},F=function(R){return q((function(de){return w===j?Ti()-de:w===_?de:void 0})(R))};p.__private__.setPrecision=p.setPrecision=function(R){typeof parseInt(R,10)=="number"&&(t=parseInt(R,10))};var le,ae="00000000000000000000000000000000",se=p.__private__.getFileId=function(){return ae},fe=p.__private__.setFileId=function(R){return ae=R!==void 0&&/^[a-fA-F0-9]{32}$/.test(R)?R.toUpperCase():ae.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),m!==null&&(Ls=new Hd(m.userPermissions,m.userPassword,m.ownerPassword,ae)),ae};p.setFileId=function(R){return fe(R),this},p.getFileId=function(){return se()};var ye=p.__private__.convertDateToPDFDate=function(R){var de=R.getTimezoneOffset(),je=de<0?"+":"-",Fe=Math.floor(Math.abs(de/60)),Te=Math.abs(de%60),Je=[je,X(Fe),"'",X(Te),"'"].join("");return["D:",R.getFullYear(),X(R.getMonth()+1),X(R.getDate()),X(R.getHours()),X(R.getMinutes()),X(R.getSeconds()),Je].join("")},_e=p.__private__.convertPDFDateToDate=function(R){var de=parseInt(R.substr(2,4),10),je=parseInt(R.substr(6,2),10)-1,Fe=parseInt(R.substr(8,2),10),Te=parseInt(R.substr(10,2),10),Je=parseInt(R.substr(12,2),10),at=parseInt(R.substr(14,2),10);return new Date(de,je,Fe,Te,Je,at,0)},xe=p.__private__.setCreationDate=function(R){var de;if(R===void 0&&(R=new Date),R instanceof Date)de=ye(R);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(R))throw new Error("Invalid argument passed to jsPDF.setCreationDate");de=R}return le=de},D=p.__private__.getCreationDate=function(R){var de=le;return R==="jsDate"&&(de=_e(le)),de};p.setCreationDate=function(R){return xe(R),this},p.getCreationDate=function(R){return D(R)};var $,X=p.__private__.padd2=function(R){return("0"+parseInt(R)).slice(-2)},te=p.__private__.padd2Hex=function(R){return("00"+(R=R.toString())).substr(R.length)},J=0,O=[],H=[],re=0,Ae=[],oe=[],ce=!1,Se=H;p.__private__.setCustomOutputDestination=function(R){ce=!0,Se=R};var z=function(R){ce||(Se=R)};p.__private__.resetCustomOutputDestination=function(){ce=!1,Se=H};var ie=p.__private__.out=function(R){return R=R.toString(),re+=R.length+1,Se.push(R),Se},W=p.__private__.write=function(R){return ie(arguments.length===1?R.toString():Array.prototype.join.call(arguments," "))},Q=p.__private__.getArrayBuffer=function(R){for(var de=R.length,je=new ArrayBuffer(de),Fe=new Uint8Array(je);de--;)Fe[de]=R.charCodeAt(de);return je},I=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];p.__private__.getStandardFonts=function(){return I};var k=r.fontSize||16;p.__private__.setFontSize=p.setFontSize=function(R){return k=w===_?R/Tt:R,this};var G,me=p.__private__.getFontSize=p.getFontSize=function(){return w===j?k:k*Tt},be=r.R2L||!1;p.__private__.setR2L=p.setR2L=function(R){return be=R,this},p.__private__.getR2L=p.getR2L=function(){return be};var Ue,Re=p.__private__.setZoomMode=function(R){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(R))G=R;else if(isNaN(R)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(R)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+R+'" is not recognized.');G=R}else G=parseInt(R,10)};p.__private__.getZoomMode=function(){return G};var He,Ve=p.__private__.setPageMode=function(R){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(R)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+R+'" is not recognized.');Ue=R};p.__private__.getPageMode=function(){return Ue};var it=p.__private__.setLayoutMode=function(R){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(R)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+R+'" is not recognized.');He=R};p.__private__.getLayoutMode=function(){return He},p.__private__.setDisplayMode=p.setDisplayMode=function(R,de,je){return Re(R),it(de),Ve(je),this};var lt={title:"",subject:"",author:"",keywords:"",creator:""};p.__private__.getDocumentProperty=function(R){if(Object.keys(lt).indexOf(R)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return lt[R]},p.__private__.getDocumentProperties=function(){return lt},p.__private__.setDocumentProperties=p.setProperties=p.setDocumentProperties=function(R){for(var de in lt)lt.hasOwnProperty(de)&&R[de]&&(lt[de]=R[de]);return this},p.__private__.setDocumentProperty=function(R,de){if(Object.keys(lt).indexOf(R)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return lt[R]=de};var ut,Tt,mt,Ur,jt,_t={},Dt={},Gt=[],kt={},Fr={},It={},Pt={},Br=null,zt=0,Bt=[],cr=new _2(p),_n=r.hotfixes||[],Aa={},Xn={},an=[],Et=function R(de,je,Fe,Te,Je,at){if(!(this instanceof R))return new R(de,je,Fe,Te,Je,at);isNaN(de)&&(de=1),isNaN(je)&&(je=0),isNaN(Fe)&&(Fe=0),isNaN(Te)&&(Te=1),isNaN(Je)&&(Je=0),isNaN(at)&&(at=0),this._matrix=[de,je,Fe,Te,Je,at]};Object.defineProperty(Et.prototype,"sx",{get:function(){return this._matrix[0]},set:function(R){this._matrix[0]=R}}),Object.defineProperty(Et.prototype,"shy",{get:function(){return this._matrix[1]},set:function(R){this._matrix[1]=R}}),Object.defineProperty(Et.prototype,"shx",{get:function(){return this._matrix[2]},set:function(R){this._matrix[2]=R}}),Object.defineProperty(Et.prototype,"sy",{get:function(){return this._matrix[3]},set:function(R){this._matrix[3]=R}}),Object.defineProperty(Et.prototype,"tx",{get:function(){return this._matrix[4]},set:function(R){this._matrix[4]=R}}),Object.defineProperty(Et.prototype,"ty",{get:function(){return this._matrix[5]},set:function(R){this._matrix[5]=R}}),Object.defineProperty(Et.prototype,"a",{get:function(){return this._matrix[0]},set:function(R){this._matrix[0]=R}}),Object.defineProperty(Et.prototype,"b",{get:function(){return this._matrix[1]},set:function(R){this._matrix[1]=R}}),Object.defineProperty(Et.prototype,"c",{get:function(){return this._matrix[2]},set:function(R){this._matrix[2]=R}}),Object.defineProperty(Et.prototype,"d",{get:function(){return this._matrix[3]},set:function(R){this._matrix[3]=R}}),Object.defineProperty(Et.prototype,"e",{get:function(){return this._matrix[4]},set:function(R){this._matrix[4]=R}}),Object.defineProperty(Et.prototype,"f",{get:function(){return this._matrix[5]},set:function(R){this._matrix[5]=R}}),Object.defineProperty(Et.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Et.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Et.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Et.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Et.prototype.join=function(R){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(V).join(R)},Et.prototype.multiply=function(R){var de=R.sx*this.sx+R.shy*this.shx,je=R.sx*this.shy+R.shy*this.sy,Fe=R.shx*this.sx+R.sy*this.shx,Te=R.shx*this.shy+R.sy*this.sy,Je=R.tx*this.sx+R.ty*this.shx+this.tx,at=R.tx*this.shy+R.ty*this.sy+this.ty;return new Et(de,je,Fe,Te,Je,at)},Et.prototype.decompose=function(){var R=this.sx,de=this.shy,je=this.shx,Fe=this.sy,Te=this.tx,Je=this.ty,at=Math.sqrt(R*R+de*de),yt=(R/=at)*je+(de/=at)*Fe;je-=R*yt,Fe-=de*yt;var Ct=Math.sqrt(je*je+Fe*Fe);return yt/=Ct,R*(Fe/=Ct)>16&255,Fe=Ct>>8&255,Te=255&Ct}if(Fe===void 0||Je===void 0&&je===Fe&&Fe===Te)de=typeof je=="string"?je+" "+at[0]:R.precision===2?Z(je/255)+" "+at[0]:U(je/255)+" "+at[0];else if(Je===void 0||Yr(Je)==="object"){if(Je&&!isNaN(Je.a)&&Je.a===0)return["1.","1.","1.",at[1]].join(" ");de=typeof je=="string"?[je,Fe,Te,at[1]].join(" "):R.precision===2?[Z(je/255),Z(Fe/255),Z(Te/255),at[1]].join(" "):[U(je/255),U(Fe/255),U(Te/255),at[1]].join(" ")}else de=typeof je=="string"?[je,Fe,Te,Je,at[2]].join(" "):R.precision===2?[Z(je),Z(Fe),Z(Te),Z(Je),at[2]].join(" "):[U(je),U(Fe),U(Te),U(Je),at[2]].join(" ");return de},Va=p.__private__.getFilters=function(){return d},nn=p.__private__.putStream=function(R){var de=(R=R||{}).data||"",je=R.filters||Va(),Fe=R.alreadyAppliedFilters||[],Te=R.addLength1||!1,Je=de.length,at=R.objectId,yt=function(Ts){return Ts};if(m!==null&&at===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");m!==null&&(yt=Ls.encryptor(at,0));var Ct={};je===!0&&(je=["FlateEncode"]);var Kt=R.additionalKeyValues||[],Yt=(Ct=Ft.API.processDataByFilters!==void 0?Ft.API.processDataByFilters(de,je):{data:de,reverseChain:[]}).reverseChain+(Array.isArray(Fe)?Fe.join(" "):Fe.toString());if(Ct.data.length!==0&&(Kt.push({key:"Length",value:Ct.data.length}),Te===!0&&Kt.push({key:"Length1",value:Je})),Yt.length!=0)if(Yt.split("/").length-1==1)Kt.push({key:"Filter",value:Yt});else{Kt.push({key:"Filter",value:"["+Yt+"]"});for(var dr=0;dr>"),Ct.data.length!==0&&(ie("stream"),ie(yt(Ct.data)),ie("endstream"))},qo=p.__private__.putPage=function(R){var de=R.number,je=R.data,Fe=R.objId,Te=R.contentsObjId;qs(Fe,!0),ie("<>"),ie("endobj");var Je=je.join(` +`);return w===_&&(Je+=` +Q`),qs(Te,!0),nn({data:Je,filters:Va(),objectId:Te}),ie("endobj"),Fe},kn=p.__private__.putPages=function(){var R,de,je=[];for(R=1;R<=zt;R++)Bt[R].objId=ws(),Bt[R].contentsObjId=ws();for(R=1;R<=zt;R++)je.push(qo({number:R,data:oe[R],objId:Bt[R].objId,contentsObjId:Bt[R].contentsObjId,mediaBox:Bt[R].mediaBox,cropBox:Bt[R].cropBox,bleedBox:Bt[R].bleedBox,trimBox:Bt[R].trimBox,artBox:Bt[R].artBox,userUnit:Bt[R].userUnit,rootDictionaryObjId:wa,resourceDictionaryObjId:Qr}));qs(wa,!0),ie("<>"),ie("endobj"),cr.publish("postPutPages")},Fn=function(R){cr.publish("putFont",{font:R,out:ie,newObject:Jr,putStream:nn}),R.isAlreadyPutted!==!0&&(R.objectNumber=Jr(),ie("<<"),ie("/Type /Font"),ie("/BaseFont /"+Md(R.postScriptName)),ie("/Subtype /Type1"),typeof R.encoding=="string"&&ie("/Encoding /"+R.encoding),ie("/FirstChar 32"),ie("/LastChar 255"),ie(">>"),ie("endobj"))},uo=function(R){R.objectNumber=Jr();var de=[];de.push({key:"Type",value:"/XObject"}),de.push({key:"Subtype",value:"/Form"}),de.push({key:"BBox",value:"["+[V(R.x),V(R.y),V(R.x+R.width),V(R.y+R.height)].join(" ")+"]"}),de.push({key:"Matrix",value:"["+R.matrix.toString()+"]"});var je=R.pages[1].join(` +`);nn({data:je,additionalKeyValues:de,objectId:R.objectNumber}),ie("endobj")},En=function(R,de){de||(de=21);var je=Jr(),Fe=(function(at,yt){var Ct,Kt=[],Yt=1/(yt-1);for(Ct=0;Ct<1;Ct+=Yt)Kt.push(Ct);if(Kt.push(1),at[0].offset!=0){var dr={offset:0,color:at[0].color};at.unshift(dr)}if(at[at.length-1].offset!=1){var rs={offset:1,color:at[at.length-1].color};at.push(rs)}for(var ms="",Dr=0,Ts=0;Tsat[Dr+1].offset;)Dr++;var Ns=at[Dr].offset,ea=(Ct-Ns)/(at[Dr+1].offset-Ns),Ii=at[Dr].color,Dn=at[Dr+1].color;ms+=te(Math.round((1-ea)*Ii[0]+ea*Dn[0]).toString(16))+te(Math.round((1-ea)*Ii[1]+ea*Dn[1]).toString(16))+te(Math.round((1-ea)*Ii[2]+ea*Dn[2]).toString(16))}return ms.trim()})(R.colors,de),Te=[];Te.push({key:"FunctionType",value:"0"}),Te.push({key:"Domain",value:"[0.0 1.0]"}),Te.push({key:"Size",value:"["+de+"]"}),Te.push({key:"BitsPerSample",value:"8"}),Te.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Te.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),nn({data:Fe,additionalKeyValues:Te,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:je}),ie("endobj"),R.objectNumber=Jr(),ie("<< /ShadingType "+R.type),ie("/ColorSpace /DeviceRGB");var Je="/Coords ["+V(parseFloat(R.coords[0]))+" "+V(parseFloat(R.coords[1]))+" ";R.type===2?Je+=V(parseFloat(R.coords[2]))+" "+V(parseFloat(R.coords[3])):Je+=V(parseFloat(R.coords[2]))+" "+V(parseFloat(R.coords[3]))+" "+V(parseFloat(R.coords[4]))+" "+V(parseFloat(R.coords[5])),ie(Je+="]"),R.matrix&&ie("/Matrix ["+R.matrix.toString()+"]"),ie("/Function "+je+" 0 R"),ie("/Extend [true true]"),ie(">>"),ie("endobj")},Un=function(R,de){var je=ws(),Fe=Jr();de.push({resourcesOid:je,objectOid:Fe}),R.objectNumber=Fe;var Te=[];Te.push({key:"Type",value:"/Pattern"}),Te.push({key:"PatternType",value:"1"}),Te.push({key:"PaintType",value:"1"}),Te.push({key:"TilingType",value:"1"}),Te.push({key:"BBox",value:"["+R.boundingBox.map(V).join(" ")+"]"}),Te.push({key:"XStep",value:V(R.xStep)}),Te.push({key:"YStep",value:V(R.yStep)}),Te.push({key:"Resources",value:je+" 0 R"}),R.matrix&&Te.push({key:"Matrix",value:"["+R.matrix.toString()+"]"}),nn({data:R.stream,additionalKeyValues:Te,objectId:R.objectNumber}),ie("endobj")},Go=function(R){for(var de in R.objectNumber=Jr(),ie("<<"),R)switch(de){case"opacity":ie("/ca "+Z(R[de]));break;case"stroke-opacity":ie("/CA "+Z(R[de]))}ie(">>"),ie("endobj")},Jn=function(R){qs(R.resourcesOid,!0),ie("<<"),ie("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var de in ie("/Font <<"),_t)_t.hasOwnProperty(de)&&(x===!1||x===!0&&y.hasOwnProperty(de))&&ie("/"+de+" "+_t[de].objectNumber+" 0 R");ie(">>")})(),(function(){if(Object.keys(kt).length>0){for(var de in ie("/Shading <<"),kt)kt.hasOwnProperty(de)&&kt[de]instanceof pc&&kt[de].objectNumber>=0&&ie("/"+de+" "+kt[de].objectNumber+" 0 R");cr.publish("putShadingPatternDict"),ie(">>")}})(),(function(de){if(Object.keys(kt).length>0){for(var je in ie("/Pattern <<"),kt)kt.hasOwnProperty(je)&&kt[je]instanceof p.TilingPattern&&kt[je].objectNumber>=0&&kt[je].objectNumber>")}})(R.objectOid),(function(){if(Object.keys(It).length>0){var de;for(de in ie("/ExtGState <<"),It)It.hasOwnProperty(de)&&It[de].objectNumber>=0&&ie("/"+de+" "+It[de].objectNumber+" 0 R");cr.publish("putGStateDict"),ie(">>")}})(),(function(){for(var de in ie("/XObject <<"),Aa)Aa.hasOwnProperty(de)&&Aa[de].objectNumber>=0&&ie("/"+de+" "+Aa[de].objectNumber+" 0 R");cr.publish("putXobjectDict"),ie(">>")})(),ie(">>"),ie("endobj")},fs=function(R){Dt[R.fontName]=Dt[R.fontName]||{},Dt[R.fontName][R.fontStyle]=R.id},UA=function(R,de,je,Fe,Te){var Je={id:"F"+(Object.keys(_t).length+1).toString(10),postScriptName:R,fontName:de,fontStyle:je,encoding:Fe,isStandardFont:Te||!1,metadata:{}};return cr.publish("addFont",{font:Je,instance:this}),_t[Je.id]=Je,fs(Je),Je.id},Wa=p.__private__.pdfEscape=p.pdfEscape=function(R,de){return(function(je,Fe){var Te,Je,at,yt,Ct,Kt,Yt,dr,rs;if(at=(Fe=Fe||{}).sourceEncoding||"Unicode",Ct=Fe.outputEncoding,(Fe.autoencode||Ct)&&_t[ut].metadata&&_t[ut].metadata[at]&&_t[ut].metadata[at].encoding&&(yt=_t[ut].metadata[at].encoding,!Ct&&_t[ut].encoding&&(Ct=_t[ut].encoding),!Ct&&yt.codePages&&(Ct=yt.codePages[0]),typeof Ct=="string"&&(Ct=yt[Ct]),Ct)){for(Yt=!1,Kt=[],Te=0,Je=je.length;Te>8&&(Yt=!0);je=Kt.join("")}for(Te=je.length;Yt===void 0&&Te!==0;)je.charCodeAt(Te-1)>>8&&(Yt=!0),Te--;if(!Yt)return je;for(Kt=Fe.noBOM?[]:[254,255],Te=0,Je=je.length;Te>8)>>8)throw new Error("Character at position "+Te+" of string '"+je+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Kt.push(rs),Kt.push(dr-(rs<<8))}return String.fromCharCode.apply(void 0,Kt)})(R,de).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Qn=p.__private__.beginPage=function(R){oe[++zt]=[],Bt[zt]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(R[0]),topRightY:Number(R[1])}},LA(zt),z(oe[$])},Si=function(R,de){var je,Fe,Te;switch(s=de||s,typeof R=="string"&&(je=g(R.toLowerCase()),Array.isArray(je)&&(Fe=je[0],Te=je[1])),Array.isArray(R)&&(Fe=R[0]*Tt,Te=R[1]*Tt),isNaN(Fe)&&(Fe=o[0],Te=o[1]),(Fe>14400||Te>14400)&&(Xr.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Fe=Math.min(14400,Fe),Te=Math.min(14400,Te)),o=[Fe,Te],s.substr(0,1)){case"l":Te>Fe&&(o=[Te,Fe]);break;case"p":Fe>Te&&(o=[Te,Fe])}Qn(o),Rt(Wo),ie(Ja),Rl!==0&&ie(Rl+" J"),Gs!==0&&ie(Gs+" j"),cr.publish("addPage",{pageNumber:zt})},QA=function(R){R>0&&R<=zt&&(oe.splice(R,1),Bt.splice(R,1),zt--,$>zt&&($=zt),this.setPage($))},LA=function(R){R>0&&R<=zt&&($=R)},TA=p.__private__.getNumberOfPages=p.getNumberOfPages=function(){return oe.length-1},Oc=function(R,de,je){var Fe,Te=void 0;return je=je||{},R=R!==void 0?R:_t[ut].fontName,de=de!==void 0?de:_t[ut].fontStyle,Fe=R.toLowerCase(),Dt[Fe]!==void 0&&Dt[Fe][de]!==void 0?Te=Dt[Fe][de]:Dt[R]!==void 0&&Dt[R][de]!==void 0?Te=Dt[R][de]:je.disableWarning===!1&&Xr.warn("Unable to look up font label for font '"+R+"', '"+de+"'. Refer to getFontList() for available fonts."),Te||je.noFallback||(Te=Dt.times[de])==null&&(Te=Dt.times.normal),Te},Xa=p.__private__.putInfo=function(){var R=Jr(),de=function(Fe){return Fe};for(var je in m!==null&&(de=Ls.encryptor(R,0)),ie("<<"),ie("/Producer ("+Wa(de("jsPDF "+Ft.version))+")"),lt)lt.hasOwnProperty(je)&<[je]&&ie("/"+je.substr(0,1).toUpperCase()+je.substr(1)+" ("+Wa(de(lt[je]))+")");ie("/CreationDate ("+Wa(de(le))+")"),ie(">>"),ie("endobj")},_i=p.__private__.putCatalog=function(R){var de=(R=R||{}).rootDictionaryObjId||wa;switch(Jr(),ie("<<"),ie("/Type /Catalog"),ie("/Pages "+de+" 0 R"),G||(G="fullwidth"),G){case"fullwidth":ie("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ie("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ie("/OpenAction [3 0 R /Fit]");break;case"original":ie("/OpenAction [3 0 R /XYZ null null 1]");break;default:var je=""+G;je.substr(je.length-1)==="%"&&(G=parseInt(G)/100),typeof G=="number"&&ie("/OpenAction [3 0 R /XYZ null null "+Z(G)+"]")}switch(He||(He="continuous"),He){case"continuous":ie("/PageLayout /OneColumn");break;case"single":ie("/PageLayout /SinglePage");break;case"two":case"twoleft":ie("/PageLayout /TwoColumnLeft");break;case"tworight":ie("/PageLayout /TwoColumnRight")}Ue&&ie("/PageMode /"+Ue),cr.publish("putCatalog"),ie(">>"),ie("endobj")},Ln=p.__private__.putTrailer=function(){ie("trailer"),ie("<<"),ie("/Size "+(J+1)),ie("/Root "+J+" 0 R"),ie("/Info "+(J-1)+" 0 R"),m!==null&&ie("/Encrypt "+Ls.oid+" 0 R"),ie("/ID [ <"+ae+"> <"+ae+"> ]"),ie(">>")},yr=p.__private__.putHeader=function(){ie("%PDF-"+v),ie("%ºß¬à")},IA=p.__private__.putXRef=function(){var R="0000000000";ie("xref"),ie("0 "+(J+1)),ie("0000000000 65535 f ");for(var de=1;de<=J;de++)typeof O[de]=="function"?ie((R+O[de]()).slice(-10)+" 00000 n "):O[de]!==void 0?ie((R+O[de]).slice(-10)+" 00000 n "):ie("0000000000 00000 n ")},Zn=p.__private__.buildDocument=function(){var R;J=0,re=0,H=[],O=[],Ae=[],wa=ws(),Qr=ws(),z(H),cr.publish("buildDocument"),yr(),kn(),(function(){cr.publish("putAdditionalObjects");for(var je=0;je"),ie("/O <"+Ls.toHexString(Ls.O)+">"),ie("/P "+Ls.P),ie(">>"),ie("endobj")),Xa(),_i();var de=re;return IA(),Ln(),ie("startxref"),ie(""+de),ie("%%EOF"),z(oe[$]),H.join(` +`)},ho=p.__private__.getBlob=function(R){return new Blob([Q(R)],{type:"application/pdf"})},DA=p.output=p.__private__.output=(Ga=function(R,de){switch(typeof(de=de||{})=="string"?de={filename:de}:de.filename=de.filename||"generated.pdf",R){case void 0:return Zn();case"save":p.save(de.filename);break;case"arraybuffer":return Q(Zn());case"blob":return ho(Zn());case"bloburi":case"bloburl":if(Wt.URL!==void 0&&typeof Wt.URL.createObjectURL=="function")return Wt.URL&&Wt.URL.createObjectURL(ho(Zn()))||void 0;Xr.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var je="",Fe=Zn();try{je=j2(Fe)}catch{je=j2(unescape(encodeURIComponent(Fe)))}return"data:application/pdf;filename="+de.filename+";base64,"+je;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Wt)==="[object Window]"){var Te="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",Je=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';de.pdfObjectUrl&&(Te=de.pdfObjectUrl,Je="");var at=' + + + + + + + + +
+ + + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/logo.png b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/logo.png new file mode 100644 index 0000000..2cd032e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/frontend/logo.png differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/install-airgap.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/install-airgap.sh new file mode 100755 index 0000000..4ace243 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/install-airgap.sh @@ -0,0 +1,215 @@ +#!/bin/bash +# +# Calypso Appliance - Airgap Installer +# Installs Calypso from bundled files without internet connection +# + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BUNDLE_DIR="$SCRIPT_DIR" +VERSION="${VERSION:-1.0.0}" + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +log_info() { echo -e "${GREEN}[INFO]${NC} $1"; } +log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } +log_error() { echo -e "${RED}[ERROR]${NC} $1"; } +log_step() { echo -e "\n${BLUE}==>${NC} $1"; } + +# Check root +if [[ $EUID -ne 0 ]]; then + log_error "This script must be run as root (use sudo)" + exit 1 +fi + +# Check OS +if [ ! -f /etc/os-release ]; then + log_error "Cannot detect OS" + exit 1 +fi + +. /etc/os-release +if [[ "$ID" != "ubuntu" ]] || [[ "$VERSION_ID" != "24.04" ]]; then + log_warn "This installer is designed for Ubuntu 24.04 LTS" + log_warn "Detected: $ID $VERSION_ID" + read -p "Continue anyway? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +log_step "Calypso Appliance - Airgap Installation" +log_info "Bundle directory: $BUNDLE_DIR" + +# 1. Install packages from bundle +log_step "Installing system packages from bundle..." + +if [ -d "$BUNDLE_DIR/packages/debs" ] && [ "$(ls -A $BUNDLE_DIR/packages/debs/*.deb 2>/dev/null)" ]; then + log_info "Installing packages from bundle..." + + # Create local apt repository + DEBS_DIR="$BUNDLE_DIR/packages/debs" + REPO_DIR="/tmp/calypso-local-repo" + + mkdir -p "$REPO_DIR" + cp "$DEBS_DIR"/*.deb "$REPO_DIR/" 2>/dev/null || true + + # Create Packages.gz if not exists + cd "$REPO_DIR" + if [ ! -f Packages.gz ]; then + dpkg-scanpackages . /dev/null 2>/dev/null | gzip -9c > Packages.gz + fi + + # Add to sources.list temporarily + echo "deb [trusted=yes] file://$REPO_DIR ./" > /tmp/calypso-local.list + mv /tmp/calypso-local.list /etc/apt/sources.list.d/calypso-local.list + + # Update apt cache + apt-get update -qq + + # Install packages from list + PACKAGE_LIST="$BUNDLE_DIR/packages/package-list.txt" + PACKAGES=$(grep -v '^#' "$PACKAGE_LIST" | grep -v '^$' | tr '\n' ' ') + + log_info "Installing packages..." + apt-get install -y --allow-unauthenticated $PACKAGES || { + log_warn "Some packages failed to install, trying individual installation..." + while IFS= read -r package || [ -n "$package" ]; do + [[ "$package" =~ ^#.*$ ]] && continue + [[ -z "$package" ]] && continue + apt-get install -y --allow-unauthenticated "$package" 2>/dev/null || log_warn "Failed: $package" + done < "$PACKAGE_LIST" + } + + # Cleanup + rm -f /etc/apt/sources.list.d/calypso-local.list + apt-get update -qq + + log_info "✓ Packages installed from bundle" +else + log_warn "Package DEB files not found in bundle" + log_warn "You need to install packages manually" + log_info "Package list: $BUNDLE_DIR/packages/package-list.txt" + read -p "Install packages from system repositories? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + apt-get update + xargs -a "$BUNDLE_DIR/packages/package-list.txt" -r apt-get install -y + fi +fi + +# 2. Install Go from bundle (if available) +if [ -f "$BUNDLE_DIR/third_party/go.tar.gz" ]; then + log_step "Installing Go from bundle..." + rm -rf /usr/local/go + tar -C /usr/local -xzf "$BUNDLE_DIR/third_party/go.tar.gz" + export PATH=$PATH:/usr/local/go/bin + if ! grep -q "/usr/local/go/bin" /etc/profile; then + echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile + fi + log_info "✓ Go installed" +fi + +# 3. Install Node.js from bundle (if available) +if [ -f "$BUNDLE_DIR/third_party/nodejs.tar.xz" ]; then + log_step "Installing Node.js from bundle..." + rm -rf /usr/local/node + mkdir -p /usr/local/node + tar -C /usr/local/node -xJf "$BUNDLE_DIR/third_party/nodejs.tar.xz" --strip-components=1 + export PATH=$PATH:/usr/local/node/bin + if ! grep -q "/usr/local/node/bin" /etc/profile; then + echo 'export PATH=$PATH:/usr/local/node/bin' >> /etc/profile + fi + log_info "✓ Node.js installed" +fi + +# 4. Create filesystem structure +log_step "Creating filesystem structure..." +INSTALL_PREFIX="/opt/adastra/calypso" +CONFIG_DIR="/etc/calypso" +DATA_DIR="/srv/calypso" +LOG_DIR="/var/log/calypso" +LIB_DIR="/var/lib/calypso" + +mkdir -p "$INSTALL_PREFIX/releases/${VERSION}"/{bin,web,migrations,scripts} +mkdir -p "$INSTALL_PREFIX/third_party" +mkdir -p "$CONFIG_DIR"/{tls,integrations,system,scst,nfs,samba,clamav} +mkdir -p "$DATA_DIR"/{db,backups,object,shares,vtl,iscsi,uploads,cache,_system,quarantine} +mkdir -p "$LOG_DIR" "$LIB_DIR" "/run/calypso" + +# Create calypso user +if ! id "calypso" &>/dev/null; then + useradd -r -s /bin/false -d "$LIB_DIR" -c "Calypso Appliance" calypso +fi + +# 5. Install binaries +log_step "Installing Calypso binaries..." +cp "$BUNDLE_DIR/binaries/calypso-api" "$INSTALL_PREFIX/releases/${VERSION}/bin/" +chmod +x "$INSTALL_PREFIX/releases/${VERSION}/bin/calypso-api" + +# Install frontend +cp -r "$BUNDLE_DIR/frontend"/* "$INSTALL_PREFIX/releases/${VERSION}/web/" + +# Install migrations +cp -r "$BUNDLE_DIR/migrations"/* "$INSTALL_PREFIX/releases/${VERSION}/migrations/" 2>/dev/null || true + +# Install scripts +cp -r "$BUNDLE_DIR/scripts"/* "$INSTALL_PREFIX/releases/${VERSION}/scripts/" 2>/dev/null || true +chmod +x "$INSTALL_PREFIX/releases/${VERSION}/scripts"/*.sh 2>/dev/null || true + +# Create symlink +ln -sfn "releases/${VERSION}" "$INSTALL_PREFIX/current" + +# Set ownership +chown -R calypso:calypso "$INSTALL_PREFIX" "$LIB_DIR" "$LOG_DIR" "$DATA_DIR" 2>/dev/null || chown -R root:root "$INSTALL_PREFIX" "$LIB_DIR" "$LOG_DIR" "$DATA_DIR" + +log_info "✓ Binaries installed" + +# 6. Install systemd services +log_step "Installing systemd services..." +if [ -d "$BUNDLE_DIR/services" ]; then + cp "$BUNDLE_DIR/services"/*.service /etc/systemd/system/ 2>/dev/null || true + systemctl daemon-reload + log_info "✓ Systemd services installed" +fi + +# 7. Setup database +log_step "Setting up database..." +if systemctl is-active --quiet postgresql 2>/dev/null || systemctl is-enabled --quiet postgresql 2>/dev/null; then + sudo -u postgres createdb calypso 2>/dev/null || true + sudo -u postgres createuser calypso 2>/dev/null || true + sudo -u postgres psql -c "ALTER USER calypso WITH PASSWORD 'calypso_change_me';" 2>/dev/null || true + sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE calypso TO calypso;" 2>/dev/null || true + log_info "✓ Database setup complete" +else + log_warn "PostgreSQL not running. Please start it and run database setup manually." +fi + +# 8. Generate configuration +log_step "Generating configuration..." +if [ -f "$BUNDLE_DIR/configs/config.yaml.template" ]; then + cp "$BUNDLE_DIR/configs/config.yaml.template" "$CONFIG_DIR/calypso.yaml" + # Generate secrets + if command -v openssl &> /dev/null; then + JWT_SECRET=$(openssl rand -hex 32) + sed -i "s/CHANGE_ME_JWT_SECRET/$JWT_SECRET/g" "$CONFIG_DIR/calypso.yaml" + fi + log_info "✓ Configuration generated" +fi + +log_step "Installation Complete!" +log_info "" +log_info "Next steps:" +log_info "1. Review configuration: $CONFIG_DIR/calypso.yaml" +log_info "2. Install kernel modules (ZFS, SCST, mhVTL) if needed" +log_info "3. Start services: systemctl start calypso-api" +log_info "4. Enable services: systemctl enable calypso-api" +log_info "" +log_info "Calypso API will be available at: http://localhost:8080" diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/install.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/install.sh new file mode 100755 index 0000000..07db384 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/install.sh @@ -0,0 +1,229 @@ +#!/bin/bash +# +# AtlasOS - Calypso Appliance Installer +# Complete installation script for Calypso backup appliance +# Target OS: Ubuntu Server 24.04 LTS +# +# Usage: sudo ./installer/alpha/install.sh [options] +# +# Options: +# --version VERSION Install specific version (default: auto-detect) +# --skip-deps Skip system dependencies installation +# --skip-zfs Skip ZFS installation +# --skip-scst Skip SCST installation +# --skip-mhvtl Skip MHVTL installation +# --skip-bacula Skip Bacula installation +# --config-only Only setup configuration, don't install binaries +# + +set -euo pipefail + +# Script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +INSTALLER_DIR="$SCRIPT_DIR" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Logging functions +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_step() { + echo -e "\n${BLUE}==>${NC} $1" +} + +# Configuration +CALYPSO_VERSION="${CALYPSO_VERSION:-1.0.0-alpha}" +INSTALL_PREFIX="/opt/adastra/calypso" +CONFIG_DIR="/etc/calypso" +DATA_DIR="/srv/calypso" +LOG_DIR="/var/log/calypso" +LIB_DIR="/var/lib/calypso" +RUN_DIR="/run/calypso" + +# Flags +SKIP_DEPS=false +SKIP_ZFS=false +SKIP_SCST=false +SKIP_MHVTL=false +SKIP_BACULA=false +CONFIG_ONLY=false + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --version) + CALYPSO_VERSION="$2" + shift 2 + ;; + --skip-deps) + SKIP_DEPS=true + shift + ;; + --skip-zfs) + SKIP_ZFS=true + shift + ;; + --skip-scst) + SKIP_SCST=true + shift + ;; + --skip-mhvtl) + SKIP_MHVTL=true + shift + ;; + --skip-bacula) + SKIP_BACULA=true + shift + ;; + --config-only) + CONFIG_ONLY=true + shift + ;; + *) + log_error "Unknown option: $1" + exit 1 + ;; + esac +done + +# Check if running as root +if [[ $EUID -ne 0 ]]; then + log_error "This script must be run as root (use sudo)" + exit 1 +fi + +# Detect OS +if ! grep -q "Ubuntu" /etc/os-release 2>/dev/null; then + log_warn "This installer is designed for Ubuntu. Proceeding anyway..." +fi + +log_info "==========================================" +log_info "AtlasOS - Calypso Appliance Installer" +log_info "Version: ${CALYPSO_VERSION}" +log_info "==========================================" +log_info "" + +# Source helper scripts +source "$INSTALLER_DIR/scripts/helpers.sh" +source "$INSTALLER_DIR/scripts/filesystem.sh" +source "$INSTALLER_DIR/scripts/dependencies.sh" +source "$INSTALLER_DIR/scripts/components.sh" +source "$INSTALLER_DIR/scripts/application.sh" +source "$INSTALLER_DIR/scripts/database.sh" +source "$INSTALLER_DIR/scripts/services.sh" +source "$INSTALLER_DIR/scripts/configuration.sh" +source "$INSTALLER_DIR/scripts/configure-services.sh" +source "$INSTALLER_DIR/scripts/post-install.sh" + +# Main installation function +main() { + log_step "Starting Calypso Appliance Installation" + + # Pre-flight checks + log_step "Pre-flight Checks" + check_prerequisites + + # Create filesystem structure + log_step "Creating Filesystem Structure" + create_filesystem_structure + + # Install system dependencies + if [[ "$SKIP_DEPS" == "false" ]]; then + log_step "Installing System Dependencies" + install_system_dependencies + else + log_info "Skipping system dependencies installation" + fi + + # Install components + if [[ "$SKIP_ZFS" == "false" ]]; then + log_step "Installing ZFS" + install_zfs || log_warn "ZFS installation failed or already installed" + fi + + if [[ "$SKIP_SCST" == "false" ]]; then + log_step "Installing SCST" + install_scst || log_warn "SCST installation failed or already installed" + fi + + if [[ "$SKIP_MHVTL" == "false" ]]; then + log_step "Installing MHVTL" + install_mhvtl || log_warn "MHVTL installation failed or already installed" + fi + + if [[ "$SKIP_BACULA" == "false" ]]; then + log_step "Installing Bacula (Optional)" + install_bacula || log_warn "Bacula installation skipped or failed" + fi + + # File sharing services are installed in dependencies step + # ClamAV is installed in dependencies step + + # Build and install application + if [[ "$CONFIG_ONLY" == "false" ]]; then + log_step "Building and Installing Application" + build_and_install_application + else + log_info "Skipping application build (config-only mode)" + fi + + # Setup database + log_step "Setting Up Database" + setup_database + + # Setup configuration + log_step "Setting Up Configuration" + setup_configuration + + # Install systemd services + log_step "Installing Systemd Services" + install_systemd_services + + # Configure file sharing and antivirus services + log_step "Configuring File Sharing and Antivirus Services" + configure_all_services + + # Final verification + log_step "Verifying Installation" + verify_installation + + # Post-installation setup + log_step "Post-Installation Setup" + post_install_setup + + # Print summary + print_installation_summary +} + +# Run main installation +main + +log_info "" +log_info "==========================================" +log_info "Installation Complete!" +log_info "==========================================" +log_info "" +log_info "Next steps:" +log_info "1. Configure /etc/calypso/config.yaml" +log_info "2. Set environment variables in /etc/calypso/secrets.env" +log_info "3. Start services: sudo systemctl start calypso-api" +log_info "4. Access web UI: http://:3000" +log_info "5. Login with default admin credentials (check above)" +log_info "" + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/001_initial_schema.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/001_initial_schema.sql new file mode 100644 index 0000000..0aa6214 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/001_initial_schema.sql @@ -0,0 +1,213 @@ +-- AtlasOS - Calypso +-- Initial Database Schema +-- Version: 1.0 + +-- Users table +CREATE TABLE IF NOT EXISTS users ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + username VARCHAR(255) NOT NULL UNIQUE, + email VARCHAR(255) NOT NULL UNIQUE, + password_hash VARCHAR(255) NOT NULL, + full_name VARCHAR(255), + is_active BOOLEAN NOT NULL DEFAULT true, + is_system BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + last_login_at TIMESTAMP +); + +-- Roles table +CREATE TABLE IF NOT EXISTS roles ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(100) NOT NULL UNIQUE, + description TEXT, + is_system BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Permissions table +CREATE TABLE IF NOT EXISTS permissions ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + resource VARCHAR(100) NOT NULL, + action VARCHAR(100) NOT NULL, + description TEXT, + created_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- User roles junction table +CREATE TABLE IF NOT EXISTS user_roles ( + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + role_id UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE, + assigned_at TIMESTAMP NOT NULL DEFAULT NOW(), + assigned_by UUID REFERENCES users(id), + PRIMARY KEY (user_id, role_id) +); + +-- Role permissions junction table +CREATE TABLE IF NOT EXISTS role_permissions ( + role_id UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE, + permission_id UUID NOT NULL REFERENCES permissions(id) ON DELETE CASCADE, + granted_at TIMESTAMP NOT NULL DEFAULT NOW(), + PRIMARY KEY (role_id, permission_id) +); + +-- Sessions table +CREATE TABLE IF NOT EXISTS sessions ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + token_hash VARCHAR(255) NOT NULL UNIQUE, + ip_address INET, + user_agent TEXT, + expires_at TIMESTAMP NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + last_activity_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Audit log table +CREATE TABLE IF NOT EXISTS audit_log ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + user_id UUID REFERENCES users(id), + username VARCHAR(255), + action VARCHAR(100) NOT NULL, + resource_type VARCHAR(100) NOT NULL, + resource_id VARCHAR(255), + method VARCHAR(10), + path TEXT, + ip_address INET, + user_agent TEXT, + request_body JSONB, + response_status INTEGER, + error_message TEXT, + created_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Tasks table (for async operations) +CREATE TABLE IF NOT EXISTS tasks ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + type VARCHAR(100) NOT NULL, + status VARCHAR(50) NOT NULL DEFAULT 'pending', + progress INTEGER NOT NULL DEFAULT 0, + message TEXT, + error_message TEXT, + created_by UUID REFERENCES users(id), + started_at TIMESTAMP, + completed_at TIMESTAMP, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + metadata JSONB +); + +-- Alerts table +CREATE TABLE IF NOT EXISTS alerts ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + severity VARCHAR(20) NOT NULL, + source VARCHAR(100) NOT NULL, + title VARCHAR(255) NOT NULL, + message TEXT NOT NULL, + resource_type VARCHAR(100), + resource_id VARCHAR(255), + is_acknowledged BOOLEAN NOT NULL DEFAULT false, + acknowledged_by UUID REFERENCES users(id), + acknowledged_at TIMESTAMP, + resolved_at TIMESTAMP, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + metadata JSONB +); + +-- System configuration table +CREATE TABLE IF NOT EXISTS system_config ( + key VARCHAR(255) PRIMARY KEY, + value TEXT NOT NULL, + description TEXT, + is_encrypted BOOLEAN NOT NULL DEFAULT false, + updated_by UUID REFERENCES users(id), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Indexes for performance +CREATE INDEX IF NOT EXISTS idx_users_username ON users(username); +CREATE INDEX IF NOT EXISTS idx_users_email ON users(email); +CREATE INDEX IF NOT EXISTS idx_users_active ON users(is_active); +CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id); +CREATE INDEX IF NOT EXISTS idx_sessions_token_hash ON sessions(token_hash); +CREATE INDEX IF NOT EXISTS idx_sessions_expires_at ON sessions(expires_at); +CREATE INDEX IF NOT EXISTS idx_audit_log_user_id ON audit_log(user_id); +CREATE INDEX IF NOT EXISTS idx_audit_log_created_at ON audit_log(created_at); +CREATE INDEX IF NOT EXISTS idx_audit_log_resource ON audit_log(resource_type, resource_id); +CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks(status); +CREATE INDEX IF NOT EXISTS idx_tasks_type ON tasks(type); +CREATE INDEX IF NOT EXISTS idx_tasks_created_by ON tasks(created_by); +CREATE INDEX IF NOT EXISTS idx_alerts_severity ON alerts(severity); +CREATE INDEX IF NOT EXISTS idx_alerts_acknowledged ON alerts(is_acknowledged); +CREATE INDEX IF NOT EXISTS idx_alerts_created_at ON alerts(created_at); + +-- Insert default system roles +INSERT INTO roles (name, description, is_system) VALUES + ('admin', 'Full system access and configuration', true), + ('operator', 'Day-to-day operations and monitoring', true), + ('readonly', 'Read-only access for monitoring and reporting', true) +ON CONFLICT (name) DO NOTHING; + +-- Insert default permissions +INSERT INTO permissions (name, resource, action, description) VALUES + -- System permissions + ('system:read', 'system', 'read', 'View system information'), + ('system:write', 'system', 'write', 'Modify system configuration'), + ('system:manage', 'system', 'manage', 'Full system management'), + + -- Storage permissions + ('storage:read', 'storage', 'read', 'View storage information'), + ('storage:write', 'storage', 'write', 'Modify storage configuration'), + ('storage:manage', 'storage', 'manage', 'Full storage management'), + + -- Tape permissions + ('tape:read', 'tape', 'read', 'View tape library information'), + ('tape:write', 'tape', 'write', 'Perform tape operations'), + ('tape:manage', 'tape', 'manage', 'Full tape management'), + + -- iSCSI permissions + ('iscsi:read', 'iscsi', 'read', 'View iSCSI configuration'), + ('iscsi:write', 'iscsi', 'write', 'Modify iSCSI configuration'), + ('iscsi:manage', 'iscsi', 'manage', 'Full iSCSI management'), + + -- IAM permissions + ('iam:read', 'iam', 'read', 'View users and roles'), + ('iam:write', 'iam', 'write', 'Modify users and roles'), + ('iam:manage', 'iam', 'manage', 'Full IAM management'), + + -- Audit permissions + ('audit:read', 'audit', 'read', 'View audit logs'), + + -- Monitoring permissions + ('monitoring:read', 'monitoring', 'read', 'View monitoring data'), + ('monitoring:write', 'monitoring', 'write', 'Acknowledge alerts') +ON CONFLICT (name) DO NOTHING; + +-- Assign permissions to roles +-- Admin gets all permissions +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'admin' +ON CONFLICT DO NOTHING; + +-- Operator gets read and write (but not manage) for most resources +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'operator' + AND p.action IN ('read', 'write') + AND p.resource IN ('storage', 'tape', 'iscsi', 'monitoring') +ON CONFLICT DO NOTHING; + +-- ReadOnly gets only read permissions +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'readonly' + AND p.action = 'read' +ON CONFLICT DO NOTHING; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/002_storage_and_tape_schema.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/002_storage_and_tape_schema.sql new file mode 100644 index 0000000..d349e95 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/002_storage_and_tape_schema.sql @@ -0,0 +1,227 @@ +-- AtlasOS - Calypso +-- Storage and Tape Component Schema +-- Version: 2.0 + +-- ZFS pools table +CREATE TABLE IF NOT EXISTS zfs_pools ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + description TEXT, + raid_level VARCHAR(50) NOT NULL, -- stripe, mirror, raidz, raidz2, raidz3 + disks TEXT[] NOT NULL, -- array of device paths + size_bytes BIGINT NOT NULL, + used_bytes BIGINT NOT NULL DEFAULT 0, + compression VARCHAR(50) NOT NULL DEFAULT 'lz4', -- off, lz4, zstd, gzip + deduplication BOOLEAN NOT NULL DEFAULT false, + auto_expand BOOLEAN NOT NULL DEFAULT false, + scrub_interval INTEGER NOT NULL DEFAULT 30, -- days + is_active BOOLEAN NOT NULL DEFAULT true, + health_status VARCHAR(50) NOT NULL DEFAULT 'online', -- online, degraded, faulted, offline + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- Disk repositories table +CREATE TABLE IF NOT EXISTS disk_repositories ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + description TEXT, + volume_group VARCHAR(255) NOT NULL, + logical_volume VARCHAR(255) NOT NULL, + size_bytes BIGINT NOT NULL, + used_bytes BIGINT NOT NULL DEFAULT 0, + filesystem_type VARCHAR(50), + mount_point TEXT, + is_active BOOLEAN NOT NULL DEFAULT true, + warning_threshold_percent INTEGER NOT NULL DEFAULT 80, + critical_threshold_percent INTEGER NOT NULL DEFAULT 90, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- Physical disks table +CREATE TABLE IF NOT EXISTS physical_disks ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + device_path VARCHAR(255) NOT NULL UNIQUE, + vendor VARCHAR(255), + model VARCHAR(255), + serial_number VARCHAR(255), + size_bytes BIGINT NOT NULL, + sector_size INTEGER, + is_ssd BOOLEAN NOT NULL DEFAULT false, + health_status VARCHAR(50) NOT NULL DEFAULT 'unknown', + health_details JSONB, + is_used BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Volume groups table +CREATE TABLE IF NOT EXISTS volume_groups ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + size_bytes BIGINT NOT NULL, + free_bytes BIGINT NOT NULL, + physical_volumes TEXT[], + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- SCST iSCSI targets table +CREATE TABLE IF NOT EXISTS scst_targets ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + iqn VARCHAR(512) NOT NULL UNIQUE, + target_type VARCHAR(50) NOT NULL, -- 'disk', 'vtl', 'physical_tape' + name VARCHAR(255) NOT NULL, + description TEXT, + is_active BOOLEAN NOT NULL DEFAULT true, + single_initiator_only BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- SCST LUN mappings table +CREATE TABLE IF NOT EXISTS scst_luns ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + target_id UUID NOT NULL REFERENCES scst_targets(id) ON DELETE CASCADE, + lun_number INTEGER NOT NULL, + device_name VARCHAR(255) NOT NULL, + device_path VARCHAR(512) NOT NULL, + handler_type VARCHAR(50) NOT NULL, -- 'vdisk', 'sg', 'tape' + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(target_id, lun_number) +); + +-- SCST initiator groups table +CREATE TABLE IF NOT EXISTS scst_initiator_groups ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + target_id UUID NOT NULL REFERENCES scst_targets(id) ON DELETE CASCADE, + group_name VARCHAR(255) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(target_id, group_name) +); + +-- SCST initiators table +CREATE TABLE IF NOT EXISTS scst_initiators ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + group_id UUID NOT NULL REFERENCES scst_initiator_groups(id) ON DELETE CASCADE, + iqn VARCHAR(512) NOT NULL, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(group_id, iqn) +); + +-- Physical tape libraries table +CREATE TABLE IF NOT EXISTS physical_tape_libraries ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + serial_number VARCHAR(255), + vendor VARCHAR(255), + model VARCHAR(255), + changer_device_path VARCHAR(512), + changer_stable_path VARCHAR(512), + slot_count INTEGER, + drive_count INTEGER, + is_active BOOLEAN NOT NULL DEFAULT true, + discovered_at TIMESTAMP NOT NULL DEFAULT NOW(), + last_inventory_at TIMESTAMP, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Physical tape drives table +CREATE TABLE IF NOT EXISTS physical_tape_drives ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + library_id UUID NOT NULL REFERENCES physical_tape_libraries(id) ON DELETE CASCADE, + drive_number INTEGER NOT NULL, + device_path VARCHAR(512), + stable_path VARCHAR(512), + vendor VARCHAR(255), + model VARCHAR(255), + serial_number VARCHAR(255), + drive_type VARCHAR(50), -- 'LTO-8', 'LTO-9', etc. + status VARCHAR(50) NOT NULL DEFAULT 'unknown', -- 'idle', 'loading', 'ready', 'error' + current_tape_barcode VARCHAR(255), + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(library_id, drive_number) +); + +-- Physical tape slots table +CREATE TABLE IF NOT EXISTS physical_tape_slots ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + library_id UUID NOT NULL REFERENCES physical_tape_libraries(id) ON DELETE CASCADE, + slot_number INTEGER NOT NULL, + barcode VARCHAR(255), + tape_present BOOLEAN NOT NULL DEFAULT false, + tape_type VARCHAR(50), + last_updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(library_id, slot_number) +); + +-- Virtual tape libraries table +CREATE TABLE IF NOT EXISTS virtual_tape_libraries ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + description TEXT, + mhvtl_library_id INTEGER, + backing_store_path TEXT NOT NULL, + slot_count INTEGER NOT NULL DEFAULT 10, + drive_count INTEGER NOT NULL DEFAULT 2, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- Virtual tape drives table +CREATE TABLE IF NOT EXISTS virtual_tape_drives ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + library_id UUID NOT NULL REFERENCES virtual_tape_libraries(id) ON DELETE CASCADE, + drive_number INTEGER NOT NULL, + device_path VARCHAR(512), + stable_path VARCHAR(512), + status VARCHAR(50) NOT NULL DEFAULT 'idle', + current_tape_id UUID, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(library_id, drive_number) +); + +-- Virtual tapes table +CREATE TABLE IF NOT EXISTS virtual_tapes ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + library_id UUID NOT NULL REFERENCES virtual_tape_libraries(id) ON DELETE CASCADE, + barcode VARCHAR(255) NOT NULL, + slot_number INTEGER, + image_file_path TEXT NOT NULL, + size_bytes BIGINT NOT NULL DEFAULT 0, + used_bytes BIGINT NOT NULL DEFAULT 0, + tape_type VARCHAR(50) NOT NULL DEFAULT 'LTO-8', + status VARCHAR(50) NOT NULL DEFAULT 'idle', -- 'idle', 'in_drive', 'exported' + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(library_id, barcode) +); + +-- Indexes for performance +CREATE INDEX IF NOT EXISTS idx_disk_repositories_name ON disk_repositories(name); +CREATE INDEX IF NOT EXISTS idx_disk_repositories_active ON disk_repositories(is_active); +CREATE INDEX IF NOT EXISTS idx_physical_disks_device_path ON physical_disks(device_path); +CREATE INDEX IF NOT EXISTS idx_scst_targets_iqn ON scst_targets(iqn); +CREATE INDEX IF NOT EXISTS idx_scst_targets_type ON scst_targets(target_type); +CREATE INDEX IF NOT EXISTS idx_scst_luns_target_id ON scst_luns(target_id); +CREATE INDEX IF NOT EXISTS idx_scst_initiators_group_id ON scst_initiators(group_id); +CREATE INDEX IF NOT EXISTS idx_physical_tape_libraries_name ON physical_tape_libraries(name); +CREATE INDEX IF NOT EXISTS idx_physical_tape_drives_library_id ON physical_tape_drives(library_id); +CREATE INDEX IF NOT EXISTS idx_physical_tape_slots_library_id ON physical_tape_slots(library_id); +CREATE INDEX IF NOT EXISTS idx_virtual_tape_libraries_name ON virtual_tape_libraries(name); +CREATE INDEX IF NOT EXISTS idx_virtual_tape_drives_library_id ON virtual_tape_drives(library_id); +CREATE INDEX IF NOT EXISTS idx_virtual_tapes_library_id ON virtual_tapes(library_id); +CREATE INDEX IF NOT EXISTS idx_virtual_tapes_barcode ON virtual_tapes(barcode); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_object_storage_config.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_object_storage_config.sql new file mode 100644 index 0000000..9a6c80c --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_object_storage_config.sql @@ -0,0 +1,22 @@ +-- Migration: Object Storage Configuration +-- Description: Creates table for storing MinIO object storage configuration +-- Date: 2026-01-09 + +CREATE TABLE IF NOT EXISTS object_storage_config ( + id SERIAL PRIMARY KEY, + dataset_path VARCHAR(255) NOT NULL UNIQUE, + mount_point VARCHAR(512) NOT NULL, + pool_name VARCHAR(255) NOT NULL, + dataset_name VARCHAR(255) NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_object_storage_config_pool_name ON object_storage_config(pool_name); +CREATE INDEX IF NOT EXISTS idx_object_storage_config_updated_at ON object_storage_config(updated_at); + +COMMENT ON TABLE object_storage_config IS 'Stores MinIO object storage configuration, linking to ZFS datasets'; +COMMENT ON COLUMN object_storage_config.dataset_path IS 'Full ZFS dataset path (e.g., pool/dataset)'; +COMMENT ON COLUMN object_storage_config.mount_point IS 'Mount point path for the dataset'; +COMMENT ON COLUMN object_storage_config.pool_name IS 'ZFS pool name'; +COMMENT ON COLUMN object_storage_config.dataset_name IS 'ZFS dataset name'; diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_performance_indexes.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_performance_indexes.sql new file mode 100644 index 0000000..2c96063 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/003_performance_indexes.sql @@ -0,0 +1,174 @@ +-- AtlasOS - Calypso +-- Performance Optimization: Database Indexes +-- Version: 3.0 +-- Description: Adds indexes for frequently queried columns to improve query performance + +-- ============================================================================ +-- Authentication & Authorization Indexes +-- ============================================================================ + +-- Users table indexes +-- Username is frequently queried during login +CREATE INDEX IF NOT EXISTS idx_users_username ON users(username); +-- Email lookups +CREATE INDEX IF NOT EXISTS idx_users_email ON users(email); +-- Active user lookups +CREATE INDEX IF NOT EXISTS idx_users_is_active ON users(is_active) WHERE is_active = true; + +-- Sessions table indexes +-- Token hash lookups are very frequent (every authenticated request) +CREATE INDEX IF NOT EXISTS idx_sessions_token_hash ON sessions(token_hash); +-- User session lookups +CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id); +-- Expired session cleanup (index on expires_at for efficient cleanup queries) +CREATE INDEX IF NOT EXISTS idx_sessions_expires_at ON sessions(expires_at); + +-- User roles junction table +-- Lookup roles for a user (frequent during permission checks) +CREATE INDEX IF NOT EXISTS idx_user_roles_user_id ON user_roles(user_id); +-- Lookup users with a role +CREATE INDEX IF NOT EXISTS idx_user_roles_role_id ON user_roles(role_id); + +-- Role permissions junction table +-- Lookup permissions for a role +CREATE INDEX IF NOT EXISTS idx_role_permissions_role_id ON role_permissions(role_id); +-- Lookup roles with a permission +CREATE INDEX IF NOT EXISTS idx_role_permissions_permission_id ON role_permissions(permission_id); + +-- ============================================================================ +-- Audit & Monitoring Indexes +-- ============================================================================ + +-- Audit log indexes +-- Time-based queries (most common audit log access pattern) +CREATE INDEX IF NOT EXISTS idx_audit_log_created_at ON audit_log(created_at DESC); +-- User activity queries +CREATE INDEX IF NOT EXISTS idx_audit_log_user_id ON audit_log(user_id); +-- Resource-based queries +CREATE INDEX IF NOT EXISTS idx_audit_log_resource ON audit_log(resource_type, resource_id); + +-- Alerts table indexes +-- Time-based ordering (default ordering in ListAlerts) +CREATE INDEX IF NOT EXISTS idx_alerts_created_at ON alerts(created_at DESC); +-- Severity filtering +CREATE INDEX IF NOT EXISTS idx_alerts_severity ON alerts(severity); +-- Source filtering +CREATE INDEX IF NOT EXISTS idx_alerts_source ON alerts(source); +-- Acknowledgment status +CREATE INDEX IF NOT EXISTS idx_alerts_acknowledged ON alerts(is_acknowledged) WHERE is_acknowledged = false; +-- Resource-based queries +CREATE INDEX IF NOT EXISTS idx_alerts_resource ON alerts(resource_type, resource_id); +-- Composite index for common filter combinations +CREATE INDEX IF NOT EXISTS idx_alerts_severity_acknowledged ON alerts(severity, is_acknowledged, created_at DESC); + +-- ============================================================================ +-- Task Management Indexes +-- ============================================================================ + +-- Tasks table indexes +-- Status filtering (very common in task queries) +CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks(status); +-- Created by user +CREATE INDEX IF NOT EXISTS idx_tasks_created_by ON tasks(created_by); +-- Time-based queries +CREATE INDEX IF NOT EXISTS idx_tasks_created_at ON tasks(created_at DESC); +-- Status + time composite (common query pattern) +CREATE INDEX IF NOT EXISTS idx_tasks_status_created_at ON tasks(status, created_at DESC); +-- Failed tasks lookup (for alerting) +CREATE INDEX IF NOT EXISTS idx_tasks_failed_recent ON tasks(status, created_at DESC) WHERE status = 'failed'; + +-- ============================================================================ +-- Storage Indexes +-- ============================================================================ + +-- Disk repositories indexes +-- Active repository lookups +CREATE INDEX IF NOT EXISTS idx_disk_repositories_is_active ON disk_repositories(is_active) WHERE is_active = true; +-- Name lookups +CREATE INDEX IF NOT EXISTS idx_disk_repositories_name ON disk_repositories(name); +-- Volume group lookups +CREATE INDEX IF NOT EXISTS idx_disk_repositories_vg ON disk_repositories(volume_group); + +-- Physical disks indexes +-- Device path lookups (for sync operations) +CREATE INDEX IF NOT EXISTS idx_physical_disks_device_path ON physical_disks(device_path); + +-- ============================================================================ +-- SCST Indexes +-- ============================================================================ + +-- SCST targets indexes +-- IQN lookups (frequent during target operations) +CREATE INDEX IF NOT EXISTS idx_scst_targets_iqn ON scst_targets(iqn); +-- Active target lookups +CREATE INDEX IF NOT EXISTS idx_scst_targets_is_active ON scst_targets(is_active) WHERE is_active = true; + +-- SCST LUNs indexes +-- Target + LUN lookups (very frequent) +CREATE INDEX IF NOT EXISTS idx_scst_luns_target_lun ON scst_luns(target_id, lun_number); +-- Device path lookups +CREATE INDEX IF NOT EXISTS idx_scst_luns_device_path ON scst_luns(device_path); + +-- SCST initiator groups indexes +-- Target + group name lookups +CREATE INDEX IF NOT EXISTS idx_scst_initiator_groups_target ON scst_initiator_groups(target_id); +-- Group name lookups +CREATE INDEX IF NOT EXISTS idx_scst_initiator_groups_name ON scst_initiator_groups(group_name); + +-- SCST initiators indexes +-- Group + IQN lookups +CREATE INDEX IF NOT EXISTS idx_scst_initiators_group_iqn ON scst_initiators(group_id, iqn); +-- Active initiator lookups +CREATE INDEX IF NOT EXISTS idx_scst_initiators_is_active ON scst_initiators(is_active) WHERE is_active = true; + +-- ============================================================================ +-- Tape Library Indexes +-- ============================================================================ + +-- Physical tape libraries indexes +-- Serial number lookups (for discovery) +CREATE INDEX IF NOT EXISTS idx_physical_tape_libraries_serial ON physical_tape_libraries(serial_number); +-- Active library lookups +CREATE INDEX IF NOT EXISTS idx_physical_tape_libraries_is_active ON physical_tape_libraries(is_active) WHERE is_active = true; + +-- Physical tape drives indexes +-- Library + drive number lookups (very frequent) +CREATE INDEX IF NOT EXISTS idx_physical_tape_drives_library_drive ON physical_tape_drives(library_id, drive_number); +-- Status filtering +CREATE INDEX IF NOT EXISTS idx_physical_tape_drives_status ON physical_tape_drives(status); + +-- Physical tape slots indexes +-- Library + slot number lookups +CREATE INDEX IF NOT EXISTS idx_physical_tape_slots_library_slot ON physical_tape_slots(library_id, slot_number); +-- Barcode lookups +CREATE INDEX IF NOT EXISTS idx_physical_tape_slots_barcode ON physical_tape_slots(barcode) WHERE barcode IS NOT NULL; + +-- Virtual tape libraries indexes +-- MHVTL library ID lookups +CREATE INDEX IF NOT EXISTS idx_virtual_tape_libraries_mhvtl_id ON virtual_tape_libraries(mhvtl_library_id); +-- Active library lookups +CREATE INDEX IF NOT EXISTS idx_virtual_tape_libraries_is_active ON virtual_tape_libraries(is_active) WHERE is_active = true; + +-- Virtual tape drives indexes +-- Library + drive number lookups (very frequent) +CREATE INDEX IF NOT EXISTS idx_virtual_tape_drives_library_drive ON virtual_tape_drives(library_id, drive_number); +-- Status filtering +CREATE INDEX IF NOT EXISTS idx_virtual_tape_drives_status ON virtual_tape_drives(status); +-- Current tape lookups +CREATE INDEX IF NOT EXISTS idx_virtual_tape_drives_current_tape ON virtual_tape_drives(current_tape_id) WHERE current_tape_id IS NOT NULL; + +-- Virtual tapes indexes +-- Library + slot number lookups +CREATE INDEX IF NOT EXISTS idx_virtual_tapes_library_slot ON virtual_tapes(library_id, slot_number); +-- Barcode lookups +CREATE INDEX IF NOT EXISTS idx_virtual_tapes_barcode ON virtual_tapes(barcode) WHERE barcode IS NOT NULL; +-- Status filtering +CREATE INDEX IF NOT EXISTS idx_virtual_tapes_status ON virtual_tapes(status); + +-- ============================================================================ +-- Statistics Update +-- ============================================================================ + +-- Update table statistics for query planner +ANALYZE; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/004_add_zfs_pools_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/004_add_zfs_pools_table.sql new file mode 100644 index 0000000..de47f2e --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/004_add_zfs_pools_table.sql @@ -0,0 +1,31 @@ +-- AtlasOS - Calypso +-- Add ZFS Pools Table +-- Version: 4.0 +-- Note: This migration adds the zfs_pools table that was added to migration 002 +-- but may not have been applied if migration 002 was run before the table was added + +-- ZFS pools table +CREATE TABLE IF NOT EXISTS zfs_pools ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + description TEXT, + raid_level VARCHAR(50) NOT NULL, -- stripe, mirror, raidz, raidz2, raidz3 + disks TEXT[] NOT NULL, -- array of device paths + size_bytes BIGINT NOT NULL, + used_bytes BIGINT NOT NULL DEFAULT 0, + compression VARCHAR(50) NOT NULL DEFAULT 'lz4', -- off, lz4, zstd, gzip + deduplication BOOLEAN NOT NULL DEFAULT false, + auto_expand BOOLEAN NOT NULL DEFAULT false, + scrub_interval INTEGER NOT NULL DEFAULT 30, -- days + is_active BOOLEAN NOT NULL DEFAULT true, + health_status VARCHAR(50) NOT NULL DEFAULT 'online', -- online, degraded, faulted, offline + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- Create index on name for faster lookups +CREATE INDEX IF NOT EXISTS idx_zfs_pools_name ON zfs_pools(name); +CREATE INDEX IF NOT EXISTS idx_zfs_pools_created_by ON zfs_pools(created_by); +CREATE INDEX IF NOT EXISTS idx_zfs_pools_health_status ON zfs_pools(health_status); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/005_add_zfs_datasets_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/005_add_zfs_datasets_table.sql new file mode 100644 index 0000000..e40f67d --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/005_add_zfs_datasets_table.sql @@ -0,0 +1,35 @@ +-- AtlasOS - Calypso +-- Add ZFS Datasets Table +-- Version: 5.0 +-- Description: Stores ZFS dataset metadata in database for faster queries and consistency + +-- ZFS datasets table +CREATE TABLE IF NOT EXISTS zfs_datasets ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(512) NOT NULL UNIQUE, -- Full dataset name (e.g., pool/dataset) + pool_id UUID NOT NULL REFERENCES zfs_pools(id) ON DELETE CASCADE, + pool_name VARCHAR(255) NOT NULL, -- Denormalized for faster queries + type VARCHAR(50) NOT NULL, -- filesystem, volume, snapshot + mount_point TEXT, -- Mount point path (null for volumes) + used_bytes BIGINT NOT NULL DEFAULT 0, + available_bytes BIGINT NOT NULL DEFAULT 0, + referenced_bytes BIGINT NOT NULL DEFAULT 0, + compression VARCHAR(50) NOT NULL DEFAULT 'lz4', -- off, lz4, zstd, gzip + deduplication VARCHAR(50) NOT NULL DEFAULT 'off', -- off, on, verify + quota BIGINT DEFAULT -1, -- -1 for unlimited, bytes otherwise + reservation BIGINT NOT NULL DEFAULT 0, -- Reserved space in bytes + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id) +); + +-- Create indexes for faster lookups +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_pool_id ON zfs_datasets(pool_id); +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_pool_name ON zfs_datasets(pool_name); +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_name ON zfs_datasets(name); +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_type ON zfs_datasets(type); +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_created_by ON zfs_datasets(created_by); + +-- Composite index for common queries (list datasets by pool) +CREATE INDEX IF NOT EXISTS idx_zfs_datasets_pool_type ON zfs_datasets(pool_id, type); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/006_add_zfs_shares_and_iscsi.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/006_add_zfs_shares_and_iscsi.sql new file mode 100644 index 0000000..e237124 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/006_add_zfs_shares_and_iscsi.sql @@ -0,0 +1,50 @@ +-- AtlasOS - Calypso +-- Add ZFS Shares and iSCSI Export Tables +-- Version: 6.0 +-- Description: Separate tables for filesystem shares (NFS/SMB) and volume iSCSI exports + +-- ZFS Filesystem Shares Table (for NFS/SMB) +CREATE TABLE IF NOT EXISTS zfs_shares ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + dataset_id UUID NOT NULL REFERENCES zfs_datasets(id) ON DELETE CASCADE, + share_type VARCHAR(50) NOT NULL, -- 'nfs', 'smb', 'both' + nfs_enabled BOOLEAN NOT NULL DEFAULT false, + nfs_options TEXT, -- e.g., "rw,sync,no_subtree_check" + nfs_clients TEXT[], -- Allowed client IPs/networks + smb_enabled BOOLEAN NOT NULL DEFAULT false, + smb_share_name VARCHAR(255), -- SMB share name + smb_path TEXT, -- SMB share path (usually same as mount_point) + smb_comment TEXT, + smb_guest_ok BOOLEAN NOT NULL DEFAULT false, + smb_read_only BOOLEAN NOT NULL DEFAULT false, + smb_browseable BOOLEAN NOT NULL DEFAULT true, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id), + UNIQUE(dataset_id) -- One share config per dataset +); + +-- ZFS Volume iSCSI Exports Table +CREATE TABLE IF NOT EXISTS zfs_iscsi_exports ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + dataset_id UUID NOT NULL REFERENCES zfs_datasets(id) ON DELETE CASCADE, + target_id UUID REFERENCES scst_targets(id) ON DELETE SET NULL, -- Link to SCST target + lun_number INTEGER, -- LUN number in the target + device_path TEXT, -- /dev/zvol/pool/volume path + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + created_by UUID REFERENCES users(id), + UNIQUE(dataset_id) -- One iSCSI export per volume +); + +-- Create indexes +CREATE INDEX IF NOT EXISTS idx_zfs_shares_dataset_id ON zfs_shares(dataset_id); +CREATE INDEX IF NOT EXISTS idx_zfs_shares_type ON zfs_shares(share_type); +CREATE INDEX IF NOT EXISTS idx_zfs_shares_active ON zfs_shares(is_active); + +CREATE INDEX IF NOT EXISTS idx_zfs_iscsi_exports_dataset_id ON zfs_iscsi_exports(dataset_id); +CREATE INDEX IF NOT EXISTS idx_zfs_iscsi_exports_target_id ON zfs_iscsi_exports(target_id); +CREATE INDEX IF NOT EXISTS idx_zfs_iscsi_exports_active ON zfs_iscsi_exports(is_active); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/007_add_vendor_to_vtl_libraries.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/007_add_vendor_to_vtl_libraries.sql new file mode 100644 index 0000000..a23ebce --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/007_add_vendor_to_vtl_libraries.sql @@ -0,0 +1,3 @@ +-- Add vendor column to virtual_tape_libraries table +ALTER TABLE virtual_tape_libraries ADD COLUMN IF NOT EXISTS vendor VARCHAR(255); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/008_add_user_groups.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/008_add_user_groups.sql new file mode 100644 index 0000000..962757b --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/008_add_user_groups.sql @@ -0,0 +1,45 @@ +-- Add user groups feature +-- Groups table +CREATE TABLE IF NOT EXISTS groups ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL UNIQUE, + description TEXT, + is_system BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- User groups junction table +CREATE TABLE IF NOT EXISTS user_groups ( + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + group_id UUID NOT NULL REFERENCES groups(id) ON DELETE CASCADE, + assigned_at TIMESTAMP NOT NULL DEFAULT NOW(), + assigned_by UUID REFERENCES users(id), + PRIMARY KEY (user_id, group_id) +); + +-- Group roles junction table (groups can have roles) +CREATE TABLE IF NOT EXISTS group_roles ( + group_id UUID NOT NULL REFERENCES groups(id) ON DELETE CASCADE, + role_id UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE, + granted_at TIMESTAMP NOT NULL DEFAULT NOW(), + PRIMARY KEY (group_id, role_id) +); + +-- Indexes +CREATE INDEX IF NOT EXISTS idx_groups_name ON groups(name); +CREATE INDEX IF NOT EXISTS idx_user_groups_user_id ON user_groups(user_id); +CREATE INDEX IF NOT EXISTS idx_user_groups_group_id ON user_groups(group_id); +CREATE INDEX IF NOT EXISTS idx_group_roles_group_id ON group_roles(group_id); +CREATE INDEX IF NOT EXISTS idx_group_roles_role_id ON group_roles(role_id); + +-- Insert default system groups +INSERT INTO groups (name, description, is_system) VALUES + ('wheel', 'System administrators group', true), + ('operators', 'System operators group', true), + ('backup', 'Backup operators group', true), + ('auditors', 'Auditors group', true), + ('storage_admins', 'Storage administrators group', true), + ('services', 'Service accounts group', true) +ON CONFLICT (name) DO NOTHING; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/009_backup_jobs_schema.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/009_backup_jobs_schema.sql new file mode 100644 index 0000000..b4b6dc6 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/009_backup_jobs_schema.sql @@ -0,0 +1,34 @@ +-- AtlasOS - Calypso +-- Backup Jobs Schema +-- Version: 9.0 + +-- Backup jobs table +CREATE TABLE IF NOT EXISTS backup_jobs ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + job_id INTEGER NOT NULL UNIQUE, -- Bareos job ID + job_name VARCHAR(255) NOT NULL, + client_name VARCHAR(255) NOT NULL, + job_type VARCHAR(50) NOT NULL, -- 'Backup', 'Restore', 'Verify', 'Copy', 'Migrate' + job_level VARCHAR(50) NOT NULL, -- 'Full', 'Incremental', 'Differential', 'Since' + status VARCHAR(50) NOT NULL, -- 'Running', 'Completed', 'Failed', 'Canceled', 'Waiting' + bytes_written BIGINT NOT NULL DEFAULT 0, + files_written INTEGER NOT NULL DEFAULT 0, + duration_seconds INTEGER, + started_at TIMESTAMP, + ended_at TIMESTAMP, + error_message TEXT, + storage_name VARCHAR(255), + pool_name VARCHAR(255), + volume_name VARCHAR(255), + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- Indexes for performance +CREATE INDEX IF NOT EXISTS idx_backup_jobs_job_id ON backup_jobs(job_id); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_job_name ON backup_jobs(job_name); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_client_name ON backup_jobs(client_name); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_status ON backup_jobs(status); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_started_at ON backup_jobs(started_at DESC); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_job_type ON backup_jobs(job_type); + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/010_add_backup_permissions.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/010_add_backup_permissions.sql new file mode 100644 index 0000000..6c8eb5d --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/010_add_backup_permissions.sql @@ -0,0 +1,39 @@ +-- AtlasOS - Calypso +-- Add Backup Permissions +-- Version: 10.0 + +-- Insert backup permissions +INSERT INTO permissions (name, resource, action, description) VALUES + ('backup:read', 'backup', 'read', 'View backup jobs and history'), + ('backup:write', 'backup', 'write', 'Create and manage backup jobs'), + ('backup:manage', 'backup', 'manage', 'Full backup management') +ON CONFLICT (name) DO NOTHING; + +-- Assign backup permissions to roles + +-- Admin gets all backup permissions (explicitly assign since admin query in 001 only runs once) +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'admin' + AND p.resource = 'backup' +ON CONFLICT DO NOTHING; + +-- Operator gets read and write permissions for backup +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'operator' + AND p.resource = 'backup' + AND p.action IN ('read', 'write') +ON CONFLICT DO NOTHING; + +-- ReadOnly gets only read permission for backup +INSERT INTO role_permissions (role_id, permission_id) +SELECT r.id, p.id +FROM roles r, permissions p +WHERE r.name = 'readonly' + AND p.resource = 'backup' + AND p.action = 'read' +ON CONFLICT DO NOTHING; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql new file mode 100644 index 0000000..8cc0af0 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql @@ -0,0 +1,209 @@ +-- AtlasOS - Calypso +-- PostgreSQL Function to Sync Jobs from Bacula to Calypso +-- Version: 11.0 +-- +-- This function syncs jobs from Bacula database (Job table) to Calypso database (backup_jobs table) +-- Uses dblink extension to query Bacula database from Calypso database +-- +-- Prerequisites: +-- 1. dblink extension must be installed: CREATE EXTENSION IF NOT EXISTS dblink; +-- 2. User must have access to both databases +-- 3. Connection parameters must be configured in the function + +-- Create function to sync jobs from Bacula to Calypso +CREATE OR REPLACE FUNCTION sync_bacula_jobs( + bacula_db_name TEXT DEFAULT 'bacula', + bacula_host TEXT DEFAULT 'localhost', + bacula_port INTEGER DEFAULT 5432, + bacula_user TEXT DEFAULT 'calypso', + bacula_password TEXT DEFAULT '' +) +RETURNS TABLE( + jobs_synced INTEGER, + jobs_inserted INTEGER, + jobs_updated INTEGER, + errors INTEGER +) AS $$ +DECLARE + conn_str TEXT; + jobs_count INTEGER := 0; + inserted_count INTEGER := 0; + updated_count INTEGER := 0; + error_count INTEGER := 0; + job_record RECORD; +BEGIN + -- Build dblink connection string + conn_str := format( + 'dbname=%s host=%s port=%s user=%s password=%s', + bacula_db_name, + bacula_host, + bacula_port, + bacula_user, + bacula_password + ); + + -- Query jobs from Bacula database using dblink + FOR job_record IN + SELECT * FROM dblink( + conn_str, + $QUERY$ + SELECT + j.JobId, + j.Name as job_name, + COALESCE(c.Name, 'unknown') as client_name, + CASE + WHEN j.Type = 'B' THEN 'Backup' + WHEN j.Type = 'R' THEN 'Restore' + WHEN j.Type = 'V' THEN 'Verify' + WHEN j.Type = 'C' THEN 'Copy' + WHEN j.Type = 'M' THEN 'Migrate' + ELSE 'Backup' + END as job_type, + CASE + WHEN j.Level = 'F' THEN 'Full' + WHEN j.Level = 'I' THEN 'Incremental' + WHEN j.Level = 'D' THEN 'Differential' + WHEN j.Level = 'S' THEN 'Since' + ELSE 'Full' + END as job_level, + CASE + WHEN j.JobStatus = 'T' THEN 'Running' + WHEN j.JobStatus = 'C' THEN 'Completed' + WHEN j.JobStatus = 'f' OR j.JobStatus = 'F' THEN 'Failed' + WHEN j.JobStatus = 'A' THEN 'Canceled' + WHEN j.JobStatus = 'W' THEN 'Waiting' + ELSE 'Waiting' + END as status, + COALESCE(j.JobBytes, 0) as bytes_written, + COALESCE(j.JobFiles, 0) as files_written, + j.StartTime as started_at, + j.EndTime as ended_at, + CASE + WHEN j.EndTime IS NOT NULL AND j.StartTime IS NOT NULL + THEN EXTRACT(EPOCH FROM (j.EndTime - j.StartTime))::INTEGER + ELSE NULL + END as duration_seconds + FROM Job j + LEFT JOIN Client c ON j.ClientId = c.ClientId + ORDER BY j.StartTime DESC + LIMIT 1000 + $QUERY$ + ) AS t( + job_id INTEGER, + job_name TEXT, + client_name TEXT, + job_type TEXT, + job_level TEXT, + status TEXT, + bytes_written BIGINT, + files_written INTEGER, + started_at TIMESTAMP, + ended_at TIMESTAMP, + duration_seconds INTEGER + ) + LOOP + BEGIN + -- Check if job already exists (before insert/update) + IF EXISTS (SELECT 1 FROM backup_jobs WHERE job_id = job_record.job_id) THEN + updated_count := updated_count + 1; + ELSE + inserted_count := inserted_count + 1; + END IF; + + -- Upsert job to backup_jobs table + INSERT INTO backup_jobs ( + job_id, job_name, client_name, job_type, job_level, status, + bytes_written, files_written, started_at, ended_at, duration_seconds, + updated_at + ) VALUES ( + job_record.job_id, + job_record.job_name, + job_record.client_name, + job_record.job_type, + job_record.job_level, + job_record.status, + job_record.bytes_written, + job_record.files_written, + job_record.started_at, + job_record.ended_at, + job_record.duration_seconds, + NOW() + ) + ON CONFLICT (job_id) DO UPDATE SET + job_name = EXCLUDED.job_name, + client_name = EXCLUDED.client_name, + job_type = EXCLUDED.job_type, + job_level = EXCLUDED.job_level, + status = EXCLUDED.status, + bytes_written = EXCLUDED.bytes_written, + files_written = EXCLUDED.files_written, + started_at = EXCLUDED.started_at, + ended_at = EXCLUDED.ended_at, + duration_seconds = EXCLUDED.duration_seconds, + updated_at = NOW(); + + jobs_count := jobs_count + 1; + EXCEPTION + WHEN OTHERS THEN + error_count := error_count + 1; + -- Log error but continue with next job + RAISE WARNING 'Error syncing job %: %', job_record.job_id, SQLERRM; + END; + END LOOP; + + -- Return summary + RETURN QUERY SELECT jobs_count, inserted_count, updated_count, error_count; +END; +$$ LANGUAGE plpgsql; + +-- Create a simpler version that uses current database connection settings +-- This version assumes Bacula is on same host/port with same user +CREATE OR REPLACE FUNCTION sync_bacula_jobs_simple() +RETURNS TABLE( + jobs_synced INTEGER, + jobs_inserted INTEGER, + jobs_updated INTEGER, + errors INTEGER +) AS $$ +DECLARE + current_user_name TEXT; + current_host TEXT; + current_port INTEGER; + current_db TEXT; +BEGIN + -- Get current connection info + SELECT + current_user, + COALESCE(inet_server_addr()::TEXT, 'localhost'), + COALESCE(inet_server_port(), 5432), + current_database() + INTO + current_user_name, + current_host, + current_port, + current_db; + + -- Call main function with current connection settings + -- Note: password needs to be passed or configured in .pgpass + RETURN QUERY + SELECT * FROM sync_bacula_jobs( + 'bacula', -- Try 'bacula' first + current_host, + current_port, + current_user_name, + '' -- Empty password - will use .pgpass or peer authentication + ); +END; +$$ LANGUAGE plpgsql; + +-- Grant execute permission to calypso user +GRANT EXECUTE ON FUNCTION sync_bacula_jobs(TEXT, TEXT, INTEGER, TEXT, TEXT) TO calypso; +GRANT EXECUTE ON FUNCTION sync_bacula_jobs_simple() TO calypso; + +-- Create index if not exists (should already exist from migration 009) +CREATE INDEX IF NOT EXISTS idx_backup_jobs_job_id ON backup_jobs(job_id); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_updated_at ON backup_jobs(updated_at); + +COMMENT ON FUNCTION sync_bacula_jobs IS 'Syncs jobs from Bacula database to Calypso backup_jobs table using dblink'; +COMMENT ON FUNCTION sync_bacula_jobs_simple IS 'Simplified version that uses current connection settings (requires .pgpass for password)'; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql.bak b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql.bak new file mode 100644 index 0000000..24c40e7 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/011_sync_bacula_jobs_function.sql.bak @@ -0,0 +1,209 @@ +-- AtlasOS - Calypso +-- PostgreSQL Function to Sync Jobs from Bacula to Calypso +-- Version: 11.0 +-- +-- This function syncs jobs from Bacula database (Job table) to Calypso database (backup_jobs table) +-- Uses dblink extension to query Bacula database from Calypso database +-- +-- Prerequisites: +-- 1. dblink extension must be installed: CREATE EXTENSION IF NOT EXISTS dblink; +-- 2. User must have access to both databases +-- 3. Connection parameters must be configured in the function + +-- Create function to sync jobs from Bacula to Calypso +CREATE OR REPLACE FUNCTION sync_bacula_jobs( + bacula_db_name TEXT DEFAULT 'bacula', + bacula_host TEXT DEFAULT 'localhost', + bacula_port INTEGER DEFAULT 5432, + bacula_user TEXT DEFAULT 'calypso', + bacula_password TEXT DEFAULT '' +) +RETURNS TABLE( + jobs_synced INTEGER, + jobs_inserted INTEGER, + jobs_updated INTEGER, + errors INTEGER +) AS $$ +DECLARE + conn_str TEXT; + jobs_count INTEGER := 0; + inserted_count INTEGER := 0; + updated_count INTEGER := 0; + error_count INTEGER := 0; + job_record RECORD; +BEGIN + -- Build dblink connection string + conn_str := format( + 'dbname=%s host=%s port=%s user=%s password=%s', + bacula_db_name, + bacula_host, + bacula_port, + bacula_user, + bacula_password + ); + + -- Query jobs from Bacula database using dblink + FOR job_record IN + SELECT * FROM dblink( + conn_str, + $$ + SELECT + j.JobId, + j.Name as job_name, + COALESCE(c.Name, 'unknown') as client_name, + CASE + WHEN j.Type = 'B' THEN 'Backup' + WHEN j.Type = 'R' THEN 'Restore' + WHEN j.Type = 'V' THEN 'Verify' + WHEN j.Type = 'C' THEN 'Copy' + WHEN j.Type = 'M' THEN 'Migrate' + ELSE 'Backup' + END as job_type, + CASE + WHEN j.Level = 'F' THEN 'Full' + WHEN j.Level = 'I' THEN 'Incremental' + WHEN j.Level = 'D' THEN 'Differential' + WHEN j.Level = 'S' THEN 'Since' + ELSE 'Full' + END as job_level, + CASE + WHEN j.JobStatus = 'T' THEN 'Running' + WHEN j.JobStatus = 'C' THEN 'Completed' + WHEN j.JobStatus = 'f' OR j.JobStatus = 'F' THEN 'Failed' + WHEN j.JobStatus = 'A' THEN 'Canceled' + WHEN j.JobStatus = 'W' THEN 'Waiting' + ELSE 'Waiting' + END as status, + COALESCE(j.JobBytes, 0) as bytes_written, + COALESCE(j.JobFiles, 0) as files_written, + j.StartTime as started_at, + j.EndTime as ended_at, + CASE + WHEN j.EndTime IS NOT NULL AND j.StartTime IS NOT NULL + THEN EXTRACT(EPOCH FROM (j.EndTime - j.StartTime))::INTEGER + ELSE NULL + END as duration_seconds + FROM Job j + LEFT JOIN Client c ON j.ClientId = c.ClientId + ORDER BY j.StartTime DESC + LIMIT 1000 + $$ + ) AS t( + job_id INTEGER, + job_name TEXT, + client_name TEXT, + job_type TEXT, + job_level TEXT, + status TEXT, + bytes_written BIGINT, + files_written INTEGER, + started_at TIMESTAMP, + ended_at TIMESTAMP, + duration_seconds INTEGER + ) + LOOP + BEGIN + -- Check if job already exists (before insert/update) + IF EXISTS (SELECT 1 FROM backup_jobs WHERE job_id = job_record.job_id) THEN + updated_count := updated_count + 1; + ELSE + inserted_count := inserted_count + 1; + END IF; + + -- Upsert job to backup_jobs table + INSERT INTO backup_jobs ( + job_id, job_name, client_name, job_type, job_level, status, + bytes_written, files_written, started_at, ended_at, duration_seconds, + updated_at + ) VALUES ( + job_record.job_id, + job_record.job_name, + job_record.client_name, + job_record.job_type, + job_record.job_level, + job_record.status, + job_record.bytes_written, + job_record.files_written, + job_record.started_at, + job_record.ended_at, + job_record.duration_seconds, + NOW() + ) + ON CONFLICT (job_id) DO UPDATE SET + job_name = EXCLUDED.job_name, + client_name = EXCLUDED.client_name, + job_type = EXCLUDED.job_type, + job_level = EXCLUDED.job_level, + status = EXCLUDED.status, + bytes_written = EXCLUDED.bytes_written, + files_written = EXCLUDED.files_written, + started_at = EXCLUDED.started_at, + ended_at = EXCLUDED.ended_at, + duration_seconds = EXCLUDED.duration_seconds, + updated_at = NOW(); + + jobs_count := jobs_count + 1; + EXCEPTION + WHEN OTHERS THEN + error_count := error_count + 1; + -- Log error but continue with next job + RAISE WARNING 'Error syncing job %: %', job_record.job_id, SQLERRM; + END; + END LOOP; + + -- Return summary + RETURN QUERY SELECT jobs_count, inserted_count, updated_count, error_count; +END; +$$ LANGUAGE plpgsql; + +-- Create a simpler version that uses current database connection settings +-- This version assumes Bacula is on same host/port with same user +CREATE OR REPLACE FUNCTION sync_bacula_jobs_simple() +RETURNS TABLE( + jobs_synced INTEGER, + jobs_inserted INTEGER, + jobs_updated INTEGER, + errors INTEGER +) AS $$ +DECLARE + current_user_name TEXT; + current_host TEXT; + current_port INTEGER; + current_db TEXT; +BEGIN + -- Get current connection info + SELECT + current_user, + COALESCE(inet_server_addr()::TEXT, 'localhost'), + COALESCE(inet_server_port(), 5432), + current_database() + INTO + current_user_name, + current_host, + current_port, + current_db; + + -- Call main function with current connection settings + -- Note: password needs to be passed or configured in .pgpass + RETURN QUERY + SELECT * FROM sync_bacula_jobs( + 'bacula', -- Try 'bacula' first + current_host, + current_port, + current_user_name, + '' -- Empty password - will use .pgpass or peer authentication + ); +END; +$$ LANGUAGE plpgsql; + +-- Grant execute permission to calypso user +GRANT EXECUTE ON FUNCTION sync_bacula_jobs(TEXT, TEXT, INTEGER, TEXT, TEXT) TO calypso; +GRANT EXECUTE ON FUNCTION sync_bacula_jobs_simple() TO calypso; + +-- Create index if not exists (should already exist from migration 009) +CREATE INDEX IF NOT EXISTS idx_backup_jobs_job_id ON backup_jobs(job_id); +CREATE INDEX IF NOT EXISTS idx_backup_jobs_updated_at ON backup_jobs(updated_at); + +COMMENT ON FUNCTION sync_bacula_jobs IS 'Syncs jobs from Bacula database to Calypso backup_jobs table using dblink'; +COMMENT ON FUNCTION sync_bacula_jobs_simple IS 'Simplified version that uses current connection settings (requires .pgpass for password)'; + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/012_add_snapshot_schedules_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/012_add_snapshot_schedules_table.sql new file mode 100644 index 0000000..8e36c2a --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/012_add_snapshot_schedules_table.sql @@ -0,0 +1,23 @@ +-- Snapshot schedules table for automated snapshot creation +CREATE TABLE IF NOT EXISTS snapshot_schedules ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL, + dataset VARCHAR(255) NOT NULL, + snapshot_name_template VARCHAR(255) NOT NULL, -- e.g., "auto-%Y-%m-%d-%H%M" or "daily-backup" + schedule_type VARCHAR(50) NOT NULL, -- 'hourly', 'daily', 'weekly', 'monthly', 'cron' + schedule_config JSONB NOT NULL, -- For cron: {"cron": "0 0 * * *"}, for others: {"time": "00:00", "day": 1, etc.} + recursive BOOLEAN NOT NULL DEFAULT false, + enabled BOOLEAN NOT NULL DEFAULT true, + retention_count INTEGER, -- Keep last N snapshots (null = unlimited) + retention_days INTEGER, -- Keep snapshots for N days (null = unlimited) + last_run_at TIMESTAMP, + next_run_at TIMESTAMP, + created_by UUID REFERENCES users(id), + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE(name) +); + +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_enabled ON snapshot_schedules(enabled); +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_next_run ON snapshot_schedules(next_run_at); +CREATE INDEX IF NOT EXISTS idx_snapshot_schedules_dataset ON snapshot_schedules(dataset); diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/013_add_replication_tasks_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/013_add_replication_tasks_table.sql new file mode 100644 index 0000000..556d362 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/013_add_replication_tasks_table.sql @@ -0,0 +1,76 @@ +-- ZFS Replication Tasks Table +-- Supports both outbound (sender) and inbound (receiver) replication +CREATE TABLE IF NOT EXISTS replication_tasks ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name VARCHAR(255) NOT NULL, + direction VARCHAR(20) NOT NULL, -- 'outbound' (sender) or 'inbound' (receiver) + + -- For outbound replication (sender) + source_dataset VARCHAR(512), -- Source dataset on this system (outbound) or remote system (inbound) + target_host VARCHAR(255), -- Target host IP or hostname (for outbound) + target_port INTEGER DEFAULT 22, -- SSH port (default 22, for outbound) + target_user VARCHAR(255) DEFAULT 'root', -- SSH user (for outbound) + target_dataset VARCHAR(512), -- Target dataset on remote system (for outbound) + target_ssh_key_path TEXT, -- Path to SSH private key (for outbound) + + -- For inbound replication (receiver) + source_host VARCHAR(255), -- Source host IP or hostname (for inbound) + source_port INTEGER DEFAULT 22, -- SSH port (for inbound) + source_user VARCHAR(255) DEFAULT 'root', -- SSH user (for inbound) + local_dataset VARCHAR(512), -- Local dataset to receive snapshots (for inbound) + + -- Common settings + schedule_type VARCHAR(50), -- 'manual', 'hourly', 'daily', 'weekly', 'monthly', 'cron' + schedule_config JSONB, -- Schedule configuration (similar to snapshot schedules) + compression VARCHAR(50) DEFAULT 'lz4', -- 'off', 'lz4', 'gzip', 'zstd' + encryption BOOLEAN DEFAULT false, -- Enable encryption during transfer + recursive BOOLEAN DEFAULT false, -- Replicate recursively + incremental BOOLEAN DEFAULT true, -- Use incremental replication + auto_snapshot BOOLEAN DEFAULT true, -- Auto-create snapshot before replication + + -- Status and tracking + enabled BOOLEAN NOT NULL DEFAULT true, + status VARCHAR(50) DEFAULT 'idle', -- 'idle', 'running', 'failed', 'paused' + last_run_at TIMESTAMP, + last_run_status VARCHAR(50), -- 'success', 'failed', 'partial' + last_run_error TEXT, + next_run_at TIMESTAMP, + last_snapshot_sent VARCHAR(512), -- Last snapshot successfully sent (for outbound) + last_snapshot_received VARCHAR(512), -- Last snapshot successfully received (for inbound) + + -- Statistics + total_runs INTEGER DEFAULT 0, + successful_runs INTEGER DEFAULT 0, + failed_runs INTEGER DEFAULT 0, + bytes_sent BIGINT DEFAULT 0, -- Total bytes sent (for outbound) + bytes_received BIGINT DEFAULT 0, -- Total bytes received (for inbound) + + created_by UUID REFERENCES users(id), + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + + -- Validation: ensure required fields based on direction + CONSTRAINT chk_direction CHECK (direction IN ('outbound', 'inbound')), + CONSTRAINT chk_outbound_fields CHECK ( + direction != 'outbound' OR ( + source_dataset IS NOT NULL AND + target_host IS NOT NULL AND + target_dataset IS NOT NULL + ) + ), + CONSTRAINT chk_inbound_fields CHECK ( + direction != 'inbound' OR ( + source_host IS NOT NULL AND + source_dataset IS NOT NULL AND + local_dataset IS NOT NULL + ) + ) +); + +-- Create indexes +CREATE INDEX IF NOT EXISTS idx_replication_tasks_direction ON replication_tasks(direction); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_enabled ON replication_tasks(enabled); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_status ON replication_tasks(status); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_next_run ON replication_tasks(next_run_at); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_source_dataset ON replication_tasks(source_dataset); +CREATE INDEX IF NOT EXISTS idx_replication_tasks_target_host ON replication_tasks(target_host); diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/014_add_client_categories_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/014_add_client_categories_table.sql new file mode 100644 index 0000000..4fad7d1 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/014_add_client_categories_table.sql @@ -0,0 +1,30 @@ +-- AtlasOS - Calypso +-- Client Categories Schema +-- Version: 14.0 +-- Adds category support for backup clients (File, Database, Virtual) + +-- Client metadata table to store additional information about clients +-- This extends the Bacula Client table with Calypso-specific metadata +CREATE TABLE IF NOT EXISTS client_metadata ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + client_id INTEGER NOT NULL, -- Bacula Client.ClientId + client_name VARCHAR(255) NOT NULL, -- Bacula Client.Name (for reference) + category VARCHAR(50) NOT NULL DEFAULT 'File', -- 'File', 'Database', 'Virtual' + description TEXT, + tags JSONB, -- Additional tags/metadata as JSON + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + + -- Ensure one metadata entry per client + CONSTRAINT unique_client_id UNIQUE (client_id), + CONSTRAINT chk_category CHECK (category IN ('File', 'Database', 'Virtual')) +); + +-- Indexes for performance +CREATE INDEX IF NOT EXISTS idx_client_metadata_client_id ON client_metadata(client_id); +CREATE INDEX IF NOT EXISTS idx_client_metadata_client_name ON client_metadata(client_name); +CREATE INDEX IF NOT EXISTS idx_client_metadata_category ON client_metadata(category); + +-- Add comment +COMMENT ON TABLE client_metadata IS 'Stores Calypso-specific metadata for backup clients, including category classification'; +COMMENT ON COLUMN client_metadata.category IS 'Client category: File (file system backups), Database (database backups), Virtual (virtual machine backups)'; diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/015_add_bacula_clients_table.sql b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/015_add_bacula_clients_table.sql new file mode 100644 index 0000000..add67e0 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/migrations/015_add_bacula_clients_table.sql @@ -0,0 +1,44 @@ +-- AtlasOS - Calypso +-- Migration 015: Add Bacula clients and capability history tables +-- +-- Adds tables for tracking registered Bacula agents, their backup capabilities, +-- and a history log for UI- or agent-triggered capability changes. Pending +-- updates are stored on the client row until the agent pulls them. + +CREATE TABLE IF NOT EXISTS bacula_clients ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + hostname TEXT NOT NULL, + ip_address TEXT, + agent_version TEXT, + status TEXT NOT NULL DEFAULT 'online', + backup_types JSONB NOT NULL, + pending_backup_types JSONB, + pending_requested_by UUID, + pending_requested_at TIMESTAMPTZ, + pending_notes TEXT, + metadata JSONB, + registered_by_user_id UUID NOT NULL, + last_seen TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + CONSTRAINT uniq_bacula_clients_hostname UNIQUE (hostname) +); + +CREATE INDEX IF NOT EXISTS idx_bacula_clients_registered_by ON bacula_clients (registered_by_user_id); +CREATE INDEX IF NOT EXISTS idx_bacula_clients_status ON bacula_clients (status); + +CREATE TABLE IF NOT EXISTS bacula_client_capability_history ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + client_id UUID NOT NULL REFERENCES bacula_clients (id) ON DELETE CASCADE, + backup_types JSONB NOT NULL, + source TEXT NOT NULL, + requested_by_user_id UUID, + requested_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + notes TEXT +); + +CREATE INDEX IF NOT EXISTS idx_bacula_client_capability_history_client ON bacula_client_capability_history (client_id); +CREATE INDEX IF NOT EXISTS idx_bacula_client_capability_history_requested_at ON bacula_client_capability_history (requested_at); + +COMMENT ON TABLE bacula_clients IS 'Tracks Bacula clients registered with Calypso, including pending capability pushes.'; +COMMENT ON TABLE bacula_client_capability_history IS 'Audit history of backup capability changes per client.'; diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/Packages.gz b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/Packages.gz new file mode 100644 index 0000000..4e1778b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/Packages.gz differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/adduser_3.137ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/adduser_3.137ubuntu1_all.deb new file mode 100644 index 0000000..c58f205 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/adduser_3.137ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt-utils_2.8.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt-utils_2.8.3_amd64.deb new file mode 100644 index 0000000..e42948d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt-utils_2.8.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt_2.8.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt_2.8.3_amd64.deb new file mode 100644 index 0000000..2a09945 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/apt_2.8.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/attr_1%3a2.5.2-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/attr_1%3a2.5.2-1build1.1_amd64.deb new file mode 100644 index 0000000..602fd4d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/attr_1%3a2.5.2-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-bscan_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-bscan_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..98ecd71 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-bscan_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-client_13.0.4-1build3_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-client_13.0.4-1build3_all.deb new file mode 100644 index 0000000..0c122ab Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-client_13.0.4-1build3_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common-sqlite3_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common-sqlite3_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..77c051c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common-sqlite3_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..022567c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-common_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-console_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-console_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..9949182 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-console_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-fd_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-fd_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..bea08e8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-fd_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-sd_13.0.4-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-sd_13.0.4-1build3_amd64.deb new file mode 100644 index 0000000..4d8b474 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bacula-sd_13.0.4-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-common_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-common_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..c5eeb4c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-common_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-x86-64-linux-gnu_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-x86-64-linux-gnu_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..79d317f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils-x86-64-linux-gnu_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..7111b5c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/binutils_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/build-essential_12.10ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/build-essential_12.10ubuntu1_amd64.deb new file mode 100644 index 0000000..236afa1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/build-essential_12.10ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/busybox-initramfs_1%3a1.36.1-6ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/busybox-initramfs_1%3a1.36.1-6ubuntu3.1_amd64.deb new file mode 100644 index 0000000..c3bfa62 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/busybox-initramfs_1%3a1.36.1-6ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bzip2_1.0.8-5.1build0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bzip2_1.0.8-5.1build0.1_amd64.deb new file mode 100644 index 0000000..6e0d78d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/bzip2_1.0.8-5.1build0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ca-certificates_20240203_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ca-certificates_20240203_all.deb new file mode 100644 index 0000000..baa12c0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ca-certificates_20240203_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cdebconf_0.271ubuntu3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cdebconf_0.271ubuntu3_amd64.deb new file mode 100644 index 0000000..8f0aa1e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cdebconf_0.271ubuntu3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/chrony_4.5-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/chrony_4.5-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..4cd4c44 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/chrony_4.5-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-base_1.4.3+dfsg-0ubuntu0.24.04.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-base_1.4.3+dfsg-0ubuntu0.24.04.1_all.deb new file mode 100644 index 0000000..bd00676 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-base_1.4.3+dfsg-0ubuntu0.24.04.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-daemon_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-daemon_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..93982fe Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-daemon_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-freshclam_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-freshclam_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..ff3dbfb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav-freshclam_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..e2117c3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamav_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamdscan_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamdscan_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..6561828 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/clamdscan_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/coreutils_9.4-3ubuntu6.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/coreutils_9.4-3ubuntu6.1_amd64.deb new file mode 100644 index 0000000..4a1860d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/coreutils_9.4-3ubuntu6.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpio_2.15+dfsg-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpio_2.15+dfsg-1ubuntu2_amd64.deb new file mode 100644 index 0000000..710b24c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpio_2.15+dfsg-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..539aeb2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..7e4e24f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-13_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..eb48228 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..a0fd7a4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/cpp_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/curl_8.5.0-2ubuntu10.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/curl_8.5.0-2ubuntu10.6_amd64.deb new file mode 100644 index 0000000..a4e25e6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/curl_8.5.0-2ubuntu10.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-bin_1.14.10-4ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-bin_1.14.10-4ubuntu4.1_amd64.deb new file mode 100644 index 0000000..c794fcc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-bin_1.14.10-4ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-broker_35-2ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-broker_35-2ubuntu0.1_amd64.deb new file mode 100644 index 0000000..7ee24a3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-broker_35-2ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-daemon_1.14.10-4ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-daemon_1.14.10-4ubuntu4.1_amd64.deb new file mode 100644 index 0000000..812b326 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-daemon_1.14.10-4ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-session-bus-common_1.14.10-4ubuntu4.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-session-bus-common_1.14.10-4ubuntu4.1_all.deb new file mode 100644 index 0000000..73dc640 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-session-bus-common_1.14.10-4ubuntu4.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-system-bus-common_1.14.10-4ubuntu4.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-system-bus-common_1.14.10-4ubuntu4.1_all.deb new file mode 100644 index 0000000..db2afcd Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-system-bus-common_1.14.10-4ubuntu4.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-user-session_1.14.10-4ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-user-session_1.14.10-4ubuntu4.1_amd64.deb new file mode 100644 index 0000000..ccdf20c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus-user-session_1.14.10-4ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus_1.14.10-4ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus_1.14.10-4ubuntu4.1_amd64.deb new file mode 100644 index 0000000..986a833 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dbus_1.14.10-4ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf-i18n_1.5.86ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf-i18n_1.5.86ubuntu1_all.deb new file mode 100644 index 0000000..3473be3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf-i18n_1.5.86ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf_1.5.86ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf_1.5.86ubuntu1_all.deb new file mode 100644 index 0000000..08baf94 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debconf_1.5.86ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debianutils_5.17build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debianutils_5.17build1_amd64.deb new file mode 100644 index 0000000..3bc71e4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/debianutils_5.17build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dhcpcd-base_1%3a10.0.6-1ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dhcpcd-base_1%3a10.0.6-1ubuntu3.1_amd64.deb new file mode 100644 index 0000000..18bc279 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dhcpcd-base_1%3a10.0.6-1ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dirmngr_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dirmngr_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..facb096 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dirmngr_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dkms_3.0.11-1ubuntu13_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dkms_3.0.11-1ubuntu13_all.deb new file mode 100644 index 0000000..1469326 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dkms_3.0.11-1ubuntu13_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmeventd_2%3a1.02.185-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmeventd_2%3a1.02.185-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..d5aebbd Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmeventd_2%3a1.02.185-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmidecode_3.5-3ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmidecode_3.5-3ubuntu0.1_amd64.deb new file mode 100644 index 0000000..0c651da Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmidecode_3.5-3ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmsetup_2%3a1.02.185-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmsetup_2%3a1.02.185-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..3677f32 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dmsetup_2%3a1.02.185-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg-dev_1.22.6ubuntu6.5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg-dev_1.22.6ubuntu6.5_all.deb new file mode 100644 index 0000000..ded9219 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg-dev_1.22.6ubuntu6.5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg_1.22.6ubuntu6.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg_1.22.6ubuntu6.5_amd64.deb new file mode 100644 index 0000000..683276b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dpkg_1.22.6ubuntu6.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dracut-install_060+5-1ubuntu3.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dracut-install_060+5-1ubuntu3.3_amd64.deb new file mode 100644 index 0000000..18eb74f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/dracut-install_060+5-1ubuntu3.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs-l10n_1.47.0-2.4~exp1ubuntu4.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs-l10n_1.47.0-2.4~exp1ubuntu4.1_all.deb new file mode 100644 index 0000000..75af721 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs-l10n_1.47.0-2.4~exp1ubuntu4.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs_1.47.0-2.4~exp1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs_1.47.0-2.4~exp1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..fd684f4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/e2fsprogs_1.47.0-2.4~exp1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fakeroot_1.33-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fakeroot_1.33-1_amd64.deb new file mode 100644 index 0000000..e4f07ef Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fakeroot_1.33-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/file_1%3a5.45-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/file_1%3a5.45-3build1_amd64.deb new file mode 100644 index 0000000..81fb552 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/file_1%3a5.45-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/finalrd_9build1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/finalrd_9build1_all.deb new file mode 100644 index 0000000..56a5c6f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/finalrd_9build1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fontconfig-config_2.15.0-1.1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fontconfig-config_2.15.0-1.1ubuntu2_amd64.deb new file mode 100644 index 0000000..18d589b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fontconfig-config_2.15.0-1.1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-core_20201225-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-core_20201225-2_all.deb new file mode 100644 index 0000000..16e427e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-core_20201225-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-mono_20201225-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-mono_20201225-2_all.deb new file mode 100644 index 0000000..7e50a6c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/fonts-noto-mono_20201225-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..0bf346d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..850959e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-13_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..ea1533c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..3ae7424 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/g++_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-base_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-base_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..7a83c85 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-base_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..5c5c8ed Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13-x86-64-linux-gnu_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..e489df9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-13_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-14-base_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-14-base_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..148fd41 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-14-base_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..830599d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc_4%3a13.2.0-7ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc_4%3a13.2.0-7ubuntu1_amd64.deb new file mode 100644 index 0000000..56e05db Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gcc_4%3a13.2.0-7ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gdisk_1.0.10-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gdisk_1.0.10-1build1_amd64.deb new file mode 100644 index 0000000..c11ce1b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gdisk_1.0.10-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-girepository-2.0_1.80.1-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-girepository-2.0_1.80.1-1_amd64.deb new file mode 100644 index 0000000..c507e03 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-girepository-2.0_1.80.1-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-glib-2.0_2.80.0-6ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-glib-2.0_2.80.0-6ubuntu3.6_amd64.deb new file mode 100644 index 0000000..a2da000 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gir1.2-glib-2.0_2.80.0-6ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git-man_1%3a2.43.0-1ubuntu7.3_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git-man_1%3a2.43.0-1ubuntu7.3_all.deb new file mode 100644 index 0000000..62c1539 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git-man_1%3a2.43.0-1ubuntu7.3_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git_1%3a2.43.0-1ubuntu7.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git_1%3a2.43.0-1ubuntu7.3_amd64.deb new file mode 100644 index 0000000..e843b4c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/git_1%3a2.43.0-1ubuntu7.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-l10n_2.4.4-2ubuntu17.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-l10n_2.4.4-2ubuntu17.4_all.deb new file mode 100644 index 0000000..94809f3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-l10n_2.4.4-2ubuntu17.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-utils_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-utils_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..9121c09 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg-utils_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg_2.4.4-2ubuntu17.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg_2.4.4-2ubuntu17.4_all.deb new file mode 100644 index 0000000..e68807d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gnupg_2.4.4-2ubuntu17.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-agent_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-agent_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..748c682 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-agent_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-wks-client_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-wks-client_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..fbc9974 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg-wks-client_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..6f6dd0b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpg_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgconf_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgconf_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..a0a75ba Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgconf_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgsm_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgsm_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..233bf11 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgsm_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgv_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgv_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..d4c024f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/gpgv_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/groff-base_1.23.0-3build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/groff-base_1.23.0-3build2_amd64.deb new file mode 100644 index 0000000..4f9c648 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/groff-base_1.23.0-3build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ibverbs-providers_50.0-2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ibverbs-providers_50.0-2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..18a9ef4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ibverbs-providers_50.0-2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/init-system-helpers_1.66ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/init-system-helpers_1.66ubuntu1_all.deb new file mode 100644 index 0000000..8c6c54d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/init-system-helpers_1.66ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-bin_0.142ubuntu25.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-bin_0.142ubuntu25.5_amd64.deb new file mode 100644 index 0000000..de022ff Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-bin_0.142ubuntu25.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-core_0.142ubuntu25.5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-core_0.142ubuntu25.5_all.deb new file mode 100644 index 0000000..8bcf4f1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/initramfs-tools-core_0.142ubuntu25.5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iproute2_6.1.0-1ubuntu6.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iproute2_6.1.0-1ubuntu6.2_amd64.deb new file mode 100644 index 0000000..2445ef8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iproute2_6.1.0-1ubuntu6.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iptables_1.8.10-3ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iptables_1.8.10-3ubuntu2_amd64.deb new file mode 100644 index 0000000..b5baa8c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/iptables_1.8.10-3ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/jq_1.7.1-3ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/jq_1.7.1-3ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..b824655 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/jq_1.7.1-3ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyboxd_2.4.4-2ubuntu17.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyboxd_2.4.4-2ubuntu17.4_amd64.deb new file mode 100644 index 0000000..ce45834 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyboxd_2.4.4-2ubuntu17.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyutils_1.6.3-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyutils_1.6.3-3build1_amd64.deb new file mode 100644 index 0000000..3286942 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/keyutils_1.6.3-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/klibc-utils_2.0.13-4ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/klibc-utils_2.0.13-4ubuntu0.2_amd64.deb new file mode 100644 index 0000000..e43fd35 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/klibc-utils_2.0.13-4ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/kmod_31+20240202-2ubuntu7.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/kmod_31+20240202-2ubuntu7.1_amd64.deb new file mode 100644 index 0000000..4e8758d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/kmod_31+20240202-2ubuntu7.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/krb5-locales_1.20.1-6ubuntu2.6_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/krb5-locales_1.20.1-6ubuntu2.6_all.deb new file mode 100644 index 0000000..cd69419 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/krb5-locales_1.20.1-6ubuntu2.6_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/less_590-2ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/less_590-2ubuntu2.1_amd64.deb new file mode 100644 index 0000000..1581c73 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/less_590-2ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libacl1_2.3.2-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libacl1_2.3.2-1build1.1_amd64.deb new file mode 100644 index 0000000..e814027 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libacl1_2.3.2-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaio1t64_0.3.113-6build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaio1t64_0.3.113-6build1.1_amd64.deb new file mode 100644 index 0000000..0c46dcf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaio1t64_0.3.113-6build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-perl_1.201-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-perl_1.201-1_all.deb new file mode 100644 index 0000000..1b02857 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-perl_1.201-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-xs-perl_0.04-8build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-xs-perl_0.04-8build3_amd64.deb new file mode 100644 index 0000000..fd4c644 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-diff-xs-perl_0.04-8build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-merge-perl_0.08-5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-merge-perl_0.08-5_all.deb new file mode 100644 index 0000000..0a7f4a3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libalgorithm-merge-perl_0.08-5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaom3_3.8.2-2ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaom3_3.8.2-2ubuntu0.1_amd64.deb new file mode 100644 index 0000000..584a153 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaom3_3.8.2-2ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapparmor1_4.0.1really4.0.1-0ubuntu0.24.04.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapparmor1_4.0.1really4.0.1-0ubuntu0.24.04.4_amd64.deb new file mode 100644 index 0000000..593530b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapparmor1_4.0.1really4.0.1-0ubuntu0.24.04.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapt-pkg6.0t64_2.8.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapt-pkg6.0t64_2.8.3_amd64.deb new file mode 100644 index 0000000..cfe9f65 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libapt-pkg6.0t64_2.8.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libargon2-1_0~20190702+dfsg-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libargon2-1_0~20190702+dfsg-4build1_amd64.deb new file mode 100644 index 0000000..66342f7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libargon2-1_0~20190702+dfsg-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libasan8_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libasan8_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..d27c7a3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libasan8_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libassuan0_2.5.6-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libassuan0_2.5.6-1build1_amd64.deb new file mode 100644 index 0000000..8e78b0e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libassuan0_2.5.6-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatm1t64_1%3a2.5.1-5.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatm1t64_1%3a2.5.1-5.1build1_amd64.deb new file mode 100644 index 0000000..fe601ee Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatm1t64_1%3a2.5.1-5.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatomic1_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatomic1_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..bb2a746 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libatomic1_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libattr1_1%3a2.5.2-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libattr1_1%3a2.5.2-1build1.1_amd64.deb new file mode 100644 index 0000000..82f5129 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libattr1_1%3a2.5.2-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit-common_1%3a3.1.2-2.1build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit-common_1%3a3.1.2-2.1build1.1_all.deb new file mode 100644 index 0000000..3885c7b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit-common_1%3a3.1.2-2.1build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit1_1%3a3.1.2-2.1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit1_1%3a3.1.2-2.1build1.1_amd64.deb new file mode 100644 index 0000000..ee84c96 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libaudit1_1%3a3.1.2-2.1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-client3_0.8-13ubuntu6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-client3_0.8-13ubuntu6_amd64.deb new file mode 100644 index 0000000..bf4c33a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-client3_0.8-13ubuntu6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common-data_0.8-13ubuntu6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common-data_0.8-13ubuntu6_amd64.deb new file mode 100644 index 0000000..233e083 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common-data_0.8-13ubuntu6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common3_0.8-13ubuntu6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common3_0.8-13ubuntu6_amd64.deb new file mode 100644 index 0000000..c8d4caf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libavahi-common3_0.8-13ubuntu6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbinutils_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbinutils_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..7e5e2b1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbinutils_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libblkid1_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libblkid1_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..800ca01 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libblkid1_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-iostreams1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-iostreams1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb new file mode 100644 index 0000000..a15015e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-iostreams1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-thread1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-thread1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb new file mode 100644 index 0000000..cdf09c5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libboost-thread1.83.0_1.83.0-2.1ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbpf1_1%3a1.3.0-2build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbpf1_1%3a1.3.0-2build2_amd64.deb new file mode 100644 index 0000000..eb80b2f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbpf1_1%3a1.3.0-2build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbrotli1_1.1.0-2build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbrotli1_1.1.0-2build2_amd64.deb new file mode 100644 index 0000000..59ef43d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbrotli1_1.1.0-2build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbsd0_0.12.1-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbsd0_0.12.1-1build1.1_amd64.deb new file mode 100644 index 0000000..00de5ea Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbsd0_0.12.1-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbz2-1.0_1.0.8-5.1build0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbz2-1.0_1.0.8-5.1build0.1_amd64.deb new file mode 100644 index 0000000..05235d6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libbz2-1.0_1.0.8-5.1build0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-dev-bin_2.39-0ubuntu8.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-dev-bin_2.39-0ubuntu8.6_amd64.deb new file mode 100644 index 0000000..7191515 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-dev-bin_2.39-0ubuntu8.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-devtools_2.39-0ubuntu8.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-devtools_2.39-0ubuntu8.6_amd64.deb new file mode 100644 index 0000000..c29368d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc-devtools_2.39-0ubuntu8.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6-dev_2.39-0ubuntu8.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6-dev_2.39-0ubuntu8.6_amd64.deb new file mode 100644 index 0000000..7fb0cfc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6-dev_2.39-0ubuntu8.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6_2.39-0ubuntu8.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6_2.39-0ubuntu8.6_amd64.deb new file mode 100644 index 0000000..0163554 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libc6_2.39-0ubuntu8.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap-ng0_0.8.4-2build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap-ng0_0.8.4-2build2_amd64.deb new file mode 100644 index 0000000..3f259e6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap-ng0_0.8.4-2build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2-bin_1%3a2.66-5ubuntu2.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2-bin_1%3a2.66-5ubuntu2.2_amd64.deb new file mode 100644 index 0000000..880d8fa Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2-bin_1%3a2.66-5ubuntu2.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2_1%3a2.66-5ubuntu2.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2_1%3a2.66-5ubuntu2.2_amd64.deb new file mode 100644 index 0000000..01ac783 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcap2_1%3a2.66-5ubuntu2.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcc1-0_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcc1-0_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..036d673 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcc1-0_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcephfs2_19.2.1-0ubuntu0.24.04.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcephfs2_19.2.1-0ubuntu0.24.04.2_amd64.deb new file mode 100644 index 0000000..a671993 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcephfs2_19.2.1-0ubuntu0.24.04.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libclamav12_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libclamav12_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..01c71b2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libclamav12_1.4.3+dfsg-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcom-err2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcom-err2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..63f9de1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcom-err2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcommon-sense-perl_3.75-3build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcommon-sense-perl_3.75-3build3_amd64.deb new file mode 100644 index 0000000..1924768 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcommon-sense-perl_3.75-3build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt-dev_1%3a4.4.36-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt-dev_1%3a4.4.36-4build1_amd64.deb new file mode 100644 index 0000000..44d083e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt-dev_1%3a4.4.36-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt1_1%3a4.4.36-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt1_1%3a4.4.36-4build1_amd64.deb new file mode 100644 index 0000000..85ba6ef Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcrypt1_1%3a4.4.36-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcryptsetup12_2%3a2.7.0-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcryptsetup12_2%3a2.7.0-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..d408fde Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcryptsetup12_2%3a2.7.0-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf-nobfd0_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf-nobfd0_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..4cc583f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf-nobfd0_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf0_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf0_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..f7fce39 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libctf0_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcups2t64_2.4.7-1.2ubuntu7.9_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcups2t64_2.4.7-1.2ubuntu7.9_amd64.deb new file mode 100644 index 0000000..9e09c5d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcups2t64_2.4.7-1.2ubuntu7.9_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl3t64-gnutls_8.5.0-2ubuntu10.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl3t64-gnutls_8.5.0-2ubuntu10.6_amd64.deb new file mode 100644 index 0000000..d00dd74 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl3t64-gnutls_8.5.0-2ubuntu10.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl4t64_8.5.0-2ubuntu10.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl4t64_8.5.0-2ubuntu10.6_amd64.deb new file mode 100644 index 0000000..d692757 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libcurl4t64_8.5.0-2ubuntu10.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdav1d7_1.4.1-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdav1d7_1.4.1-1build1_amd64.deb new file mode 100644 index 0000000..019ae58 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdav1d7_1.4.1-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdb5.3t64_5.3.28+dfsg2-7_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdb5.3t64_5.3.28+dfsg2-7_amd64.deb new file mode 100644 index 0000000..c88730a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdb5.3t64_5.3.28+dfsg2-7_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdbus-1-3_1.14.10-4ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdbus-1-3_1.14.10-4ubuntu4.1_amd64.deb new file mode 100644 index 0000000..78bc9fc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdbus-1-3_1.14.10-4ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libde265-0_1.0.15-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libde265-0_1.0.15-1build3_amd64.deb new file mode 100644 index 0000000..790252e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libde265-0_1.0.15-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdebian-installer4_0.124ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdebian-installer4_0.124ubuntu2_amd64.deb new file mode 100644 index 0000000..2bcb264 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdebian-installer4_0.124ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdeflate0_1.19-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdeflate0_1.19-1build1.1_amd64.deb new file mode 100644 index 0000000..01abaea Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdeflate0_1.19-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper-event1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper-event1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..da10469 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper-event1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..7180407 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdevmapper1.02.1_2%3a1.02.185-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdpkg-perl_1.22.6ubuntu6.5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdpkg-perl_1.22.6ubuntu6.5_all.deb new file mode 100644 index 0000000..447689e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libdpkg-perl_1.22.6ubuntu6.5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libedit2_3.1-20230828-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libedit2_3.1-20230828-1build1_amd64.deb new file mode 100644 index 0000000..a7ce08b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libedit2_3.1-20230828-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libelf1t64_0.190-1.1ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libelf1t64_0.190-1.1ubuntu0.1_amd64.deb new file mode 100644 index 0000000..5e2deb9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libelf1t64_0.190-1.1ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liberror-perl_0.17029-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liberror-perl_0.17029-2_all.deb new file mode 100644 index 0000000..4be4022 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liberror-perl_0.17029-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libevent-core-2.1-7t64_2.1.12-stable-9ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libevent-core-2.1-7t64_2.1.12-stable-9ubuntu2_amd64.deb new file mode 100644 index 0000000..41fd2b4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libevent-core-2.1-7t64_2.1.12-stable-9ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libexpat1_2.6.1-2ubuntu0.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libexpat1_2.6.1-2ubuntu0.3_amd64.deb new file mode 100644 index 0000000..d0c300d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libexpat1_2.6.1-2ubuntu0.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libext2fs2t64_1.47.0-2.4~exp1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libext2fs2t64_1.47.0-2.4~exp1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..e54d98a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libext2fs2t64_1.47.0-2.4~exp1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfakeroot_1.33-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfakeroot_1.33-1_amd64.deb new file mode 100644 index 0000000..287343e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfakeroot_1.33-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfdisk1_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfdisk1_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..8e2703e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfdisk1_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libffi8_3.4.6-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libffi8_3.4.6-1build1_amd64.deb new file mode 100644 index 0000000..b54f431 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libffi8_3.4.6-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfile-fcntllock-perl_0.22-4ubuntu5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfile-fcntllock-perl_0.22-4ubuntu5_amd64.deb new file mode 100644 index 0000000..e3c0cc6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfile-fcntllock-perl_0.22-4ubuntu5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfontconfig1_2.15.0-1.1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfontconfig1_2.15.0-1.1ubuntu2_amd64.deb new file mode 100644 index 0000000..24eed88 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfontconfig1_2.15.0-1.1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfreetype6_2.13.2+dfsg-1build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfreetype6_2.13.2+dfsg-1build3_amd64.deb new file mode 100644 index 0000000..ea09246 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfreetype6_2.13.2+dfsg-1build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfribidi0_1.0.13-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfribidi0_1.0.13-3build1_amd64.deb new file mode 100644 index 0000000..e4a1494 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libfribidi0_1.0.13-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..48d4d82 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-s1_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-s1_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..61a2d4d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcc-s1_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcrypt20_1.10.3-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcrypt20_1.10.3-2build1_amd64.deb new file mode 100644 index 0000000..42ac962 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgcrypt20_1.10.3-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgd3_2.3.3-9ubuntu5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgd3_2.3.3-9ubuntu5_amd64.deb new file mode 100644 index 0000000..84cb304 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgd3_2.3.3-9ubuntu5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm-compat4t64_1.23-5.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm-compat4t64_1.23-5.1build1_amd64.deb new file mode 100644 index 0000000..9807e27 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm-compat4t64_1.23-5.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm6t64_1.23-5.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm6t64_1.23-5.1build1_amd64.deb new file mode 100644 index 0000000..da6085e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgdbm6t64_1.23-5.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgirepository-1.0-1_1.80.1-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgirepository-1.0-1_1.80.1-1_amd64.deb new file mode 100644 index 0000000..e6752a1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgirepository-1.0-1_1.80.1-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-0t64_2.80.0-6ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-0t64_2.80.0-6ubuntu3.6_amd64.deb new file mode 100644 index 0000000..0e89504 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-0t64_2.80.0-6ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-data_2.80.0-6ubuntu3.6_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-data_2.80.0-6ubuntu3.6_all.deb new file mode 100644 index 0000000..778364b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libglib2.0-data_2.80.0-6ubuntu3.6_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgmp10_2%3a6.3.0+dfsg-2ubuntu6.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgmp10_2%3a6.3.0+dfsg-2ubuntu6.1_amd64.deb new file mode 100644 index 0000000..228e77a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgmp10_2%3a6.3.0+dfsg-2ubuntu6.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgnutls30t64_3.8.3-1.1ubuntu3.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgnutls30t64_3.8.3-1.1ubuntu3.4_amd64.deb new file mode 100644 index 0000000..ff22b10 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgnutls30t64_3.8.3-1.1ubuntu3.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgomp1_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgomp1_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..c98626f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgomp1_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error-l10n_1.47-3build2.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error-l10n_1.47-3build2.1_all.deb new file mode 100644 index 0000000..7869a27 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error-l10n_1.47-3build2.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error0_1.47-3build2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error0_1.47-3build2.1_amd64.deb new file mode 100644 index 0000000..05f7dd6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpg-error0_1.47-3build2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpgme11t64_1.18.0-4.1ubuntu4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpgme11t64_1.18.0-4.1ubuntu4_amd64.deb new file mode 100644 index 0000000..b0e8dbf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpgme11t64_1.18.0-4.1ubuntu4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpm2_1.20.7-11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpm2_1.20.7-11_amd64.deb new file mode 100644 index 0000000..3adc777 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgpm2_1.20.7-11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgprofng0_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgprofng0_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..8cf8b85 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgprofng0_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgssapi-krb5-2_1.20.1-6ubuntu2.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgssapi-krb5-2_1.20.1-6ubuntu2.6_amd64.deb new file mode 100644 index 0000000..edcc035 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libgssapi-krb5-2_1.20.1-6ubuntu2.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-aomenc_1.17.6-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-aomenc_1.17.6-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..9159bd4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-aomenc_1.17.6-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-dav1d_1.17.6-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-dav1d_1.17.6-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..ced00d0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-dav1d_1.17.6-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-libde265_1.17.6-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-libde265_1.17.6-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..86a4b84 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif-plugin-libde265_1.17.6-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif1_1.17.6-1ubuntu4.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif1_1.17.6-1ubuntu4.2_amd64.deb new file mode 100644 index 0000000..6fca08a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libheif1_1.17.6-1ubuntu4.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhogweed6t64_3.9.1-2.2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhogweed6t64_3.9.1-2.2build1.1_amd64.deb new file mode 100644 index 0000000..a82eff8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhogweed6t64_3.9.1-2.2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhwasan0_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhwasan0_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..d9f5cd2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libhwasan0_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libibverbs1_50.0-2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libibverbs1_50.0-2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..567321d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libibverbs1_50.0-2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libicu74_74.2-1ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libicu74_74.2-1ubuntu3.1_amd64.deb new file mode 100644 index 0000000..e493699 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libicu74_74.2-1ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libidn2-0_2.3.7-2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libidn2-0_2.3.7-2build1.1_amd64.deb new file mode 100644 index 0000000..5ce9fe4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libidn2-0_2.3.7-2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libinih1_55-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libinih1_55-1ubuntu2_amd64.deb new file mode 100644 index 0000000..420f52f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libinih1_55-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip4tc2_1.8.10-3ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip4tc2_1.8.10-3ubuntu2_amd64.deb new file mode 100644 index 0000000..b09d279 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip4tc2_1.8.10-3ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip6tc2_1.8.10-3ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip6tc2_1.8.10-3ubuntu2_amd64.deb new file mode 100644 index 0000000..013e5bf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libip6tc2_1.8.10-3ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisl23_0.26-3build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisl23_0.26-3build1.1_amd64.deb new file mode 100644 index 0000000..a6af944 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisl23_0.26-3build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisns0t64_0.101-0.3build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisns0t64_0.101-0.3build3_amd64.deb new file mode 100644 index 0000000..f698b6f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libisns0t64_0.101-0.3build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libitm1_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libitm1_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..b6c215e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libitm1_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjansson4_2.14-2build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjansson4_2.14-2build2_amd64.deb new file mode 100644 index 0000000..ba7b56e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjansson4_2.14-2build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjbig0_2.1-6.1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjbig0_2.1-6.1ubuntu2_amd64.deb new file mode 100644 index 0000000..f866bd7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjbig0_2.1-6.1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg-turbo8_2.1.5-2ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg-turbo8_2.1.5-2ubuntu2_amd64.deb new file mode 100644 index 0000000..d515178 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg-turbo8_2.1.5-2ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg8_8c-2ubuntu11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg8_8c-2ubuntu11_amd64.deb new file mode 100644 index 0000000..a78b112 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjpeg8_8c-2ubuntu11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjq1_1.7.1-3ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjq1_1.7.1-3ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..b943ce4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjq1_1.7.1-3ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-c5_0.17-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-c5_0.17-1build1_amd64.deb new file mode 100644 index 0000000..78e6ead Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-c5_0.17-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-perl_4.10000-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-perl_4.10000-1_all.deb new file mode 100644 index 0000000..4f0bfc0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-perl_4.10000-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-xs-perl_4.040-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-xs-perl_4.040-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..f2cc4f1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libjson-xs-perl_4.040-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libk5crypto3_1.20.1-6ubuntu2.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libk5crypto3_1.20.1-6ubuntu2.6_amd64.deb new file mode 100644 index 0000000..0729c60 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libk5crypto3_1.20.1-6ubuntu2.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkeyutils1_1.6.3-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkeyutils1_1.6.3-3build1_amd64.deb new file mode 100644 index 0000000..e5b8263 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkeyutils1_1.6.3-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libklibc_2.0.13-4ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libklibc_2.0.13-4ubuntu0.2_amd64.deb new file mode 100644 index 0000000..67e0bdc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libklibc_2.0.13-4ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkmod2_31+20240202-2ubuntu7.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkmod2_31+20240202-2ubuntu7.1_amd64.deb new file mode 100644 index 0000000..4109e18 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkmod2_31+20240202-2ubuntu7.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5-3_1.20.1-6ubuntu2.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5-3_1.20.1-6ubuntu2.6_amd64.deb new file mode 100644 index 0000000..ab892b0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5-3_1.20.1-6ubuntu2.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5support0_1.20.1-6ubuntu2.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5support0_1.20.1-6ubuntu2.6_amd64.deb new file mode 100644 index 0000000..c916153 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libkrb5support0_1.20.1-6ubuntu2.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libksba8_1.6.6-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libksba8_1.6.6-1build1_amd64.deb new file mode 100644 index 0000000..9b142d0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libksba8_1.6.6-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap-common_2.6.7+dfsg-1~exp1ubuntu8.2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap-common_2.6.7+dfsg-1~exp1ubuntu8.2_all.deb new file mode 100644 index 0000000..8ced789 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap-common_2.6.7+dfsg-1~exp1ubuntu8.2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap2_2.6.7+dfsg-1~exp1ubuntu8.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap2_2.6.7+dfsg-1~exp1ubuntu8.2_amd64.deb new file mode 100644 index 0000000..c4d5d1f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldap2_2.6.7+dfsg-1~exp1ubuntu8.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldb2_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldb2_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..3721f3a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libldb2_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblerc4_4.0.0+ds-4ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblerc4_4.0.0+ds-4ubuntu2_amd64.deb new file mode 100644 index 0000000..c1a86f7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblerc4_4.0.0+ds-4ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libllvm17t64_1%3a17.0.6-9ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libllvm17t64_1%3a17.0.6-9ubuntu1_amd64.deb new file mode 100644 index 0000000..148b4c9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libllvm17t64_1%3a17.0.6-9ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblmdb0_0.9.31-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblmdb0_0.9.31-1build1_amd64.deb new file mode 100644 index 0000000..e06e8d7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblmdb0_0.9.31-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblocale-gettext-perl_1.07-6ubuntu5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblocale-gettext-perl_1.07-6ubuntu5_amd64.deb new file mode 100644 index 0000000..75014f9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblocale-gettext-perl_1.07-6ubuntu5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblsan0_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblsan0_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..e051d7a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblsan0_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblvm2cmd2.03_2.03.16-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblvm2cmd2.03_2.03.16-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..09e4e6d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblvm2cmd2.03_2.03.16-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblz4-1_1.9.4-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblz4-1_1.9.4-1build1.1_amd64.deb new file mode 100644 index 0000000..66726bd Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblz4-1_1.9.4-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzma5_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzma5_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb new file mode 100644 index 0000000..05d86ae Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzma5_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-2_2.10-2build4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-2_2.10-2build4_amd64.deb new file mode 100644 index 0000000..54ab58d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-2_2.10-2build4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-dev_2.10-2build4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-dev_2.10-2build4_amd64.deb new file mode 100644 index 0000000..87a5fe7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liblzo2-dev_2.10-2build4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic-mgc_1%3a5.45-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic-mgc_1%3a5.45-3build1_amd64.deb new file mode 100644 index 0000000..e09c1b9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic-mgc_1%3a5.45-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic1t64_1%3a5.45-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic1t64_1%3a5.45-3build1_amd64.deb new file mode 100644 index 0000000..c214212 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmagic1t64_1%3a5.45-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmd0_1.1.0-2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmd0_1.1.0-2build1.1_amd64.deb new file mode 100644 index 0000000..e775dae Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmd0_1.1.0-2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmnl0_1.0.5-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmnl0_1.0.5-2build1_amd64.deb new file mode 100644 index 0000000..210cee8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmnl0_1.0.5-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmount1_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmount1_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..5625ceb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmount1_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpc3_1.3.1-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpc3_1.3.1-1build1.1_amd64.deb new file mode 100644 index 0000000..dbd5247 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpc3_1.3.1-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpfr6_4.2.1-1build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpfr6_4.2.1-1build1.1_amd64.deb new file mode 100644 index 0000000..448a3b8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmpfr6_4.2.1-1build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmspack0t64_0.11-1.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmspack0t64_0.11-1.1build1_amd64.deb new file mode 100644 index 0000000..d86019e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libmspack0t64_0.11-1.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncurses6_6.4+20240113-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncurses6_6.4+20240113-1ubuntu2_amd64.deb new file mode 100644 index 0000000..86cbf67 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncurses6_6.4+20240113-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncursesw6_6.4+20240113-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncursesw6_6.4+20240113-1ubuntu2_amd64.deb new file mode 100644 index 0000000..cc1d441 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libncursesw6_6.4+20240113-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnetfilter-conntrack3_1.0.9-6build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnetfilter-conntrack3_1.0.9-6build1_amd64.deb new file mode 100644 index 0000000..195387a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnetfilter-conntrack3_1.0.9-6build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnettle8t64_3.9.1-2.2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnettle8t64_3.9.1-2.2build1.1_amd64.deb new file mode 100644 index 0000000..1b25acc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnettle8t64_3.9.1-2.2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnewt0.52_0.52.24-2ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnewt0.52_0.52.24-2ubuntu2_amd64.deb new file mode 100644 index 0000000..798d5b1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnewt0.52_0.52.24-2ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfnetlink0_1.0.2-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfnetlink0_1.0.2-2build1_amd64.deb new file mode 100644 index 0000000..2758b98 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfnetlink0_1.0.2-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfsidmap1_1%3a2.6.4-3ubuntu5.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfsidmap1_1%3a2.6.4-3ubuntu5.1_amd64.deb new file mode 100644 index 0000000..6cc31a6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnfsidmap1_1%3a2.6.4-3ubuntu5.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftables1_1.0.9-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftables1_1.0.9-1build1_amd64.deb new file mode 100644 index 0000000..f115c67 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftables1_1.0.9-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftnl11_1.2.6-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftnl11_1.2.6-2build1_amd64.deb new file mode 100644 index 0000000..f7f25de Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnftnl11_1.2.6-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnghttp2-14_1.59.0-1ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnghttp2-14_1.59.0-1ubuntu0.2_amd64.deb new file mode 100644 index 0000000..227bae3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnghttp2-14_1.59.0-1ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-3-200_3.7.0-0.3build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-3-200_3.7.0-0.3build1.1_amd64.deb new file mode 100644 index 0000000..8ceeab2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-3-200_3.7.0-0.3build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-route-3-200_3.7.0-0.3build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-route-3-200_3.7.0-0.3build1.1_amd64.deb new file mode 100644 index 0000000..5ecaca0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnl-route-3-200_3.7.0-0.3build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnpth0t64_1.6-3.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnpth0t64_1.6-3.1build1_amd64.deb new file mode 100644 index 0000000..18e3446 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnpth0t64_1.6-3.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnss-systemd_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnss-systemd_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..5c0ffb5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnss-systemd_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvme1t64_1.8-3ubuntu1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvme1t64_1.8-3ubuntu1_amd64.deb new file mode 100644 index 0000000..ccf3d0d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvme1t64_1.8-3ubuntu1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvpair3linux_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvpair3linux_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..d2f7ef8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libnvpair3linux_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libonig5_6.9.9-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libonig5_6.9.9-1build1_amd64.deb new file mode 100644 index 0000000..9892724 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libonig5_6.9.9-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libopeniscsiusr_2.1.9-3ubuntu5.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libopeniscsiusr_2.1.9-3ubuntu5.4_amd64.deb new file mode 100644 index 0000000..f2bc451 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libopeniscsiusr_2.1.9-3ubuntu5.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libp11-kit0_0.25.3-4ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libp11-kit0_0.25.3-4ubuntu2.1_amd64.deb new file mode 100644 index 0000000..0673f0c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libp11-kit0_0.25.3-4ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-cap_1%3a2.66-5ubuntu2.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-cap_1%3a2.66-5ubuntu2.2_amd64.deb new file mode 100644 index 0000000..670c06f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-cap_1%3a2.66-5ubuntu2.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules-bin_1.5.3-5ubuntu5.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules-bin_1.5.3-5ubuntu5.5_amd64.deb new file mode 100644 index 0000000..46b6273 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules-bin_1.5.3-5ubuntu5.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules_1.5.3-5ubuntu5.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules_1.5.3-5ubuntu5.5_amd64.deb new file mode 100644 index 0000000..bc18fd9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-modules_1.5.3-5ubuntu5.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-runtime_1.5.3-5ubuntu5.5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-runtime_1.5.3-5ubuntu5.5_all.deb new file mode 100644 index 0000000..7358edc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-runtime_1.5.3-5ubuntu5.5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-systemd_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-systemd_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..ee3ea0b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam-systemd_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam0g_1.5.3-5ubuntu5.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam0g_1.5.3-5ubuntu5.5_amd64.deb new file mode 100644 index 0000000..3e82b16 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpam0g_1.5.3-5ubuntu5.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libparted2t64_3.6-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libparted2t64_3.6-4build1_amd64.deb new file mode 100644 index 0000000..c0d0b00 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libparted2t64_3.6-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpcre2-8-0_10.42-4ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpcre2-8-0_10.42-4ubuntu2.1_amd64.deb new file mode 100644 index 0000000..92a173c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpcre2-8-0_10.42-4ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libperl5.38t64_5.38.2-3.2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libperl5.38t64_5.38.2-3.2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..6c5a775 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libperl5.38t64_5.38.2-3.2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpng16-16t64_1.6.43-5ubuntu0.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpng16-16t64_1.6.43-5ubuntu0.3_amd64.deb new file mode 100644 index 0000000..b8faa30 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpng16-16t64_1.6.43-5ubuntu0.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpopt0_1.19+dfsg-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpopt0_1.19+dfsg-1build1_amd64.deb new file mode 100644 index 0000000..cf0a94f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpopt0_1.19+dfsg-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq-dev_16.11-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq-dev_16.11-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..42b698e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq-dev_16.11-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq5_16.11-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq5_16.11-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..4961007 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpq5_16.11-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libproc2-0_2%3a4.0.4-4ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libproc2-0_2%3a4.0.4-4ubuntu3.2_amd64.deb new file mode 100644 index 0000000..2588695 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libproc2-0_2%3a4.0.4-4ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpsl5t64_0.21.2-1.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpsl5t64_0.21.2-1.1build1_amd64.deb new file mode 100644 index 0000000..d44dc52 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpsl5t64_0.21.2-1.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3-stdlib_3.12.3-0ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3-stdlib_3.12.3-0ubuntu2.1_amd64.deb new file mode 100644 index 0000000..bf4c2a3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3-stdlib_3.12.3-0ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb new file mode 100644 index 0000000..a2f7db2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-stdlib_3.12.3-1ubuntu0.10_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-stdlib_3.12.3-1ubuntu0.10_amd64.deb new file mode 100644 index 0000000..31e83a6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12-stdlib_3.12.3-1ubuntu0.10_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12t64_3.12.3-1ubuntu0.10_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12t64_3.12.3-1ubuntu0.10_amd64.deb new file mode 100644 index 0000000..3831f83 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libpython3.12t64_3.12.3-1ubuntu0.10_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libquadmath0_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libquadmath0_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..e2590c7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libquadmath0_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librados2_19.2.1-0ubuntu0.24.04.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librados2_19.2.1-0ubuntu0.24.04.2_amd64.deb new file mode 100644 index 0000000..61cefbc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librados2_19.2.1-0ubuntu0.24.04.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librdmacm1t64_50.0-2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librdmacm1t64_50.0-2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..aed9b0e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librdmacm1t64_50.0-2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libreadline8t64_8.2-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libreadline8t64_8.2-4build1_amd64.deb new file mode 100644 index 0000000..5e7fc34 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libreadline8t64_8.2-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librtmp1_2.4+20151223.gitfa8646d.1-2build7_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librtmp1_2.4+20151223.gitfa8646d.1-2build7_amd64.deb new file mode 100644 index 0000000..88c8545 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/librtmp1_2.4+20151223.gitfa8646d.1-2build7_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-2_2.1.28+dfsg1-5ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-2_2.1.28+dfsg1-5ubuntu3.1_amd64.deb new file mode 100644 index 0000000..364b23b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-2_2.1.28+dfsg1-5ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules-db_2.1.28+dfsg1-5ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules-db_2.1.28+dfsg1-5ubuntu3.1_amd64.deb new file mode 100644 index 0000000..b6c962e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules-db_2.1.28+dfsg1-5ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules_2.1.28+dfsg1-5ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules_2.1.28+dfsg1-5ubuntu3.1_amd64.deb new file mode 100644 index 0000000..d87da59 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsasl2-modules_2.1.28+dfsg1-5ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libseccomp2_2.5.5-1ubuntu3.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libseccomp2_2.5.5-1ubuntu3.1_amd64.deb new file mode 100644 index 0000000..c22903d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libseccomp2_2.5.5-1ubuntu3.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libselinux1_3.5-2ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libselinux1_3.5-2ubuntu2.1_amd64.deb new file mode 100644 index 0000000..f425843 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libselinux1_3.5-2ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage-common_3.5-1build5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage-common_3.5-1build5_all.deb new file mode 100644 index 0000000..2f7f33e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage-common_3.5-1build5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage2_3.5-1build5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage2_3.5-1build5_amd64.deb new file mode 100644 index 0000000..020ae48 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsemanage2_3.5-1build5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors-config_1%3a3.6.0-9build1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors-config_1%3a3.6.0-9build1_all.deb new file mode 100644 index 0000000..538ec16 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors-config_1%3a3.6.0-9build1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors5_1%3a3.6.0-9build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors5_1%3a3.6.0-9build1_amd64.deb new file mode 100644 index 0000000..8e29a85 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsensors5_1%3a3.6.0-9build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsepol2_3.5-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsepol2_3.5-2build1_amd64.deb new file mode 100644 index 0000000..f0343e3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsepol2_3.5-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsframe1_2.42-4ubuntu2.8_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsframe1_2.42-4ubuntu2.8_amd64.deb new file mode 100644 index 0000000..e013c47 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsframe1_2.42-4ubuntu2.8_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-1.46-2_1.46-3ubuntu4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-1.46-2_1.46-3ubuntu4_amd64.deb new file mode 100644 index 0000000..e32c5fb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-1.46-2_1.46-3ubuntu4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-dev_1.46-3ubuntu4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-dev_1.46-3ubuntu4_amd64.deb new file mode 100644 index 0000000..4a2ee3d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsgutils2-dev_1.46-3ubuntu4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsharpyuv0_1.3.2-0.4build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsharpyuv0_1.3.2-0.4build3_amd64.deb new file mode 100644 index 0000000..a1c08b5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsharpyuv0_1.3.2-0.4build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libslang2_2.3.3-3build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libslang2_2.3.3-3build2_amd64.deb new file mode 100644 index 0000000..2936f56 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libslang2_2.3.3-3build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsmartcols1_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsmartcols1_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..0c44c0a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsmartcols1_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsqlite3-0_3.45.1-1ubuntu2.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsqlite3-0_3.45.1-1ubuntu2.5_amd64.deb new file mode 100644 index 0000000..23aebdf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsqlite3-0_3.45.1-1ubuntu2.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libss2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libss2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..2c80201 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libss2_1.47.0-2.4~exp1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssh-4_0.10.6-2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssh-4_0.10.6-2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..5c3f864 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssh-4_0.10.6-2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl-dev_3.0.13-0ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl-dev_3.0.13-0ubuntu3.6_amd64.deb new file mode 100644 index 0000000..7ce0a40 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl-dev_3.0.13-0ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl3t64_3.0.13-0ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl3t64_3.0.13-0ubuntu3.6_amd64.deb new file mode 100644 index 0000000..b40b3ec Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libssl3t64_3.0.13-0ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..83ce0b6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++-13-dev_13.3.0-6ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++6_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++6_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..05e380b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libstdc++6_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd-shared_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd-shared_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..dde5c4d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd-shared_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd0_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd0_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..42c6a5d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libsystemd0_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtalloc2_2.4.2-1build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtalloc2_2.4.2-1build2_amd64.deb new file mode 100644 index 0000000..229c149 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtalloc2_2.4.2-1build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtasn1-6_4.19.0-3ubuntu0.24.04.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtasn1-6_4.19.0-3ubuntu0.24.04.2_amd64.deb new file mode 100644 index 0000000..f2db08c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtasn1-6_4.19.0-3ubuntu0.24.04.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtdb1_1.4.10-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtdb1_1.4.10-1build1_amd64.deb new file mode 100644 index 0000000..8cf1ba8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtdb1_1.4.10-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtevent0t64_0.16.1-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtevent0t64_0.16.1-2build1_amd64.deb new file mode 100644 index 0000000..d2f57e9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtevent0t64_0.16.1-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-charwidth-perl_0.04-11build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-charwidth-perl_0.04-11build3_amd64.deb new file mode 100644 index 0000000..9442890 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-charwidth-perl_0.04-11build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-iconv-perl_1.7-8build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-iconv-perl_1.7-8build3_amd64.deb new file mode 100644 index 0000000..602fe39 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-iconv-perl_1.7-8build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-wrapi18n-perl_0.06-10_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-wrapi18n-perl_0.06-10_all.deb new file mode 100644 index 0000000..c28c598 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtext-wrapi18n-perl_0.06-10_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtextwrap1_0.1-17build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtextwrap1_0.1-17build1_amd64.deb new file mode 100644 index 0000000..2e5a672 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtextwrap1_0.1-17build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtiff6_4.5.1+git230720-4ubuntu2.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtiff6_4.5.1+git230720-4ubuntu2.4_amd64.deb new file mode 100644 index 0000000..ead5293 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtiff6_4.5.1+git230720-4ubuntu2.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtinfo6_6.4+20240113-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtinfo6_6.4+20240113-1ubuntu2_amd64.deb new file mode 100644 index 0000000..5830137 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtinfo6_6.4+20240113-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc-common_1.3.4+ds-1.1build1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc-common_1.3.4+ds-1.1build1_all.deb new file mode 100644 index 0000000..1793632 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc-common_1.3.4+ds-1.1build1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc3t64_1.3.4+ds-1.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc3t64_1.3.4+ds-1.1build1_amd64.deb new file mode 100644 index 0000000..b61ff03 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtirpc3t64_1.3.4+ds-1.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtsan2_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtsan2_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..a9743a9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtsan2_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtypes-serialiser-perl_1.01-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtypes-serialiser-perl_1.01-1_all.deb new file mode 100644 index 0000000..c0ef8a4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libtypes-serialiser-perl_1.01-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libubsan1_14.2.0-4ubuntu2~24.04_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libubsan1_14.2.0-4ubuntu2~24.04_amd64.deb new file mode 100644 index 0000000..1e44437 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libubsan1_14.2.0-4ubuntu2~24.04_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuchardet0_0.0.8-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuchardet0_0.0.8-1build1_amd64.deb new file mode 100644 index 0000000..296ed3a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuchardet0_0.0.8-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libudev1_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libudev1_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..19e984d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libudev1_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libunistring5_1.1-2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libunistring5_1.1-2build1.1_amd64.deb new file mode 100644 index 0000000..19f03ea Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libunistring5_1.1-2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburcu8t64_0.14.0-3.1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburcu8t64_0.14.0-3.1build1_amd64.deb new file mode 100644 index 0000000..8c2a8c1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburcu8t64_0.14.0-3.1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburing2_2.5-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburing2_2.5-1build1_amd64.deb new file mode 100644 index 0000000..f4d53b8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/liburing2_2.5-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuuid1_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuuid1_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..0d91e88 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuuid1_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuutil3linux_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuutil3linux_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..63b3fc3 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libuutil3linux_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwbclient0_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwbclient0_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..e5b4403 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwbclient0_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwebp7_1.3.2-0.4build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwebp7_1.3.2-0.4build3_amd64.deb new file mode 100644 index 0000000..51e40e6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwebp7_1.3.2-0.4build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwrap0_7.6.q-33_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwrap0_7.6.q-33_amd64.deb new file mode 100644 index 0000000..9d9f1a9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libwrap0_7.6.q-33_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-6_2%3a1.8.7-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-6_2%3a1.8.7-1build1_amd64.deb new file mode 100644 index 0000000..83f931a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-6_2%3a1.8.7-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-data_2%3a1.8.7-1build1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-data_2%3a1.8.7-1build1_all.deb new file mode 100644 index 0000000..7481b00 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libx11-data_2%3a1.8.7-1build1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxau6_1%3a1.0.9-1build6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxau6_1%3a1.0.9-1build6_amd64.deb new file mode 100644 index 0000000..3b094e2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxau6_1%3a1.0.9-1build6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxcb1_1.15-1ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxcb1_1.15-1ubuntu2_amd64.deb new file mode 100644 index 0000000..d60ab87 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxcb1_1.15-1ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxdmcp6_1%3a1.1.3-0ubuntu6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxdmcp6_1%3a1.1.3-0ubuntu6_amd64.deb new file mode 100644 index 0000000..447ec9a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxdmcp6_1%3a1.1.3-0ubuntu6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxml2_2.9.14+dfsg-1.3ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxml2_2.9.14+dfsg-1.3ubuntu3.6_amd64.deb new file mode 100644 index 0000000..845dfab Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxml2_2.9.14+dfsg-1.3ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxpm4_1%3a3.5.17-1build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxpm4_1%3a3.5.17-1build2_amd64.deb new file mode 100644 index 0000000..b9c961d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxpm4_1%3a3.5.17-1build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxslt1.1_1.1.39-0exp1ubuntu0.24.04.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxslt1.1_1.1.39-0exp1ubuntu0.24.04.3_amd64.deb new file mode 100644 index 0000000..aa1e6e2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxslt1.1_1.1.39-0exp1ubuntu0.24.04.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxtables12_1.8.10-3ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxtables12_1.8.10-3ubuntu2_amd64.deb new file mode 100644 index 0000000..2b855cb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxtables12_1.8.10-3ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxxhash0_0.8.2-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxxhash0_0.8.2-2build1_amd64.deb new file mode 100644 index 0000000..55d65a1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libxxhash0_0.8.2-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libyaml-0-2_0.2.5-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libyaml-0-2_0.2.5-1build1_amd64.deb new file mode 100644 index 0000000..c28f233 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libyaml-0-2_0.2.5-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzfs4linux_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzfs4linux_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..5599b97 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzfs4linux_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzpool5linux_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzpool5linux_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..db06434 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzpool5linux_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzstd1_1.5.5+dfsg2-2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzstd1_1.5.5+dfsg2-2build1.1_amd64.deb new file mode 100644 index 0000000..3c2dce1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/libzstd1_1.5.5+dfsg2-2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90-generic_6.8.0-90.91_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90-generic_6.8.0-90.91_amd64.deb new file mode 100644 index 0000000..db1eec4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90-generic_6.8.0-90.91_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90_6.8.0-90.91_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90_6.8.0-90.91_all.deb new file mode 100644 index 0000000..96f94f1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-6.8.0-90_6.8.0-90.91_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-generic_6.8.0-90.91_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-generic_6.8.0-90.91_amd64.deb new file mode 100644 index 0000000..0beb686 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-headers-generic_6.8.0-90.91_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-libc-dev_6.8.0-90.91_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-libc-dev_6.8.0-90.91_amd64.deb new file mode 100644 index 0000000..40c8398 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/linux-libc-dev_6.8.0-90.91_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/locales-all_2.39-0ubuntu8.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/locales-all_2.39-0ubuntu8.6_amd64.deb new file mode 100644 index 0000000..4dd908b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/locales-all_2.39-0ubuntu8.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logrotate_3.21.0-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logrotate_3.21.0-2build1_amd64.deb new file mode 100644 index 0000000..6ec18ea Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logrotate_3.21.0-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logsave_1.47.0-2.4~exp1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logsave_1.47.0-2.4~exp1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..214837b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/logsave_1.47.0-2.4~exp1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-base_11.6_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-base_11.6_all.deb new file mode 100644 index 0000000..f902086 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-base_11.6_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-release_12.0-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-release_12.0-2_all.deb new file mode 100644 index 0000000..26df6b8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsb-release_12.0-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsscsi_0.32-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsscsi_0.32-1build1_amd64.deb new file mode 100644 index 0000000..798395b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lsscsi_0.32-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lto-disabled-list_47_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lto-disabled-list_47_all.deb new file mode 100644 index 0000000..f011ef7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lto-disabled-list_47_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lvm2_2.03.16-3ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lvm2_2.03.16-3ubuntu3.2_amd64.deb new file mode 100644 index 0000000..7b5502e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/lvm2_2.03.16-3ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/make_4.3-4.1build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/make_4.3-4.1build2_amd64.deb new file mode 100644 index 0000000..c12a468 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/make_4.3-4.1build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages-dev_6.7-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages-dev_6.7-2_all.deb new file mode 100644 index 0000000..91dcd5c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages-dev_6.7-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages_6.7-2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages_6.7-2_all.deb new file mode 100644 index 0000000..dbdf8c1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/manpages_6.7-2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mount_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mount_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..9f11528 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mount_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mt-st_1.7-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mt-st_1.7-1_amd64.deb new file mode 100644 index 0000000..46cbceb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mt-st_1.7-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mtx_1.3.12-16build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mtx_1.3.12-16build1_amd64.deb new file mode 100644 index 0000000..724ea11 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/mtx_1.3.12-16build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/net-tools_2.10-0.1ubuntu4.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/net-tools_2.10-0.1ubuntu4.4_amd64.deb new file mode 100644 index 0000000..28b04d7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/net-tools_2.10-0.1ubuntu4.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/netbase_6.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/netbase_6.4_all.deb new file mode 100644 index 0000000..7576dcf Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/netbase_6.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/networkd-dispatcher_2.2.4-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/networkd-dispatcher_2.2.4-1_all.deb new file mode 100644 index 0000000..80783f5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/networkd-dispatcher_2.2.4-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-common_1%3a2.6.4-3ubuntu5.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-common_1%3a2.6.4-3ubuntu5.1_amd64.deb new file mode 100644 index 0000000..5ec33e5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-common_1%3a2.6.4-3ubuntu5.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-kernel-server_1%3a2.6.4-3ubuntu5.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-kernel-server_1%3a2.6.4-3ubuntu5.1_amd64.deb new file mode 100644 index 0000000..c4bb7a5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nfs-kernel-server_1%3a2.6.4-3ubuntu5.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nftables_1.0.9-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nftables_1.0.9-1build1_amd64.deb new file mode 100644 index 0000000..8d279f7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nftables_1.0.9-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx-common_1.24.0-2ubuntu7.5_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx-common_1.24.0-2ubuntu7.5_all.deb new file mode 100644 index 0000000..9685a0e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx-common_1.24.0-2ubuntu7.5_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx_1.24.0-2ubuntu7.5_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx_1.24.0-2ubuntu7.5_amd64.deb new file mode 100644 index 0000000..718332a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nginx_1.24.0-2ubuntu7.5_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nodejs_23.11.1-1nodesource1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nodejs_23.11.1-1nodesource1_amd64.deb new file mode 100644 index 0000000..b1334b8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nodejs_23.11.1-1nodesource1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nvme-cli_2.8-1ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nvme-cli_2.8-1ubuntu0.1_amd64.deb new file mode 100644 index 0000000..e2ac5c2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/nvme-cli_2.8-1ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/open-iscsi_2.1.9-3ubuntu5.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/open-iscsi_2.1.9-3ubuntu5.4_amd64.deb new file mode 100644 index 0000000..35d3dce Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/open-iscsi_2.1.9-3ubuntu5.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/openssl_3.0.13-0ubuntu3.6_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/openssl_3.0.13-0ubuntu3.6_amd64.deb new file mode 100644 index 0000000..d3c7c69 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/openssl_3.0.13-0ubuntu3.6_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/parted_3.6-4build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/parted_3.6-4build1_amd64.deb new file mode 100644 index 0000000..2429ea5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/parted_3.6-4build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/passwd_1%3a4.13+dfsg1-4ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/passwd_1%3a4.13+dfsg1-4ubuntu3.2_amd64.deb new file mode 100644 index 0000000..250bda6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/passwd_1%3a4.13+dfsg1-4ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/patch_2.7.6-7build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/patch_2.7.6-7build3_amd64.deb new file mode 100644 index 0000000..e94244e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/patch_2.7.6-7build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/pci.ids_0.0~2024.03.31-1ubuntu0.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/pci.ids_0.0~2024.03.31-1ubuntu0.1_all.deb new file mode 100644 index 0000000..291f3c2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/pci.ids_0.0~2024.03.31-1ubuntu0.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-base_5.38.2-3.2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-base_5.38.2-3.2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..ad7b7f0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-base_5.38.2-3.2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-modules-5.38_5.38.2-3.2ubuntu0.2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-modules-5.38_5.38.2-3.2ubuntu0.2_all.deb new file mode 100644 index 0000000..b087dd7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl-modules-5.38_5.38.2-3.2ubuntu0.2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl_5.38.2-3.2ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl_5.38.2-3.2ubuntu0.2_amd64.deb new file mode 100644 index 0000000..c591f86 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/perl_5.38.2-3.2ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-16_16.11-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-16_16.11-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..70f172c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-16_16.11-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-16_16.11-0ubuntu0.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-16_16.11-0ubuntu0.24.04.1_amd64.deb new file mode 100644 index 0000000..a92cfd5 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-16_16.11-0ubuntu0.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-common_257build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-common_257build1.1_all.deb new file mode 100644 index 0000000..00f7642 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client-common_257build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client_16+257build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client_16+257build1.1_all.deb new file mode 100644 index 0000000..53c9f02 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-client_16+257build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-common_257build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-common_257build1.1_all.deb new file mode 100644 index 0000000..50a8895 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-common_257build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-contrib_16+257build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-contrib_16+257build1.1_all.deb new file mode 100644 index 0000000..d97f2b8 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql-contrib_16+257build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql_16+257build1.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql_16+257build1.1_all.deb new file mode 100644 index 0000000..3153ccb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/postgresql_16+257build1.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/procps_2%3a4.0.4-4ubuntu3.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/procps_2%3a4.0.4-4ubuntu3.2_amd64.deb new file mode 100644 index 0000000..3509593 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/procps_2%3a4.0.4-4ubuntu3.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/psmisc_23.7-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/psmisc_23.7-1build1_amd64.deb new file mode 100644 index 0000000..34ea6d9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/psmisc_23.7-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/publicsuffix_20231001.0357-0.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/publicsuffix_20231001.0357-0.1_all.deb new file mode 100644 index 0000000..e9f61d7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/publicsuffix_20231001.0357-0.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-cryptography_41.0.7-4ubuntu0.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-cryptography_41.0.7-4ubuntu0.1_amd64.deb new file mode 100644 index 0000000..e4b18fd Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-cryptography_41.0.7-4ubuntu0.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dbus_1.3.2-5build3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dbus_1.3.2-5build3_amd64.deb new file mode 100644 index 0000000..9016634 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dbus_1.3.2-5build3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dnspython_2.6.1-1ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dnspython_2.6.1-1ubuntu1_all.deb new file mode 100644 index 0000000..031128c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-dnspython_2.6.1-1ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gi_3.48.2-1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gi_3.48.2-1_amd64.deb new file mode 100644 index 0000000..f5392ab Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gi_3.48.2-1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gpg_1.18.0-4.1ubuntu4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gpg_1.18.0-4.1ubuntu4_amd64.deb new file mode 100644 index 0000000..73fe3fa Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-gpg_1.18.0-4.1ubuntu4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-idna_3.6-2ubuntu0.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-idna_3.6-2ubuntu0.1_all.deb new file mode 100644 index 0000000..d509d74 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-idna_3.6-2ubuntu0.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-ldb_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-ldb_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..ecab7b7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-ldb_2%3a2.8.0+samba4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-markdown_3.5.2-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-markdown_3.5.2-1_all.deb new file mode 100644 index 0000000..04ffce6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-markdown_3.5.2-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-minimal_3.12.3-0ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-minimal_3.12.3-0ubuntu2.1_amd64.deb new file mode 100644 index 0000000..a0da066 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-minimal_3.12.3-0ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pkg-resources_68.1.2-2ubuntu1.2_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pkg-resources_68.1.2-2ubuntu1.2_all.deb new file mode 100644 index 0000000..62006a7 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pkg-resources_68.1.2-2ubuntu1.2_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pygments_2.17.2+dfsg-1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pygments_2.17.2+dfsg-1_all.deb new file mode 100644 index 0000000..11f8536 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-pygments_2.17.2+dfsg-1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..5b7bf8a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-talloc_2.4.2-1build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-talloc_2.4.2-1build2_amd64.deb new file mode 100644 index 0000000..32e8f53 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-talloc_2.4.2-1build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-tdb_1.4.10-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-tdb_1.4.10-1build1_amd64.deb new file mode 100644 index 0000000..ba47c59 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-tdb_1.4.10-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-yaml_6.0.1-2build2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-yaml_6.0.1-2build2_amd64.deb new file mode 100644 index 0000000..3a1e9e1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3-yaml_6.0.1-2build2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb new file mode 100644 index 0000000..ef26761 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12-minimal_3.12.3-1ubuntu0.10_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12_3.12.3-1ubuntu0.10_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12_3.12.3-1ubuntu0.10_amd64.deb new file mode 100644 index 0000000..1af592f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3.12_3.12.3-1ubuntu0.10_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3_3.12.3-0ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3_3.12.3-0ubuntu2.1_amd64.deb new file mode 100644 index 0000000..b1388ab Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/python3_3.12.3-0ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/readline-common_8.2-4build1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/readline-common_8.2-4build1_all.deb new file mode 100644 index 0000000..b0b31d0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/readline-common_8.2-4build1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcbind_1.2.6-7ubuntu2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcbind_1.2.6-7ubuntu2_amd64.deb new file mode 100644 index 0000000..0c9d593 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcbind_1.2.6-7ubuntu2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcsvc-proto_1.4.2-0ubuntu7_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcsvc-proto_1.4.2-0ubuntu7_amd64.deb new file mode 100644 index 0000000..47abbcc Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/rpcsvc-proto_1.4.2-0ubuntu7_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-ad-provision_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-ad-provision_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb new file mode 100644 index 0000000..57b9552 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-ad-provision_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common-bin_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common-bin_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..a083990 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common-bin_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb new file mode 100644 index 0000000..f643ba9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-common_2%3a4.19.5+dfsg-4ubuntu9.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-dsdb-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-dsdb-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..1ad9284 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-dsdb-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-libs_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-libs_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..8e00c1f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-libs_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-vfs-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-vfs-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..5d77382 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba-vfs-modules_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb new file mode 100644 index 0000000..fd2fbeb Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/samba_2%3a4.19.5+dfsg-4ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sensible-utils_0.0.22_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sensible-utils_0.0.22_all.deb new file mode 100644 index 0000000..291c72f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sensible-utils_0.0.22_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sequoia-chameleon-gnupg_0.5.1-2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sequoia-chameleon-gnupg_0.5.1-2_amd64.deb new file mode 100644 index 0000000..2540e98 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sequoia-chameleon-gnupg_0.5.1-2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sg3-utils_1.46-3ubuntu4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sg3-utils_1.46-3ubuntu4_amd64.deb new file mode 100644 index 0000000..083ee10 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sg3-utils_1.46-3ubuntu4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/shared-mime-info_2.4-4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/shared-mime-info_2.4-4_amd64.deb new file mode 100644 index 0000000..607c876 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/shared-mime-info_2.4-4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/smartmontools_7.4-2build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/smartmontools_7.4-2build1_amd64.deb new file mode 100644 index 0000000..66dee8e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/smartmontools_7.4-2build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ssl-cert_1.1.2ubuntu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ssl-cert_1.1.2ubuntu1_all.deb new file mode 100644 index 0000000..63d2142 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ssl-cert_1.1.2ubuntu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sudo_1.9.15p5-3ubuntu5.24.04.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sudo_1.9.15p5-3ubuntu5.24.04.1_amd64.deb new file mode 100644 index 0000000..e0f039e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sudo_1.9.15p5-3ubuntu5.24.04.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysstat_12.6.1-2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysstat_12.6.1-2_amd64.deb new file mode 100644 index 0000000..69c7ee4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysstat_12.6.1-2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-dev_255.4-1ubuntu8.11_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-dev_255.4-1ubuntu8.11_all.deb new file mode 100644 index 0000000..8611fd1 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-dev_255.4-1ubuntu8.11_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-hwe-hwdb_255.1.6_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-hwe-hwdb_255.1.6_all.deb new file mode 100644 index 0000000..a5dcf89 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-hwe-hwdb_255.1.6_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-resolved_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-resolved_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..fc6e86a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-resolved_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-sysv_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-sysv_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..b3f8be0 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd-sysv_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..ad2e124 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/systemd_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysvinit-utils_3.08-6ubuntu3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysvinit-utils_3.08-6ubuntu3_amd64.deb new file mode 100644 index 0000000..ffefff9 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/sysvinit-utils_3.08-6ubuntu3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tar_1.35+dfsg-3build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tar_1.35+dfsg-3build1_amd64.deb new file mode 100644 index 0000000..74a804a Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tar_1.35+dfsg-3build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tdb-tools_1.4.10-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tdb-tools_1.4.10-1build1_amd64.deb new file mode 100644 index 0000000..8e60e3d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tdb-tools_1.4.10-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/thin-provisioning-tools_0.9.0-2ubuntu5.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/thin-provisioning-tools_0.9.0-2ubuntu5.1_amd64.deb new file mode 100644 index 0000000..0a185b2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/thin-provisioning-tools_0.9.0-2ubuntu5.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata-legacy_2025b-0ubuntu0.24.04.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata-legacy_2025b-0ubuntu0.24.04.1_all.deb new file mode 100644 index 0000000..bf7443c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata-legacy_2025b-0ubuntu0.24.04.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata_2025b-0ubuntu0.24.04.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata_2025b-0ubuntu0.24.04.1_all.deb new file mode 100644 index 0000000..58c933c Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/tzdata_2025b-0ubuntu0.24.04.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ubuntu-keyring_2023.11.28.1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ubuntu-keyring_2023.11.28.1_all.deb new file mode 100644 index 0000000..3a4282f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ubuntu-keyring_2023.11.28.1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ucf_3.0043+nmu1_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ucf_3.0043+nmu1_all.deb new file mode 100644 index 0000000..feb54ca Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ucf_3.0043+nmu1_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/udev_255.4-1ubuntu8.11_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/udev_255.4-1ubuntu8.11_amd64.deb new file mode 100644 index 0000000..1769d9d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/udev_255.4-1ubuntu8.11_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ufw_0.36.2-6_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ufw_0.36.2-6_all.deb new file mode 100644 index 0000000..3aef361 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/ufw_0.36.2-6_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/uuid-runtime_2.39.3-9ubuntu6.3_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/uuid-runtime_2.39.3-9ubuntu6.3_amd64.deb new file mode 100644 index 0000000..0fbb2d2 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/uuid-runtime_2.39.3-9ubuntu6.3_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/wget_1.21.4-1ubuntu4.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/wget_1.21.4-1ubuntu4.1_amd64.deb new file mode 100644 index 0000000..ec4ec47 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/wget_1.21.4-1ubuntu4.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xdg-user-dirs_0.18-1build1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xdg-user-dirs_0.18-1build1_amd64.deb new file mode 100644 index 0000000..211d232 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xdg-user-dirs_0.18-1build1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xfsprogs_6.6.0-1ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xfsprogs_6.6.0-1ubuntu2.1_amd64.deb new file mode 100644 index 0000000..e14680f Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xfsprogs_6.6.0-1ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xz-utils_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xz-utils_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb new file mode 100644 index 0000000..a75954b Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/xz-utils_5.6.1+really5.4.5-1ubuntu0.2_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-dkms_2.2.2-0ubuntu9.4_all.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-dkms_2.2.2-0ubuntu9.4_all.deb new file mode 100644 index 0000000..1c60bc4 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-dkms_2.2.2-0ubuntu9.4_all.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-zed_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-zed_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..917749e Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfs-zed_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfsutils-linux_2.2.2-0ubuntu9.4_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfsutils-linux_2.2.2-0ubuntu9.4_amd64.deb new file mode 100644 index 0000000..d9a17b6 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zfsutils-linux_2.2.2-0ubuntu9.4_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g-dev_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g-dev_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb new file mode 100644 index 0000000..70d236d Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g-dev_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb new file mode 100644 index 0000000..7460faa Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zlib1g_1%3a1.3.dfsg-3.1ubuntu2.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zstd_1.5.5+dfsg2-2build1.1_amd64.deb b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zstd_1.5.5+dfsg2-2build1.1_amd64.deb new file mode 100644 index 0000000..f63b965 Binary files /dev/null and b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/debs/zstd_1.5.5+dfsg2-2build1.1_amd64.deb differ diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/downloaded-packages.txt b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/downloaded-packages.txt new file mode 100644 index 0000000..3fae1d2 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/downloaded-packages.txt @@ -0,0 +1,451 @@ +✓ adduser +✓ apt +✓ apt-utils +✓ attr +✓ bacula-bscan +✓ bacula-client +✓ bacula-common +✓ bacula-common-sqlite3 +✓ bacula-console +✓ bacula-fd +✓ bacula-sd +✓ binutils +✓ binutils-common +✓ binutils-x86-64-linux-gnu +✓ build-essential +✓ busybox-initramfs +✓ bzip2 +✓ ca-certificates +✓ cdebconf +✓ chrony +✓ clamav +✓ clamav-base +✓ clamav-daemon +✓ clamav-freshclam +✓ clamdscan +✓ coreutils +✓ cpio +✓ cpp +✓ cpp-13 +✓ cpp-13-x86-64-linux-gnu +✓ cpp-x86-64-linux-gnu +✓ curl +✓ dbus +✓ dbus-bin +✓ dbus-broker +✓ dbus-daemon +✓ dbus-session-bus-common +✓ dbus-system-bus-common +✓ dbus-user-session +✓ debconf +✓ debconf-i18n +✓ debianutils +✓ dhcpcd-base +✓ dirmngr +✓ dkms +✓ dmeventd +✓ dmidecode +✓ dmsetup +✓ dpkg +✓ dpkg-dev +✓ dracut-install +✓ e2fsprogs +✓ e2fsprogs-l10n +✓ fakeroot +✓ file +✓ finalrd +✓ fontconfig-config +✓ fonts-noto-core +✓ fonts-noto-mono +✓ g++ +✓ g++-13 +✓ g++-13-x86-64-linux-gnu +✓ gcc +✓ gcc-13 +✓ gcc-13-base +✓ gcc-13-x86-64-linux-gnu +✓ gcc-14-base +✓ gcc-x86-64-linux-gnu +✓ gdisk +✓ gir1.2-girepository-2.0 +✓ gir1.2-glib-2.0 +✓ git +✓ git-man +✓ gnupg +✓ gnupg-l10n +✓ gnupg-utils +✓ gpg +✓ gpg-agent +✓ gpgconf +✓ gpgsm +✓ gpgv +✓ gpg-wks-client +✓ groff-base +✓ g++-x86-64-linux-gnu +✓ ibverbs-providers +✓ initramfs-tools-bin +✓ initramfs-tools-core +✓ init-system-helpers +✓ iproute2 +✓ iptables +✓ jq +✓ keyboxd +✓ keyutils +✓ klibc-utils +✓ kmod +✓ krb5-locales +✓ less +✓ libacl1 +✓ libaio1t64 +✓ libalgorithm-diff-perl +✓ libalgorithm-diff-xs-perl +✓ libalgorithm-merge-perl +✓ libaom3 +✓ libapparmor1 +✓ libapt-pkg6.0t64 +✓ libargon2-1 +✓ libasan8 +✓ libassuan0 +✓ libatm1t64 +✓ libatomic1 +✓ libattr1 +✓ libaudit1 +✓ libaudit-common +✓ libavahi-client3 +✓ libavahi-common3 +✓ libavahi-common-data +✓ libbinutils +✓ libblkid1 +✓ libboost-iostreams1.83.0 +✓ libboost-thread1.83.0 +✓ libbpf1 +✓ libbrotli1 +✓ libbsd0 +✓ libbz2-1.0 +✓ libc6 +✓ libc6-dev +✓ libcap2 +✓ libcap2-bin +✓ libcap-ng0 +✓ libcc1-0 +✓ libc-dev-bin +✓ libc-devtools +✓ libcephfs2 +✓ libclamav12 +✓ libcom-err2 +✓ libcommon-sense-perl +✓ libcrypt1 +✓ libcrypt-dev +✓ libcryptsetup12 +✓ libctf0 +✓ libctf-nobfd0 +✓ libcups2t64 +✓ libcurl3t64-gnutls +✓ libcurl4t64 +✓ libdav1d7 +✓ libdb5.3t64 +✓ libdbus-1-3 +✓ libde265-0 +✓ libdebian-installer4 +✓ libdeflate0 +✓ libdevmapper1.02.1 +✓ libdevmapper-event1.02.1 +✓ libdpkg-perl +✓ libedit2 +✓ libelf1t64 +✓ liberror-perl +✓ libevent-core-2.1-7t64 +✓ libexpat1 +✓ libext2fs2t64 +✓ libfakeroot +✓ libfdisk1 +✓ libffi8 +✓ libfile-fcntllock-perl +✓ libfontconfig1 +✓ libfreetype6 +✓ libfribidi0 +✓ libgcc-13-dev +✓ libgcc-s1 +✓ libgcrypt20 +✓ libgd3 +✓ libgdbm6t64 +✓ libgdbm-compat4t64 +✓ libgirepository-1.0-1 +✓ libglib2.0-0t64 +✓ libglib2.0-data +✓ libgmp10 +✓ libgnutls30t64 +✓ libgomp1 +✓ libgpg-error0 +✓ libgpg-error-l10n +✓ libgpgme11t64 +✓ libgpm2 +✓ libgprofng0 +✓ libgssapi-krb5-2 +✓ libheif1 +✓ libheif-plugin-aomenc +✓ libheif-plugin-dav1d +✓ libheif-plugin-libde265 +✓ libhogweed6t64 +✓ libhwasan0 +✓ libibverbs1 +✓ libicu74 +✓ libidn2-0 +✓ libinih1 +✓ libip4tc2 +✓ libip6tc2 +✓ libisl23 +✓ libisns0t64 +✓ libitm1 +✓ libjansson4 +✓ libjbig0 +✓ libjpeg8 +✓ libjpeg-turbo8 +✓ libjq1 +✓ libjson-c5 +✓ libjson-perl +✓ libjson-xs-perl +✓ libk5crypto3 +✓ libkeyutils1 +✓ libklibc +✓ libkmod2 +✓ libkrb5-3 +✓ libkrb5support0 +✓ libksba8 +✓ libldap2 +✓ libldap-common +✓ libldb2 +✓ liblerc4 +✓ libllvm17t64 +✓ liblmdb0 +✓ liblocale-gettext-perl +✓ liblsan0 +✓ liblvm2cmd2.03 +✓ liblz4-1 +✓ liblzma5 +✓ liblzo2-2 +✓ liblzo2-dev +✓ libmagic1t64 +✓ libmagic-mgc +✓ libmd0 +✓ libmnl0 +✓ libmount1 +✓ libmpc3 +✓ libmpfr6 +✓ libmspack0t64 +✓ libncurses6 +✓ libncursesw6 +✓ libnetfilter-conntrack3 +✓ libnettle8t64 +✓ libnewt0.52 +✓ libnfnetlink0 +✓ libnfsidmap1 +✓ libnftables1 +✓ libnftnl11 +✓ libnghttp2-14 +✓ libnl-3-200 +✓ libnl-route-3-200 +✓ libnpth0t64 +✓ libnss-systemd +✓ libnvme1t64 +✓ libnvpair3linux +✓ libonig5 +✓ libopeniscsiusr +✓ libp11-kit0 +✓ libpam0g +✓ libpam-cap +✓ libpam-modules +✓ libpam-modules-bin +✓ libpam-runtime +✓ libpam-systemd +✓ libparted2t64 +✓ libpcre2-8-0 +✓ libperl5.38t64 +✓ libpng16-16t64 +✓ libpopt0 +✓ libpq5 +✓ libpq-dev +✓ libproc2-0 +✓ libpsl5t64 +✓ libpython3.12-minimal +✓ libpython3.12-stdlib +✓ libpython3.12t64 +✓ libpython3-stdlib +✓ libquadmath0 +✓ librados2 +✓ librdmacm1t64 +✓ libreadline8t64 +✓ librtmp1 +✓ libsasl2-2 +✓ libsasl2-modules +✓ libsasl2-modules-db +✓ libseccomp2 +✓ libselinux1 +✓ libsemanage2 +✓ libsemanage-common +✓ libsensors5 +✓ libsensors-config +✓ libsepol2 +✓ libsframe1 +✓ libsgutils2-1.46-2 +✓ libsgutils2-dev +✓ libsharpyuv0 +✓ libslang2 +✓ libsmartcols1 +✓ libsqlite3-0 +✓ libss2 +✓ libssh-4 +✓ libssl3t64 +✓ libssl-dev +✓ libstdc++-13-dev +✓ libstdc++6 +✓ libsystemd0 +✓ libsystemd-shared +✓ libtalloc2 +✓ libtasn1-6 +✓ libtdb1 +✓ libtevent0t64 +✓ libtext-charwidth-perl +✓ libtext-iconv-perl +✓ libtextwrap1 +✓ libtext-wrapi18n-perl +✓ libtiff6 +✓ libtinfo6 +✓ libtirpc3t64 +✓ libtirpc-common +✓ libtsan2 +✓ libtypes-serialiser-perl +✓ libubsan1 +✓ libuchardet0 +✓ libudev1 +✓ libunistring5 +✓ liburcu8t64 +✓ liburing2 +✓ libuuid1 +✓ libuutil3linux +✓ libwbclient0 +✓ libwebp7 +✓ libwrap0 +✓ libx11-6 +✓ libx11-data +✓ libxau6 +✓ libxcb1 +✓ libxdmcp6 +✓ libxml2 +✓ libxpm4 +✓ libxslt1.1 +✓ libxtables12 +✓ libxxhash0 +✓ libyaml-0-2 +✓ libzfs4linux +✓ libzpool5linux +✓ libzstd1 +✓ linux-headers-6.8.0-90 +✓ linux-headers-6.8.0-90-generic +✓ linux-headers-generic +✓ linux-libc-dev +✓ locales-all +✓ logrotate +✓ logsave +✓ lsb-base +✓ lsb-release +✓ lsscsi +✓ lto-disabled-list +✓ lvm2 +✓ make +✓ manpages +✓ manpages-dev +✓ mount +✓ mt-st +✓ mtx +✓ netbase +✓ net-tools +✓ networkd-dispatcher +✓ nfs-common +✓ nfs-kernel-server +✓ nftables +✓ nginx +✓ nginx-common +✓ nodejs +✓ nvme-cli +✓ open-iscsi +✓ openssl +✓ parted +✓ passwd +✓ patch +✓ pci.ids +✓ perl +✓ perl-base +✓ perl-modules-5.38 +✓ postgresql +✓ postgresql-16 +✓ postgresql-client +✓ postgresql-client-16 +✓ postgresql-client-common +✓ postgresql-common +✓ postgresql-contrib +✓ procps +✓ psmisc +✓ publicsuffix +✓ python3 +✓ python3.12 +✓ python3.12-minimal +✓ python3-cryptography +✓ python3-dbus +✓ python3-dnspython +✓ python3-gi +✓ python3-gpg +✓ python3-idna +✓ python3-ldb +✓ python3-markdown +✓ python3-minimal +✓ python3-pkg-resources +✓ python3-pygments +✓ python3-samba +✓ python3-talloc +✓ python3-tdb +✓ python3-yaml +✓ readline-common +✓ rpcbind +✓ rpcsvc-proto +✓ samba +✓ samba-ad-provision +✓ samba-common +✓ samba-common-bin +✓ samba-dsdb-modules +✓ samba-libs +✓ samba-vfs-modules +✓ sensible-utils +✓ sequoia-chameleon-gnupg +✓ sg3-utils +✓ shared-mime-info +✓ smartmontools +✓ ssl-cert +✓ sudo +✓ sysstat +✓ systemd +✓ systemd-dev +✓ systemd-hwe-hwdb +✓ systemd-resolved +✓ systemd-sysv +✓ sysvinit-utils +✓ tar +✓ tdb-tools +✓ thin-provisioning-tools +✓ tzdata +✓ tzdata-legacy +✓ ubuntu-keyring +✓ ucf +✓ udev +✓ ufw +✓ uuid-runtime +✓ wget +✓ xdg-user-dirs +✓ xfsprogs +✓ xz-utils +✓ zfs-dkms +✓ zfsutils-linux +✓ zfs-zed +✓ zlib1g +✓ zlib1g-dev +✓ zstd diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/missing-packages.txt b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/missing-packages.txt new file mode 100644 index 0000000..5e3036e --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/missing-packages.txt @@ -0,0 +1,4 @@ +✗ clamav-unofficial-sigs (not available) +✗ iscsitarget-dkms (not available) +✗ mhvtl (not available) +✗ mhvtl-utils (not available) diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/packages/package-list.txt b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/package-list.txt new file mode 100644 index 0000000..bba9d13 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/packages/package-list.txt @@ -0,0 +1,127 @@ +# Calypso Appliance - Required Packages +# Ubuntu 24.04 LTS +# All packages are REQUIRED for airgap deployment + +# ============================================ +# Base Tools & Utilities (15 packages) +# ============================================ +build-essential +curl +wget +git +ca-certificates +gnupg +lsb-release +jq +uuid-runtime +net-tools +iproute2 +systemd +chrony +ufw +sudo + +# ============================================ +# Database - PostgreSQL (4 packages) +# ============================================ +postgresql +postgresql-contrib +postgresql-client +libpq-dev + +# ============================================ +# Storage Tools (7 packages) +# ============================================ +lvm2 +xfsprogs +thin-provisioning-tools +smartmontools +nvme-cli +parted +gdisk + +# ============================================ +# ZFS Storage (2 packages) +# ============================================ +zfsutils-linux +zfs-dkms + +# ============================================ +# Tape Tools (4 packages) +# ============================================ +lsscsi +sg3-utils +mt-st +mtx + +# ============================================ +# iSCSI Tools (2 packages) +# ============================================ +iscsitarget-dkms +open-iscsi + +# ============================================ +# File Sharing - NFS (2 packages) +# ============================================ +nfs-kernel-server +nfs-common + +# ============================================ +# File Sharing - Samba/SMB (2 packages) +# ============================================ +samba +samba-common-bin + +# ============================================ +# Antivirus - ClamAV (4 packages) +# ============================================ +clamav +clamav-daemon +clamav-freshclam +clamav-unofficial-sigs + +# ============================================ +# Build Dependencies untuk Kernel Modules (5 packages) +# ============================================ +linux-headers-generic +dkms +gcc +make +libc6-dev + +# ============================================ +# Build Dependencies untuk mhVTL (3 packages) +# ============================================ +libsgutils2-dev +liblzo2-dev +zlib1g-dev + +# ============================================ +# Backup - Bacula (4 packages) +# ============================================ +bacula-common +bacula-sd +bacula-client +bacula-console + +# ============================================ +# Virtual Tape Library - mhVTL (2 packages) +# ============================================ +mhvtl +mhvtl-utils + +# ============================================ +# Runtime - Node.js (1 package) +# ============================================ +nodejs + +# ============================================ +# Reverse Proxy - Nginx (1 package) +# ============================================ +nginx + +# ============================================ +# TOTAL: 58 packages (semua REQUIRED) +# ============================================ +# Note: Dependencies akan otomatis di-resolve oleh script bundler +# Estimasi total dengan dependencies: ~200-300 packages diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/application.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/application.sh new file mode 100755 index 0000000..356fda0 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/application.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# Application build and installation +# + +build_and_install_application() { + log_info "Building and installing Calypso application..." + + # Build backend + build_backend + + # Build frontend + build_frontend + + # Install binaries and assets + install_application_files + + log_info "✓ Application built and installed" +} + +build_backend() { + log_info "Building backend..." + + cd "$PROJECT_ROOT/backend" + + # Ensure Go is in PATH + export PATH=$PATH:/usr/local/go/bin + + # Download dependencies + log_info "Downloading Go dependencies..." + go mod download + + # Build binary + log_info "Building Go binary..." + go build -ldflags "-X main.version=$CALYPSO_VERSION -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X main.gitCommit=$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')" \ + -o "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/bin/calypso-api" \ + ./cmd/calypso-api + + if [[ -f "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/bin/calypso-api" ]]; then + chmod +x "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/bin/calypso-api" + log_info "✓ Backend built successfully" + else + log_error "Backend build failed" + exit 1 + fi +} + +build_frontend() { + log_info "Building frontend..." + + cd "$PROJECT_ROOT/frontend" + + # Install dependencies + if [[ ! -d "node_modules" ]]; then + log_info "Installing frontend dependencies..." + npm install + fi + + # Build frontend + log_info "Building frontend assets..." + npm run build + + # Copy built assets + if [[ -d "dist" ]]; then + log_info "Copying frontend assets..." + cp -r dist/* "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/web/" + log_info "✓ Frontend built successfully" + else + log_error "Frontend build failed" + exit 1 + fi +} + +install_application_files() { + log_info "Installing application files..." + + # Copy migrations + if [[ -d "$PROJECT_ROOT/db/migrations" ]]; then + cp -r "$PROJECT_ROOT/db/migrations"/* "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/migrations/" 2>/dev/null || true + fi + + # Copy scripts + if [[ -d "$PROJECT_ROOT/scripts" ]]; then + cp -r "$PROJECT_ROOT/scripts"/* "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/scripts/" 2>/dev/null || true + chmod +x "$INSTALL_PREFIX/releases/$CALYPSO_VERSION/scripts"/*.sh 2>/dev/null || true + fi + + # Set ownership + chown -R calypso:calypso "$INSTALL_PREFIX" 2>/dev/null || chown -R root:root "$INSTALL_PREFIX" + + log_info "✓ Application files installed" +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/components.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/components.sh new file mode 100755 index 0000000..f8f43ef --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/components.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# +# Component installation (ZFS, SCST, MHVTL, Bacula) +# + +install_zfs() { + if command_exists zpool && command_exists zfs; then + log_info "ZFS already installed" + return 0 + fi + + log_info "Installing ZFS..." + + # Check if ZFS module is loaded + if lsmod | grep -q zfs; then + log_info "ZFS kernel module already loaded" + return 0 + fi + + # Install ZFS + apt-get install -y \ + zfsutils-linux \ + zfs-dkms || { + log_warn "ZFS installation failed. You may need to install manually." + return 1 + } + + # Load ZFS module + modprobe zfs || true + + log_info "✓ ZFS installed" + return 0 +} + +install_scst() { + if [[ -f /etc/scst.conf ]] || lsmod | grep -q scst; then + log_info "SCST appears to be installed" + return 0 + fi + + log_info "Installing SCST..." + log_warn "SCST requires building from source. This may take a while..." + + # Check if SCST source is available + if [[ -d "$PROJECT_ROOT/src/scst" ]] || [[ -d "/usr/src/scst" ]]; then + log_info "SCST source found, building..." + # SCST build would go here + # This is a placeholder - actual SCST installation is complex + log_warn "SCST installation requires manual steps. See documentation." + return 1 + else + log_warn "SCST source not found. Please install SCST manually." + log_info "See: docs/on-progress/scst-installation.md" + return 1 + fi +} + +install_mhvtl() { + if command_exists vtlcmd || systemctl is-active --quiet mhvtl 2>/dev/null; then + log_info "MHVTL already installed" + return 0 + fi + + log_info "Installing MHVTL..." + + # Install MHVTL from package or source + if apt-cache show mhvtl &>/dev/null; then + apt-get install -y mhvtl mhvtl-utils || { + log_warn "MHVTL package installation failed" + return 1 + } + else + log_warn "MHVTL package not available. Building from source..." + # MHVTL build from source would go here + log_warn "MHVTL installation requires manual steps. See documentation." + return 1 + fi + + # Enable and start MHVTL service + systemctl enable mhvtl || true + systemctl start mhvtl || true + + log_info "✓ MHVTL installed" + return 0 +} + +install_bacula() { + log_info "Installing Bacula (optional)..." + + # Check if Bacula is already installed + if command_exists bconsole || systemctl is-active --quiet bacula-sd 2>/dev/null; then + log_info "Bacula already installed" + return 0 + fi + + # Install Bacula packages + apt-get install -y \ + bacula-common \ + bacula-sd \ + bacula-client \ + bacula-console || { + log_warn "Bacula installation failed or packages not available" + log_info "Bacula can be installed separately if needed" + return 1 + } + + log_info "✓ Bacula installed (configuration required separately)" + return 0 +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/configuration.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/configuration.sh new file mode 100755 index 0000000..c12ab20 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/configuration.sh @@ -0,0 +1,108 @@ +#!/bin/bash +# +# Configuration setup +# + +setup_configuration() { + log_info "Setting up configuration..." + + # Generate secrets + generate_secrets + + # Copy configuration templates + copy_configuration_templates + + # Setup environment file + setup_environment_file + + log_info "✓ Configuration setup complete" +} + +generate_secrets() { + log_info "Generating secrets..." + + # Generate JWT secret if not set + if [[ -z "${CALYPSO_JWT_SECRET:-}" ]]; then + CALYPSO_JWT_SECRET=$(generate_jwt_secret) + fi + + # Store secrets + echo "CALYPSO_JWT_SECRET=$CALYPSO_JWT_SECRET" > "$CONFIG_DIR/secrets.env" + echo "CALYPSO_DB_PASSWORD=$CALYPSO_DB_PASSWORD" >> "$CONFIG_DIR/secrets.env" + chmod 600 "$CONFIG_DIR/secrets.env" + + log_info "✓ Secrets generated and stored in $CONFIG_DIR/secrets.env" +} + +copy_configuration_templates() { + log_info "Copying configuration templates..." + + # Copy main config if it doesn't exist + if [[ ! -f "$CONFIG_DIR/config.yaml" ]]; then + if [[ -f "$PROJECT_ROOT/backend/config.yaml.example" ]]; then + cp "$PROJECT_ROOT/backend/config.yaml.example" "$CONFIG_DIR/config.yaml" + log_info "✓ Configuration file created: $CONFIG_DIR/config.yaml" + else + # Create minimal config + create_minimal_config + fi + else + log_info "Configuration file already exists, skipping..." + fi +} + +create_minimal_config() { + cat > "$CONFIG_DIR/config.yaml" < /etc/systemd/system/calypso-api.service.d/env.conf < /etc/exports.d/calypso.exports + echo "# This file is managed by Calypso. Manual edits may be overwritten." >> /etc/exports.d/calypso.exports + fi + + # Include calypso exports in main exports file + if ! grep -q "calypso.exports" /etc/exports 2>/dev/null; then + echo "" >> /etc/exports + echo "# Include Calypso managed exports" >> /etc/exports + echo "/etc/exports.d/calypso.exports" >> /etc/exports || true + fi + + log_info "✓ NFS configured" +} + +configure_samba() { + log_info "Configuring Samba..." + + # Backup original smb.conf if it exists and hasn't been backed up + if [[ -f /etc/samba/smb.conf ]] && [[ ! -f /etc/samba/smb.conf.calypso-backup ]]; then + cp /etc/samba/smb.conf /etc/samba/smb.conf.calypso-backup + log_info "Backed up original smb.conf" + fi + + # Create Calypso Samba configuration directory + mkdir -p "$CONFIG_DIR/samba" + + # Create base Samba config (minimal, will be extended by Calypso) + if [[ ! -f "$CONFIG_DIR/samba/smb.conf.calypso" ]]; then + cat > "$CONFIG_DIR/samba/smb.conf.calypso" </dev/null; then + echo "" >> /etc/samba/smb.conf + echo "# Include Calypso managed shares" >> /etc/samba/smb.conf + echo "include = $CONFIG_DIR/samba/smb.conf.calypso" >> /etc/samba/smb.conf + fi + + # Test Samba configuration + if command_exists testparm; then + if testparm -s &>/dev/null; then + log_info "✓ Samba configuration valid" + else + log_warn "Samba configuration test failed, but continuing..." + fi + fi + + log_info "✓ Samba configured" +} + +configure_clamav() { + log_info "Configuring ClamAV..." + + # Create ClamAV configuration directory + mkdir -p "$CONFIG_DIR/clamav" + + # Configure ClamAV daemon + if [[ -f /etc/clamav/clamd.conf ]]; then + # Backup original + if [[ ! -f /etc/clamav/clamd.conf.calypso-backup ]]; then + cp /etc/clamav/clamd.conf /etc/clamav/clamd.conf.calypso-backup + fi + + # Update configuration for Calypso + sed -i 's|^#LocalSocket|LocalSocket|' /etc/clamav/clamd.conf || true + sed -i 's|^LocalSocket.*|LocalSocket /var/run/clamav/clamd.ctl|' /etc/clamav/clamd.conf || true + + # Set quarantine directory + if ! grep -q "QuarantineDir" /etc/clamav/clamd.conf; then + echo "QuarantineDir $DATA_DIR/quarantine" >> /etc/clamav/clamd.conf + fi + fi + + # Configure freshclam + if [[ -f /etc/clamav/freshclam.conf ]]; then + # Backup original + if [[ ! -f /etc/clamav/freshclam.conf.calypso-backup ]]; then + cp /etc/clamav/freshclam.conf /etc/clamav/freshclam.conf.calypso-backup + fi + + # Enable automatic updates + sed -i 's|^#Checks|Checks|' /etc/clamav/freshclam.conf || true + fi + + # Create quarantine directory + mkdir -p "$DATA_DIR/quarantine" + chown clamav:clamav "$DATA_DIR/quarantine" 2>/dev/null || chown root:root "$DATA_DIR/quarantine" + chmod 755 "$DATA_DIR/quarantine" + + log_info "✓ ClamAV configured" +} + +configure_all_services() { + log_info "Configuring file sharing and antivirus services..." + + configure_nfs + configure_samba + configure_clamav + + log_info "✓ All services configured" +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/database.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/database.sh new file mode 100755 index 0000000..d3ab7e8 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/database.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# Database setup and configuration +# + +setup_database() { + log_info "Setting up database..." + + # Generate database password if not set + if [[ -z "${CALYPSO_DB_PASSWORD:-}" ]]; then + CALYPSO_DB_PASSWORD=$(generate_db_password) + log_info "Generated database password" + fi + + # Create database and user + create_database_user + + # Run migrations + run_migrations + + # Create default admin user + create_default_admin + + log_info "✓ Database setup complete" +} + +create_database_user() { + log_info "Creating database and user..." + + # Create database + sudo -u postgres psql -c "CREATE DATABASE calypso;" 2>/dev/null || log_info "Database already exists" + + # Create user + sudo -u postgres psql -c "CREATE USER calypso WITH PASSWORD '$CALYPSO_DB_PASSWORD';" 2>/dev/null || { + log_info "User already exists, updating password..." + sudo -u postgres psql -c "ALTER USER calypso WITH PASSWORD '$CALYPSO_DB_PASSWORD';" + } + + # Grant privileges + sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE calypso TO calypso;" + sudo -u postgres psql -c "ALTER DATABASE calypso OWNER TO calypso;" + + log_info "✓ Database and user created" +} + +run_migrations() { + log_info "Running database migrations..." + + # Migrations will be run on first API startup + # But we can verify the database is accessible + export PGPASSWORD="$CALYPSO_DB_PASSWORD" + if psql -h localhost -U calypso -d calypso -c "SELECT 1;" &>/dev/null; then + log_info "✓ Database connection verified" + else + log_warn "Database connection test failed. Migrations will run on first API start." + fi + unset PGPASSWORD +} + +create_default_admin() { + log_info "Creating default admin user..." + + # Generate admin password + ADMIN_PASSWORD=$(generate_random_string 16) + echo "$ADMIN_PASSWORD" > /tmp/calypso_admin_password + chmod 600 /tmp/calypso_admin_password + + # Hash password (using Go's password hashing) + # This will be done by the API on first login or via setup script + log_info "Default admin credentials:" + log_info " Username: admin" + log_info " Password: $ADMIN_PASSWORD" + log_warn "Please change the default password after first login!" + + # Store password hash in database (if API is available) + # Otherwise, it will be created on first API run +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/dependencies.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/dependencies.sh new file mode 100755 index 0000000..a94a7ab --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/dependencies.sh @@ -0,0 +1,223 @@ +#!/bin/bash +# +# System dependencies installation +# + +install_system_dependencies() { + log_info "Installing system dependencies..." + + # Update package lists + log_info "Updating package lists..." + apt-get update -qq + + # Install base tools + log_info "Installing base build tools..." + apt-get install -y \ + build-essential \ + curl \ + wget \ + git \ + ca-certificates \ + gnupg \ + lsb-release \ + jq \ + uuid-runtime \ + net-tools \ + iproute2 \ + systemd \ + chrony \ + ufw \ + sudo + + # Install Go + install_go + + # Install Node.js + install_nodejs + + # Install PostgreSQL + install_postgresql + + # Install storage tools + install_storage_tools + + # Install tape tools + install_tape_tools + + # Install SCST prerequisites + install_scst_prerequisites + + # Install file sharing services + install_file_sharing_services + + # Install antivirus + install_antivirus + + log_info "✓ System dependencies installed" +} + +install_go() { + if command_exists go; then + local installed_ver=$(get_installed_version go) + log_info "Go already installed: $installed_ver" + return 0 + fi + + log_info "Installing Go 1.22..." + local GO_VERSION="1.22.0" + local GO_ARCH="linux-amd64" + + cd /tmp + wget -q "https://go.dev/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" + rm -rf /usr/local/go + tar -C /usr/local -xzf "go${GO_VERSION}.${GO_ARCH}.tar.gz" + rm "go${GO_VERSION}.${GO_ARCH}.tar.gz" + + # Add to PATH + if ! grep -q "/usr/local/go/bin" /etc/profile; then + echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile + fi + export PATH=$PATH:/usr/local/go/bin + + log_info "✓ Go installed" +} + +install_nodejs() { + if command_exists node; then + local installed_ver=$(get_installed_version node) + log_info "Node.js already installed: $installed_ver" + return 0 + fi + + log_info "Installing Node.js 20.x LTS..." + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - + apt-get install -y nodejs + + # Install pnpm + if ! command_exists pnpm; then + npm install -g pnpm + fi + + log_info "✓ Node.js and pnpm installed" +} + +install_postgresql() { + if command_exists psql; then + local installed_ver=$(get_installed_version psql) + log_info "PostgreSQL already installed: $installed_ver" + systemctl start postgresql || true + return 0 + fi + + log_info "Installing PostgreSQL..." + apt-get install -y \ + postgresql \ + postgresql-contrib \ + libpq-dev + + systemctl enable postgresql + systemctl start postgresql + + wait_for_service postgresql + + log_info "✓ PostgreSQL installed and started" +} + +install_storage_tools() { + log_info "Installing storage tools..." + apt-get install -y \ + lvm2 \ + xfsprogs \ + thin-provisioning-tools \ + smartmontools \ + nvme-cli \ + parted \ + gdisk + + log_info "✓ Storage tools installed" +} + +install_tape_tools() { + log_info "Installing tape tools..." + apt-get install -y \ + lsscsi \ + sg3-utils \ + mt-st \ + mtx + + log_info "✓ Tape tools installed" +} + +install_scst_prerequisites() { + log_info "Installing SCST prerequisites..." + apt-get install -y \ + dkms \ + linux-headers-$(uname -r) \ + build-essential + + log_info "✓ SCST prerequisites installed" +} + +install_file_sharing_services() { + log_info "Installing file sharing services (NFS and SMB)..." + + # Install NFS server + if ! systemctl is-active --quiet nfs-server 2>/dev/null; then + log_info "Installing NFS server..." + apt-get install -y \ + nfs-kernel-server \ + nfs-common + + # Enable NFS services + systemctl enable nfs-server || true + systemctl enable rpcbind || true + + log_info "✓ NFS server installed" + else + log_info "NFS server already installed" + fi + + # Install Samba (SMB/CIFS) + if ! systemctl is-active --quiet smbd 2>/dev/null; then + log_info "Installing Samba (SMB/CIFS)..." + apt-get install -y \ + samba \ + samba-common-bin + + # Enable Samba services + systemctl enable smbd || true + systemctl enable nmbd || true + + log_info "✓ Samba installed" + else + log_info "Samba already installed" + fi +} + +install_antivirus() { + log_info "Installing ClamAV antivirus..." + + if ! command_exists clamscan; then + apt-get install -y \ + clamav \ + clamav-daemon \ + clamav-freshclam \ + clamav-unofficial-sigs || { + log_warn "ClamAV installation failed" + return 1 + } + + # Update virus definitions + log_info "Updating ClamAV virus definitions (this may take a while)..." + freshclam || log_warn "Virus definition update failed, will update on first service start" + + # Enable ClamAV daemon + systemctl enable clamav-daemon || true + systemctl enable clamav-freshclam || true + + log_info "✓ ClamAV installed" + else + log_info "ClamAV already installed" + fi +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/filesystem.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/filesystem.sh new file mode 100755 index 0000000..df8f561 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/filesystem.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Filesystem structure setup +# + +create_filesystem_structure() { + log_info "Creating filesystem structure..." + + # Binary directory structure + log_info "Creating binary directory structure..." + mkdir -p "$INSTALL_PREFIX/releases/$CALYPSO_VERSION"/{bin,web,migrations,scripts} + mkdir -p "$INSTALL_PREFIX/third_party" + + # Create symlink for current version + if [[ -L "$INSTALL_PREFIX/current" ]]; then + rm "$INSTALL_PREFIX/current" + fi + ln -sf "releases/$CALYPSO_VERSION" "$INSTALL_PREFIX/current" + + # Configuration directory structure (per architecture spec) + log_info "Creating configuration directory structure..." + mkdir -p "$CONFIG_DIR"/{tls,integrations,system,scst,nfs,samba,clamav} + chmod 755 "$CONFIG_DIR" + chmod 700 "$CONFIG_DIR/tls" 2>/dev/null || true + + # Data directory structure (per architecture spec: /srv/calypso/) + log_info "Creating data directory structure..." + mkdir -p "$DATA_DIR"/{db,backups,object,shares,vtl,iscsi,uploads,cache,_system,quarantine} + chown -R calypso:calypso "$DATA_DIR" 2>/dev/null || chown -R root:root "$DATA_DIR" + chmod 755 "$DATA_DIR" + + # Create quarantine directory for ClamAV + mkdir -p "$DATA_DIR/quarantine" + chmod 700 "$DATA_DIR/quarantine" + + # Log directory + log_info "Creating log directory..." + mkdir -p "$LOG_DIR" + chmod 755 "$LOG_DIR" + + # Runtime directory + log_info "Creating runtime directory..." + mkdir -p "$LIB_DIR" "$RUN_DIR" + chmod 755 "$LIB_DIR" + chmod 755 "$RUN_DIR" + + # Create calypso user if it doesn't exist + if ! id "calypso" &>/dev/null; then + log_info "Creating calypso user..." + useradd -r -s /bin/false -d "$LIB_DIR" -c "Calypso Appliance" calypso || true + fi + + # Set ownership + chown -R calypso:calypso "$INSTALL_PREFIX" 2>/dev/null || chown -R root:root "$INSTALL_PREFIX" + chown -R calypso:calypso "$LIB_DIR" 2>/dev/null || chown -R root:root "$LIB_DIR" + chown -R calypso:calypso "$LOG_DIR" 2>/dev/null || chown -R root:root "$LOG_DIR" + + log_info "✓ Filesystem structure created" +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/helpers.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/helpers.sh new file mode 100755 index 0000000..6dd2aa6 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/helpers.sh @@ -0,0 +1,124 @@ +#!/bin/bash +# +# Helper functions for Calypso installer +# + +# Check prerequisites +check_prerequisites() { + log_info "Checking prerequisites..." + + # Check network connectivity + if ! ping -c 1 -W 2 8.8.8.8 &>/dev/null; then + log_warn "Network connectivity check failed. Some installations may fail." + else + log_info "✓ Network connectivity OK" + fi + + # Check disk space (need at least 10GB free) + AVAILABLE_SPACE=$(df -BG / | awk 'NR==2 {print $4}' | sed 's/G//') + if [[ $AVAILABLE_SPACE -lt 10 ]]; then + log_error "Insufficient disk space. Need at least 10GB, have ${AVAILABLE_SPACE}GB" + exit 1 + else + log_info "✓ Disk space OK (${AVAILABLE_SPACE}GB available)" + fi + + # Check if already installed + if [[ -d "$INSTALL_PREFIX/current" ]]; then + log_warn "Calypso appears to be already installed at $INSTALL_PREFIX" + read -p "Continue anyway? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi + fi + + log_info "✓ Prerequisites check complete" +} + +# Generate random string +generate_random_string() { + local length=${1:-32} + openssl rand -hex $((length / 2)) | head -c $length +} + +# Generate JWT secret +generate_jwt_secret() { + generate_random_string 64 +} + +# Generate database password +generate_db_password() { + generate_random_string 32 +} + +# Wait for service +wait_for_service() { + local service=$1 + local max_wait=${2:-30} + local count=0 + + while ! systemctl is-active --quiet "$service" && [[ $count -lt $max_wait ]]; do + sleep 1 + ((count++)) + done + + if systemctl is-active --quiet "$service"; then + return 0 + else + return 1 + fi +} + +# Check command exists +command_exists() { + command -v "$1" &> /dev/null +} + +# Get installed version +get_installed_version() { + local command=$1 + if command_exists "$command"; then + case $command in + go) + go version | awk '{print $3}' | sed 's/go//' + ;; + node) + node --version | sed 's/v//' + ;; + psql) + psql --version | awk '{print $3}' + ;; + *) + "$command" --version 2>/dev/null | head -1 + ;; + esac + fi +} + +# Print installation summary +print_installation_summary() { + log_info "" + log_info "==========================================" + log_info "Installation Summary" + log_info "==========================================" + log_info "" + log_info "Installation Paths:" + log_info " Binaries: $INSTALL_PREFIX/releases/$CALYPSO_VERSION" + log_info " Configuration: $CONFIG_DIR" + log_info " Data: $DATA_DIR" + log_info " Logs: $LOG_DIR" + log_info "" + log_info "Services:" + log_info " calypso-api: $(systemctl is-enabled calypso-api 2>/dev/null || echo 'not enabled')" + log_info "" + log_info "Default Credentials:" + log_info " Username: admin" + log_info " Password: $(cat /tmp/calypso_admin_password 2>/dev/null || echo 'Check installation log')" + log_info "" + log_info "Access:" + log_info " Web UI: http://$(hostname -I | awk '{print $1}'):3000" + log_info " API: http://$(hostname -I | awk '{print $1}'):8080" + log_info "" +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/post-install.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/post-install.sh new file mode 100755 index 0000000..77a1aa9 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/post-install.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Post-installation setup and verification +# + +post_install_setup() { + log_info "Running post-installation setup..." + + # Start services + log_info "Starting services..." + systemctl start calypso-api || log_warn "Failed to start calypso-api service" + + # Wait for API to be ready + log_info "Waiting for API to be ready..." + local max_wait=30 + local count=0 + + while ! curl -s http://localhost:8080/api/v1/health &>/dev/null && [[ $count -lt $max_wait ]]; do + sleep 1 + ((count++)) + done + + if curl -s http://localhost:8080/api/v1/health &>/dev/null; then + log_info "✓ API is ready" + else + log_warn "API did not become ready within $max_wait seconds" + fi + + # Print access information + print_access_info + + log_info "✓ Post-installation setup complete" +} + +print_access_info() { + local server_ip=$(hostname -I | awk '{print $1}') + + log_info "" + log_info "==========================================" + log_info "Calypso Appliance is Ready!" + log_info "==========================================" + log_info "" + log_info "Access Information:" + log_info " Web UI: http://$server_ip:3000" + log_info " API: http://$server_ip:8080" + log_info " Health: http://$server_ip:8080/api/v1/health" + log_info "" + log_info "Default Credentials:" + log_info " Username: admin" + log_info " Password: $(cat /tmp/calypso_admin_password 2>/dev/null || echo 'Check installation log')" + log_info "" + log_info "Configuration:" + log_info " Config: /etc/calypso/config.yaml" + log_info " Secrets: /etc/calypso/secrets.env" + log_info " Logs: sudo journalctl -u calypso-api -f" + log_info "" + log_warn "IMPORTANT: Change the default admin password after first login!" + log_info "" +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/services.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/services.sh new file mode 100755 index 0000000..7386526 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/services.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# +# Systemd services setup +# + +install_systemd_services() { + log_info "Installing systemd services..." + + # Install API service + install_api_service + + # Reload systemd + systemctl daemon-reload + + # Enable services + systemctl enable calypso-api + + # Enable file sharing services (if installed) + if systemctl list-unit-files | grep -q nfs-server.service; then + systemctl enable nfs-server || true + systemctl start nfs-server || true + log_info "✓ NFS server enabled" + fi + + if systemctl list-unit-files | grep -q smbd.service; then + systemctl enable smbd || true + systemctl enable nmbd || true + systemctl start smbd || true + systemctl start nmbd || true + log_info "✓ Samba services enabled" + fi + + # Enable ClamAV services (if installed) + if systemctl list-unit-files | grep -q clamav-daemon.service; then + systemctl enable clamav-daemon || true + systemctl enable clamav-freshclam || true + systemctl start clamav-daemon || true + systemctl start clamav-freshclam || true + log_info "✓ ClamAV services enabled" + fi + + log_info "✓ Systemd services installed" +} + +install_api_service() { + log_info "Installing calypso-api service..." + + cat > /etc/systemd/system/calypso-api.service </dev/null)" ]]; then + log_warn "Frontend assets not found or empty" + else + log_info "✓ Frontend assets exist" + fi + + # Check configuration + if [[ ! -f "$CONFIG_DIR/config.yaml" ]]; then + log_error "Configuration file not found: $CONFIG_DIR/config.yaml" + ((errors++)) + else + log_info "✓ Configuration file exists" + fi + + # Check database connection + export PGPASSWORD="$CALYPSO_DB_PASSWORD" + if psql -h localhost -U calypso -d calypso -c "SELECT 1;" &>/dev/null; then + log_info "✓ Database connection OK" + else + log_warn "Database connection test failed" + fi + unset PGPASSWORD + + # Check service file + if [[ ! -f "/etc/systemd/system/calypso-api.service" ]]; then + log_error "Service file not found" + ((errors++)) + else + log_info "✓ Service file exists" + fi + + if [[ $errors -gt 0 ]]; then + log_error "Installation verification found $errors error(s)" + return 1 + else + log_info "✓ Installation verification complete" + return 0 + fi +} + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/setup-reverse-proxy.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/setup-reverse-proxy.sh new file mode 100755 index 0000000..d87e5d1 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/scripts/setup-reverse-proxy.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Reverse Proxy Setup (Nginx/Caddy) +# + +setup_nginx() { + log_info "Setting up Nginx reverse proxy..." + + # Install Nginx if not installed + if ! command_exists nginx; then + apt-get install -y nginx + fi + + # Create Nginx configuration + cat > /etc/nginx/sites-available/calypso < /etc/caddy/Caddyfile <> /var/syslog/calypso.log 2>&1' +Restart=always +RestartSec=5 + +# Security hardening +NoNewPrivileges=false +PrivateTmp=true +ReadWritePaths=/var/syslog + +# Resource limits +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target + diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/third_party/download-binaries.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/third_party/download-binaries.sh new file mode 100755 index 0000000..f3e5707 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/third_party/download-binaries.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Download third-party binaries for airgap installation +# Run this on an internet-connected machine +# + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +log_info() { echo -e "\033[0;32m[INFO]\033[0m $1"; } + +# Download Go +log_info "Downloading Go 1.22..." +GO_VERSION="1.22.0" +GO_ARCH="linux-amd64" +wget -q "https://go.dev/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" -O "$SCRIPT_DIR/go.tar.gz" +log_info "✓ Go downloaded" + +# Download Node.js +log_info "Downloading Node.js 20.x LTS..." +NODE_VERSION="20.18.0" +NODE_ARCH="linux-x64" +wget -q "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${NODE_ARCH}.tar.xz" -O "$SCRIPT_DIR/nodejs.tar.xz" +log_info "✓ Node.js downloaded" + +log_info "✓ All binaries downloaded" diff --git a/dist/airgap/calypso-appliance-1.0.0-airgap/uninstall.sh b/dist/airgap/calypso-appliance-1.0.0-airgap/uninstall.sh new file mode 100755 index 0000000..5d6c2e8 --- /dev/null +++ b/dist/airgap/calypso-appliance-1.0.0-airgap/uninstall.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# AtlasOS - Calypso Appliance Uninstaller +# +# Usage: sudo ./installer/alpha/uninstall.sh [options] +# +# Options: +# --keep-data Keep data directories and database +# --keep-config Keep configuration files +# + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Check root +if [[ $EUID -ne 0 ]]; then + log_error "This script must be run as root (use sudo)" + exit 1 +fi + +KEEP_DATA=false +KEEP_CONFIG=false + +while [[ $# -gt 0 ]]; do + case $1 in + --keep-data) + KEEP_DATA=true + shift + ;; + --keep-config) + KEEP_CONFIG=true + shift + ;; + *) + log_error "Unknown option: $1" + exit 1 + ;; + esac +done + +log_info "==========================================" +log_info "Calypso Appliance Uninstaller" +log_info "==========================================" +log_info "" + +# Confirm +read -p "Are you sure you want to uninstall Calypso? (yes/no): " confirm +if [[ "$confirm" != "yes" ]]; then + log_info "Uninstallation cancelled" + exit 0 +fi + +# Stop services +log_info "Stopping services..." +systemctl stop calypso-api 2>/dev/null || true +systemctl disable calypso-api 2>/dev/null || true + +# Remove systemd services +log_info "Removing systemd services..." +rm -f /etc/systemd/system/calypso-api.service +rm -rf /etc/systemd/system/calypso-api.service.d/ +systemctl daemon-reload + +# Remove binaries +log_info "Removing binaries..." +rm -rf /opt/adastra/calypso + +# Remove configuration +if [[ "$KEEP_CONFIG" == "false" ]]; then + log_info "Removing configuration..." + rm -rf /etc/calypso +else + log_info "Keeping configuration files (--keep-config)" +fi + +# Remove data +if [[ "$KEEP_DATA" == "false" ]]; then + log_info "Removing data directories..." + rm -rf /srv/calypso + rm -rf /var/lib/calypso + rm -rf /var/log/calypso + rm -rf /run/calypso +else + log_info "Keeping data directories (--keep-data)" +fi + +# Remove user (optional) +read -p "Remove calypso user? (y/N): " remove_user +if [[ "$remove_user" =~ ^[Yy]$ ]]; then + userdel calypso 2>/dev/null || true + log_info "User removed" +fi + +log_info "" +log_info "==========================================" +log_info "Uninstallation Complete" +log_info "==========================================" +log_info "" + +if [[ "$KEEP_DATA" == "true" ]] || [[ "$KEEP_CONFIG" == "true" ]]; then + log_warn "Some files were kept. Manual cleanup may be required." +fi + diff --git a/docs/alpha/CODING-STANDARDS.md b/docs/alpha/CODING-STANDARDS.md new file mode 100644 index 0000000..fc45022 --- /dev/null +++ b/docs/alpha/CODING-STANDARDS.md @@ -0,0 +1,788 @@ +# Coding Standards +## AtlasOS - Calypso Backup Appliance + +**Version:** 1.0.0-alpha +**Date:** 2025-01-XX +**Status:** Active + +--- + +## 1. Overview + +This document defines the coding standards and best practices for the Calypso project. All code must adhere to these standards to ensure consistency, maintainability, and quality. + +## 2. General Principles + +### 2.1 Code Quality +- **Readability**: Code should be self-documenting and easy to understand +- **Maintainability**: Code should be easy to modify and extend +- **Consistency**: Follow consistent patterns across the codebase +- **Simplicity**: Prefer simple solutions over complex ones +- **DRY**: Don't Repeat Yourself - avoid code duplication + +### 2.2 Code Review +- All code must be reviewed before merging +- Reviewers should check for adherence to these standards +- Address review comments before merging + +### 2.3 Documentation +- Document complex logic and algorithms +- Keep comments up-to-date with code changes +- Write clear commit messages + +--- + +## 3. Backend (Go) Standards + +### 3.1 Code Formatting + +#### 3.1.1 Use gofmt +- Always run `gofmt` before committing +- Use `goimports` for import organization +- Configure IDE to format on save + +#### 3.1.2 Line Length +- Maximum line length: 100 characters +- Break long lines for readability + +#### 3.1.3 Indentation +- Use tabs for indentation (not spaces) +- Tab width: 4 spaces equivalent + +### 3.2 Naming Conventions + +#### 3.2.1 Packages +```go +// Good: lowercase, single word, descriptive +package storage +package auth +package monitoring + +// Bad: mixed case, abbreviations +package Storage +package Auth +package Mon +``` + +#### 3.2.2 Functions +```go +// Good: camelCase, descriptive +func createZFSPool(name string) error +func listNetworkInterfaces() ([]Interface, error) +func validateUserInput(input string) error + +// Bad: unclear names, abbreviations +func create(name string) error +func list() ([]Interface, error) +func val(input string) error +``` + +#### 3.2.3 Variables +```go +// Good: camelCase, descriptive +var poolName string +var networkInterfaces []Interface +var isActive bool + +// Bad: single letters, unclear +var n string +var ifs []Interface +var a bool +``` + +#### 3.2.4 Constants +```go +// Good: PascalCase for exported, camelCase for unexported +const DefaultPort = 8080 +const maxRetries = 3 + +// Bad: inconsistent casing +const defaultPort = 8080 +const MAX_RETRIES = 3 +``` + +#### 3.2.5 Types and Structs +```go +// Good: PascalCase, descriptive +type ZFSPool struct { + ID string + Name string + Status string +} + +// Bad: unclear names +type Pool struct { + I string + N string + S string +} +``` + +### 3.3 File Organization + +#### 3.3.1 File Structure +```go +// 1. Package declaration +package storage + +// 2. Imports (standard, third-party, local) +import ( + "context" + "fmt" + + "github.com/gin-gonic/gin" + + "github.com/atlasos/calypso/internal/common/database" +) + +// 3. Constants +const ( + defaultTimeout = 30 * time.Second +) + +// 4. Types +type Service struct { + db *database.DB +} + +// 5. Functions +func NewService(db *database.DB) *Service { + return &Service{db: db} +} +``` + +#### 3.3.2 File Naming +- Use lowercase with underscores: `handler.go`, `service.go` +- Test files: `handler_test.go` +- One main type per file when possible + +### 3.4 Error Handling + +#### 3.4.1 Error Return +```go +// Good: always return error as last value +func createPool(name string) (*Pool, error) { + if name == "" { + return nil, fmt.Errorf("pool name cannot be empty") + } + // ... +} + +// Bad: panic, no error return +func createPool(name string) *Pool { + if name == "" { + panic("pool name cannot be empty") + } +} +``` + +#### 3.4.2 Error Wrapping +```go +// Good: wrap errors with context +if err != nil { + return fmt.Errorf("failed to create pool %s: %w", name, err) +} + +// Bad: lose error context +if err != nil { + return err +} +``` + +#### 3.4.3 Error Messages +```go +// Good: clear, actionable error messages +return fmt.Errorf("pool '%s' already exists", name) +return fmt.Errorf("insufficient disk space: need %d bytes, have %d bytes", needed, available) + +// Bad: unclear error messages +return fmt.Errorf("error") +return fmt.Errorf("failed") +``` + +### 3.5 Comments + +#### 3.5.1 Package Comments +```go +// Package storage provides storage management functionality including +// ZFS pool and dataset operations, disk discovery, and storage repository management. +package storage +``` + +#### 3.5.2 Function Comments +```go +// CreateZFSPool creates a new ZFS pool with the specified configuration. +// It validates the pool name, checks disk availability, and creates the pool. +// Returns an error if the pool cannot be created. +func CreateZFSPool(ctx context.Context, name string, disks []string) error { + // ... +} +``` + +#### 3.5.3 Inline Comments +```go +// Good: explain why, not what +// Retry up to 3 times to handle transient network errors +for i := 0; i < 3; i++ { + // ... +} + +// Bad: obvious comments +// Loop 3 times +for i := 0; i < 3; i++ { + // ... +} +``` + +### 3.6 Testing + +#### 3.6.1 Test File Naming +- Test files: `*_test.go` +- Test functions: `TestFunctionName` +- Benchmark functions: `BenchmarkFunctionName` + +#### 3.6.2 Test Structure +```go +func TestCreateZFSPool(t *testing.T) { + tests := []struct { + name string + input string + wantErr bool + }{ + { + name: "valid pool name", + input: "tank", + wantErr: false, + }, + { + name: "empty pool name", + input: "", + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := createPool(tt.input) + if (err != nil) != tt.wantErr { + t.Errorf("createPool() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} +``` + +### 3.7 Concurrency + +#### 3.7.1 Context Usage +```go +// Good: always accept context as first parameter +func (s *Service) CreatePool(ctx context.Context, name string) error { + // Use context for cancellation and timeout + ctx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + // ... +} + +// Bad: no context +func (s *Service) CreatePool(name string) error { + // ... +} +``` + +#### 3.7.2 Goroutines +```go +// Good: use context for cancellation +go func() { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + // ... +}() + +// Bad: no cancellation mechanism +go func() { + // ... +}() +``` + +### 3.8 Database Operations + +#### 3.8.1 Query Context +```go +// Good: use context for queries +rows, err := s.db.QueryContext(ctx, query, args...) + +// Bad: no context +rows, err := s.db.Query(query, args...) +``` + +#### 3.8.2 Transactions +```go +// Good: use transactions for multiple operations +tx, err := s.db.BeginTx(ctx, nil) +if err != nil { + return err +} +defer tx.Rollback() + +// ... operations ... + +if err := tx.Commit(); err != nil { + return err +} +``` + +--- + +## 4. Frontend (TypeScript/React) Standards + +### 4.1 Code Formatting + +#### 4.1.1 Use Prettier +- Configure Prettier for consistent formatting +- Format on save enabled +- Maximum line length: 100 characters + +#### 4.1.2 Indentation +- Use 2 spaces for indentation +- Consistent spacing in JSX + +### 4.2 Naming Conventions + +#### 4.2.1 Components +```typescript +// Good: PascalCase, descriptive +function StoragePage() { } +function CreatePoolModal() { } +function NetworkInterfaceCard() { } + +// Bad: unclear names +function Page() { } +function Modal() { } +function Card() { } +``` + +#### 4.2.2 Functions +```typescript +// Good: camelCase, descriptive +function createZFSPool(name: string): Promise { } +function handleSubmit(event: React.FormEvent): void { } +function formatBytes(bytes: number): string { } + +// Bad: unclear names +function create(name: string) { } +function handle(e: any) { } +function fmt(b: number) { } +``` + +#### 4.2.3 Variables +```typescript +// Good: camelCase, descriptive +const poolName = 'tank' +const networkInterfaces: NetworkInterface[] = [] +const isActive = true + +// Bad: unclear names +const n = 'tank' +const ifs: any[] = [] +const a = true +``` + +#### 4.2.4 Constants +```typescript +// Good: UPPER_SNAKE_CASE for constants +const DEFAULT_PORT = 8080 +const MAX_RETRIES = 3 +const API_BASE_URL = '/api/v1' + +// Bad: inconsistent casing +const defaultPort = 8080 +const maxRetries = 3 +``` + +#### 4.2.5 Types and Interfaces +```typescript +// Good: PascalCase, descriptive +interface ZFSPool { + id: string + name: string + status: string +} + +type PoolStatus = 'online' | 'offline' | 'degraded' + +// Bad: unclear names +interface Pool { + i: string + n: string + s: string +} +``` + +### 4.3 File Organization + +#### 4.3.1 Component Structure +```typescript +// 1. Imports (React, third-party, local) +import { useState } from 'react' +import { useQuery } from '@tanstack/react-query' +import { zfsApi } from '@/api/storage' + +// 2. Types/Interfaces +interface Props { + poolId: string +} + +// 3. Component +export default function PoolDetail({ poolId }: Props) { + // 4. Hooks + const [isLoading, setIsLoading] = useState(false) + + // 5. Queries + const { data: pool } = useQuery({ + queryKey: ['pool', poolId], + queryFn: () => zfsApi.getPool(poolId), + }) + + // 6. Handlers + const handleDelete = () => { + // ... + } + + // 7. Effects + useEffect(() => { + // ... + }, [poolId]) + + // 8. Render + return ( + // JSX + ) +} +``` + +#### 4.3.2 File Naming +- Components: `PascalCase.tsx` (e.g., `StoragePage.tsx`) +- Utilities: `camelCase.ts` (e.g., `formatBytes.ts`) +- Types: `camelCase.ts` or `types.ts` +- Hooks: `useCamelCase.ts` (e.g., `useStorage.ts`) + +### 4.4 TypeScript + +#### 4.4.1 Type Safety +```typescript +// Good: explicit types +function createPool(name: string): Promise { + // ... +} + +// Bad: any types +function createPool(name: any): any { + // ... +} +``` + +#### 4.4.2 Interface Definitions +```typescript +// Good: clear interface definitions +interface ZFSPool { + id: string + name: string + status: 'online' | 'offline' | 'degraded' + totalCapacityBytes: number + usedCapacityBytes: number +} + +// Bad: unclear or missing types +interface Pool { + id: any + name: any + status: any +} +``` + +### 4.5 React Patterns + +#### 4.5.1 Hooks +```typescript +// Good: custom hooks for reusable logic +function useZFSPool(poolId: string) { + return useQuery({ + queryKey: ['pool', poolId], + queryFn: () => zfsApi.getPool(poolId), + }) +} + +// Usage +const { data: pool } = useZFSPool(poolId) +``` + +#### 4.5.2 Component Composition +```typescript +// Good: small, focused components +function PoolCard({ pool }: { pool: ZFSPool }) { + return ( +
+ + + +
+ ) +} + +// Bad: large, monolithic components +function PoolCard({ pool }: { pool: ZFSPool }) { + // 500+ lines of JSX +} +``` + +#### 4.5.3 State Management +```typescript +// Good: use React Query for server state +const { data, isLoading } = useQuery({ + queryKey: ['pools'], + queryFn: zfsApi.listPools, +}) + +// Good: use local state for UI state +const [isModalOpen, setIsModalOpen] = useState(false) + +// Good: use Zustand for global UI state +const { user, setUser } = useAuthStore() +``` + +### 4.6 Error Handling + +#### 4.6.1 Error Boundaries +```typescript +// Good: use error boundaries +function ErrorBoundary({ children }: { children: React.ReactNode }) { + // ... +} + +// Usage + + + +``` + +#### 4.6.2 Error Handling in Queries +```typescript +// Good: handle errors in queries +const { data, error, isLoading } = useQuery({ + queryKey: ['pools'], + queryFn: zfsApi.listPools, + onError: (error) => { + console.error('Failed to load pools:', error) + // Show user-friendly error message + }, +}) +``` + +### 4.7 Styling + +#### 4.7.1 TailwindCSS +```typescript +// Good: use Tailwind classes +
+

Storage Pools

+
+ +// Bad: inline styles +
+

Storage Pools

+
+``` + +#### 4.7.2 Class Organization +```typescript +// Good: logical grouping +className="flex items-center gap-4 p-6 bg-card-dark rounded-lg border border-border-dark hover:bg-border-dark transition-colors" + +// Bad: random order +className="p-6 flex border rounded-lg items-center gap-4 bg-card-dark border-border-dark" +``` + +### 4.8 Testing + +#### 4.8.1 Component Testing +```typescript +// Good: test component behavior +describe('StoragePage', () => { + it('displays pools when loaded', () => { + render() + expect(screen.getByText('tank')).toBeInTheDocument() + }) + + it('shows loading state', () => { + render() + expect(screen.getByText('Loading...')).toBeInTheDocument() + }) +}) +``` + +--- + +## 5. Git Commit Standards + +### 5.1 Commit Message Format +``` +(): + + + +